IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ParticleLayout.h
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
36#include "Particle/ParticleAttrib.h"
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...>;
51 using position_memory_space = typename particle_position_type::memory_space;
52 using position_execution_space = typename particle_position_type::execution_space;
53
54 typedef std::array<BC, 2 * Dim> bc_container_type;
55
56 static constexpr unsigned dim = Dim;
57
58 public:
59 ParticleLayout() { bcs_m.fill(BC::NO); };
60
61 ~ParticleLayout() = default;
62
63 template <class PBase>
64 void update(PBase&) {
65 // FIXME
66 std::cout << "TODO" << std::endl;
67 }
68
73 void setParticleBC(bc_container_type bcs) { bcs_m = bcs; }
74
78 const bc_container_type& getParticleBC() const { return bcs_m; }
79
84 void setParticleBC(BC bc) { bcs_m.fill(bc); }
85
91 void applyBC(const particle_position_type& R, const NDRegion<T, Dim>& nr);
92
93 private:
95 bc_container_type bcs_m;
96 };
97 } // namespace detail
98} // namespace ippl
99
100#include "Particle/ParticleLayout.hpp"
101
102#endif
Definition NDRegion.h:20
Definition ParticleAttrib.h:33
Definition Vector.h:23
Definition ParticleLayout.h:44
const bc_container_type & getParticleBC() const
Definition ParticleLayout.h:78
void setParticleBC(bc_container_type bcs)
Definition ParticleLayout.h:73
void applyBC(const particle_position_type &R, const NDRegion< T, Dim > &nr)
Definition ParticleLayout.hpp:34
void setParticleBC(BC bc)
Definition ParticleLayout.h:84
Definition Archive.h:20