IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ParticleLayout.h
Go to the documentation of this file.
1//
2// Class ParticleLayout
3// Base class for all particle layout classes.
4//
5// This class is used as the generic base class for all classes
6// which maintain the information on where all the particles are located
7// on a parallel machine. It is responsible for performing particle
8// load balancing.
9//
10// If more general layout information is needed, such as the global -> local
11// mapping for each particle, then derived classes must provide this info.
12//
13// When particles are created or destroyed, this class is also responsible
14// for determining where particles are to be created, gathering this
15// information, and recalculating the global indices of all the particles.
16// For consistency, creation and destruction requests are cached, and then
17// performed all in one step when the update routine is called.
18//
19// Derived classes must provide the following:
20// 1) Specific version of update and loadBalance. These are not virtual,
21// as this class is used as a template parameter (instead of being
22// assigned to a base class pointer).
23// 2) Internal storage to maintain their specific layout mechanism
24// 3) the definition of a class pair_iterator, and a function
25// void getPairlist(int, pair_iterator&, pair_iterator&) to get a
26// begin/end iterator pair to access the local neighbor of the Nth
27// local atom. This is not a virtual function, it is a requirement of
28// the templated class for use in other parts of the code.
29//
30
31#ifndef IPPL_PARTICLE_LAYOUT_H
32#define IPPL_PARTICLE_LAYOUT_H
33
34#include <map>
35
37#include "Particle/ParticleBC.h"
38
39namespace ippl {
40 namespace detail {
41 // ParticleLayout class definition. Template parameters are the type
42 // and dimension of the ParticlePos object used for the particles.
43 template <typename T, unsigned Dim, typename... PositionProperties>
45 public:
46 typedef T value_type;
47 typedef std::int64_t index_type;
49
50 using particle_position_type = ParticleAttrib<vector_type, PositionProperties...>;
53
54 typedef std::array<BC, 2 * Dim> bc_container_type;
55
56 static constexpr unsigned dim = Dim;
57
58 public:
60
61 ~ParticleLayout() = default;
62
63 template <class PBase>
64 void update(PBase&) {
65 // FIXME
66 std::cout << "TODO" << std::endl;
67 }
68
74
79 const bc_container_type& getParticleBC() const { return bcs_m; }
80
85 void setParticleBC(BC bc) { bcs_m.fill(bc); }
86
94
95 private:
98 };
99 } // namespace detail
100} // namespace ippl
101
103
104#endif
constexpr unsigned Dim
Definition Archive.h:20
const bc_container_type & getParticleBC() const
void setParticleBC(bc_container_type bcs)
typename particle_position_type::memory_space position_memory_space
void applyBC(const particle_position_type &R, const NDRegion< T, Dim > &nr)
std::array< BC, 2 *Dim > bc_container_type
ParticleAttrib< vector_type, PositionProperties... > particle_position_type
typename particle_position_type::execution_space position_execution_space