|
IPPL (Independent Parallel Particle Layer)
IPPL
|
#include <ParticleBase.h>
Public Types | |
| using | vector_type = typename PLayout::vector_type |
| using | index_type = typename PLayout::index_type |
| using | particle_position_type = typename PLayout::particle_position_type |
| using | particle_index_type = ParticleAttrib<index_type, IDProperties...> |
| using | Layout_t = PLayout |
| template<typename... Properties> | |
| using | attribute_type = typename detail::ParticleAttribBase<Properties...> |
| template<typename MemorySpace> | |
| using | container_type = std::vector<attribute_type<MemorySpace>*> |
| using | attribute_container_type |
| using | bc_container_type = typename PLayout::bc_container_type |
| using | hash_container_type = typename detail::ContainerForAllSpaces<detail::hash_type>::type |
| using | size_type = detail::size_type |
Public Member Functions | |
| ParticleBase () | |
| ParticleBase (Layout_t &layout) | |
| ~ParticleBase () | |
| void | initialize (Layout_t &layout) |
| size_type | getLocalNum () const |
| void | setLocalNum (size_type size) |
| size_type | getTotalNum () const |
| Layout_t & | getLayout () |
| const Layout_t & | getLayout () const |
| void | setParticleBC (const bc_container_type &bcs) |
| void | setParticleBC (BC bc) |
| template<typename MemorySpace> | |
| void | addAttribute (detail::ParticleAttribBase< MemorySpace > &pa) |
| template<typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space> | |
| attribute_type< MemorySpace > * | getAttribute (size_t i) |
| template<typename MemorySpace = void, typename Functor> | |
| void | forAllAttributes (Functor &&f) const |
| template<typename MemorySpace = void, typename Functor> | |
| void | forAllAttributes (Functor &&f) |
| unsigned | getAttributeNum () const |
| void | create (size_type nLocal) |
| void | createWithID (index_type id) |
| void | globalCreate (size_type nTotal) |
| template<typename... Properties> | |
| void | destroy (const Kokkos::View< bool *, Properties... > &invalid, const size_type destroyNum) |
| void | update () |
| template<typename... Properties> | |
| void | internalDestroy (const Kokkos::View< bool *, Properties... > &invalid, const size_type destroyNum) |
| template<typename HashType> | |
| void | sendToRank (int rank, int tag, std::vector< MPI_Request > &requests, const HashType &hash) |
| void | recvFromRank (int rank, int tag, size_type nRecvs) |
| template<typename Archive> | |
| void | serialize (Archive &ar, size_type nsends) |
| template<typename Archive> | |
| void | deserialize (Archive &ar, size_type nrecvs) |
| template<typename MemorySpace> | |
| size_type | packedSize (const size_type count) const |
| template<typename MemorySpace> | |
| detail::size_type | packedSize (const size_type count) const |
Public Attributes | |
| particle_position_type | R |
| view of particle positions | |
| particle_index_type | ID |
| view of particle IDs | |
Protected Member Functions | |
| void | pack (const hash_container_type &hash) |
| void | unpack (size_type nrecvs) |
Private Attributes | |
| Layout_t * | layout_m |
| particle layout | |
| size_type | localNum_m |
| processor local number of particles | |
| size_type | totalNum_m |
| total number of particles (across all processes) | |
| attribute_container_type | attributes_m |
| all attributes | |
| index_type | nextID_m |
| next unique particle ID | |
| index_type | numNodes_m |
| number of MPI ranks | |
| hash_container_type | deleteIndex_m |
| buffers for particle partitioning | |
| hash_container_type | keepIndex_m |
Static Private Attributes | |
| static constexpr bool | EnableIDs = sizeof...(IDProperties) > 0 |
| PLayout | the particle layout implementing an algorithm to distribute the particles among MPI ranks |
| IDProperties | the view properties for particle IDs (if any of the provided types is ippl::DisableParticleIDs, then particle IDs will be disabled for the bunch) |
Definition at line 87 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::attribute_container_type |
Definition at line 104 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::attribute_type = typename detail::ParticleAttribBase<Properties...> |
Definition at line 99 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::bc_container_type = typename PLayout::bc_container_type |
Definition at line 107 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::container_type = std::vector<attribute_type<MemorySpace>*> |
Definition at line 102 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::hash_container_type = typename detail::ContainerForAllSpaces<detail::hash_type>::type |
Definition at line 109 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::index_type = typename PLayout::index_type |
Definition at line 92 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::Layout_t = PLayout |
Definition at line 96 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::particle_index_type = ParticleAttrib<index_type, IDProperties...> |
Definition at line 94 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::particle_position_type = typename PLayout::particle_position_type |
Definition at line 93 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::size_type = detail::size_type |
Definition at line 111 of file ParticleBase.h.
| using ippl::ParticleBase< PLayout, IDProperties >::vector_type = typename PLayout::vector_type |
Definition at line 91 of file ParticleBase.h.
| ippl::ParticleBase< PLayout, IP >::ParticleBase | ( | ) |
If this constructor is used, the user must call 'initialize' with a layout object in order to use this.
Definition at line 55 of file ParticleBase.hpp.
References addAttribute(), ippl::Comm, EnableIDs, ID, layout_m, localNum_m, nextID_m, numNodes_m, R, and totalNum_m.
Referenced by ParticleBase().
| ippl::ParticleBase< PLayout, IP >::ParticleBase | ( | Layout_t & | layout | ) |
Ctor called when layout is provided with std::shared_ptr. It calls the default ctor which then calls the private ctor. The layout instance is moved to this class, hence, the argument is null afterwards, i.e., layout == nullptr.
| layout | to be moved. |
Definition at line 70 of file ParticleBase.hpp.
References initialize(), and ParticleBase().
|
inline |
Definition at line 143 of file ParticleBase.h.
| void ippl::ParticleBase< PLayout, IP >::addAttribute | ( | detail::ParticleAttribBase< MemorySpace > & | pa | ) |
Add particle attribute
| pa | attribute to be added to ParticleBase |
Definition at line 77 of file ParticleBase.hpp.
References attributes_m, ippl::get(), localNum_m, and ippl::detail::ParticleAttribBase< MemorySpace >::setParticleCount().
Referenced by ParticleBase().
| void ippl::ParticleBase< PLayout, IP >::create | ( | size_type | nLocal | ) |
Create nLocal processor local particles. This is a collective call, i.e. all MPI ranks must call this.
| nLocal | number of local particles to be created |
Definition at line 91 of file ParticleBase.hpp.
References ippl::Comm, EnableIDs, forAllAttributes(), ID, layout_m, localNum_m, nextID_m, numNodes_m, PAssert, and totalNum_m.
| void ippl::ParticleBase< PLayout, IP >::createWithID | ( | index_type | id | ) |
Create a new particle with a given ID. This is a collective call. If a process passes a negative number, it does not create a particle.
| id | particle identity number |
Definition at line 121 of file ParticleBase.hpp.
| void ippl::ParticleBase< PLayout, IP >::deserialize | ( | Archive & | ar, |
| size_type | nrecvs ) |
| void ippl::ParticleBase< PLayout, IP >::destroy | ( | const Kokkos::View< bool *, Properties... > & | invalid, |
| const size_type | destroyNum ) |
Particle deletion Function. Partition the particles into a valid region and an invalid region, effectively deleting the invalid particles. This is a collective call.
| invalid | View marking which indices are invalid |
| destroyNum | Total number of invalid particles |
Definition at line 156 of file ParticleBase.hpp.
References ippl::Comm, internalDestroy(), localNum_m, and totalNum_m.
|
inline |
Definition at line 223 of file ParticleBase.h.
|
inline |
Calls a given function for all attributes in the bunch
| MemorySpace | the memory space of the attributes to visit (void to visit all of them) |
| Functor | the functor type |
| f | a functor taking a single ParticleAttrib<MemorySpace> |
Definition at line 211 of file ParticleBase.h.
Referenced by create(), and serialize().
|
inline |
Get particle attribute
| i | attribute number in container |
Definition at line 199 of file ParticleBase.h.
|
inline |
Definition at line 240 of file ParticleBase.h.
|
inline |
Definition at line 167 of file ParticleBase.h.
|
inline |
Definition at line 172 of file ParticleBase.h.
|
inline |
Definition at line 155 of file ParticleBase.h.
Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::buildCells(), ippl::detail::copyAttributes(), ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::createPeriodicGhostParticles(), ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties... >::locateParticles(), ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::locateParticles(), and ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange().
|
inline |
Definition at line 162 of file ParticleBase.h.
| void ippl::ParticleBase< PLayout, IP >::globalCreate | ( | size_type | nTotal | ) |
Create nTotal particles globally, equally distributed among all processors. This is a collective call.
| nTotal | number of total particles to be created |
Definition at line 138 of file ParticleBase.hpp.
References ippl::Comm, layout_m, numNodes_m, and PAssert.
| void ippl::ParticleBase< PLayout, IP >::initialize | ( | Layout_t & | layout | ) |
Initialize the particle layout. Needs to be called when the ParticleBase instance is constructed with the default ctor.
Definition at line 83 of file ParticleBase.hpp.
References layout_m.
Referenced by ParticleBase().
| void ippl::ParticleBase< PLayout, IP >::internalDestroy | ( | const Kokkos::View< bool *, Properties... > & | invalid, |
| const size_type | destroyNum ) |
Definition at line 165 of file ParticleBase.hpp.
References deleteIndex_m, keepIndex_m, localNum_m, PAssert, and ippl::detail::runForAllSpaces().
Referenced by destroy(), and ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange().
|
protected |
Fill attributes of buffer.
| buffer | to send |
| hash | function to access index. |
Definition at line 337 of file ParticleBase.hpp.
References attributes_m, ippl::get(), and ippl::detail::runForAllSpaces().
| size_type ippl::ParticleBase< PLayout, IDProperties >::packedSize | ( | const size_type | count | ) | const |
Determine the total space necessary to store a certain number of particles
| MemorySpace | only consider attributes stored in this memory space |
| count | particle number |
Referenced by recvFromRank().
| detail::size_type ippl::ParticleBase< PLayout, IDProperties >::packedSize | ( | const size_type | count | ) | const |
Definition at line 328 of file ParticleBase.hpp.
| void ippl::ParticleBase< PLayout, IP >::recvFromRank | ( | int | rank, |
| int | tag, | ||
| size_type | nRecvs ) |
Receives particles from another rank
| rank | the source rank |
| tag | the MPI tag |
| recvNum | the number of messages already received (to distinguish the buffers) |
| nRecvs | the number of particles to receive |
Definition at line 293 of file ParticleBase.hpp.
References ippl::Comm, packedSize(), and ippl::detail::runForAllSpaces().
Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange().
| void ippl::ParticleBase< PLayout, IP >::sendToRank | ( | int | rank, |
| int | tag, | ||
| std::vector< MPI_Request > & | requests, | ||
| const HashType & | hash ) |
Sends particles to another rank
| HashType | the hash view type |
| rank | the destination rank |
| tag | the MPI tag |
| sendNum | the number of messages already sent (to distinguish the buffers) |
| requests | destination vector in which to store the MPI requests for polling purposes |
| hash | a hash view indicating which particles need to be sent to which rank |
Definition at line 269 of file ParticleBase.hpp.
References attributes_m, and ippl::get().
Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange().
| void ippl::ParticleBase< PLayout, IP >::serialize | ( | Archive & | ar, |
| size_type | nsends ) |
Serialize to do MPI calls.
| ar | archive |
Definition at line 310 of file ParticleBase.hpp.
References forAllAttributes().
|
inline |
Definition at line 157 of file ParticleBase.h.
Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::buildCells(), and ippl::detail::copyAttributes().
|
inline |
Set all boundary conditions to this BC
| bc | the boundary conditions |
Definition at line 184 of file ParticleBase.h.
|
inline |
Set all boundary conditions
| bc | the boundary conditions |
Definition at line 178 of file ParticleBase.h.
|
protected |
Fill my attributes.
| buffer | received |
Definition at line 347 of file ParticleBase.hpp.
References attributes_m, ippl::get(), and ippl::detail::runForAllSpaces().
|
inline |
Definition at line 280 of file ParticleBase.h.
|
private |
all attributes
Definition at line 365 of file ParticleBase.h.
Referenced by addAttribute(), pack(), sendToRank(), and unpack().
|
private |
buffers for particle partitioning
Definition at line 374 of file ParticleBase.h.
Referenced by internalDestroy().
|
staticconstexprprivate |
Definition at line 88 of file ParticleBase.h.
Referenced by create(), and ParticleBase().
| particle_index_type ippl::ParticleBase< PLayout, IDProperties >::ID |
view of particle IDs
Definition at line 118 of file ParticleBase.h.
Referenced by create(), and ParticleBase().
|
private |
Definition at line 375 of file ParticleBase.h.
Referenced by internalDestroy().
|
private |
particle layout
Definition at line 356 of file ParticleBase.h.
Referenced by create(), createWithID(), globalCreate(), initialize(), and ParticleBase().
|
private |
processor local number of particles
Definition at line 359 of file ParticleBase.h.
Referenced by addAttribute(), create(), destroy(), internalDestroy(), and ParticleBase().
|
private |
next unique particle ID
Definition at line 368 of file ParticleBase.h.
Referenced by create(), and ParticleBase().
|
private |
number of MPI ranks
Definition at line 371 of file ParticleBase.h.
Referenced by create(), globalCreate(), and ParticleBase().
| particle_position_type ippl::ParticleBase< PLayout, IDProperties >::R |
view of particle positions
Definition at line 115 of file ParticleBase.h.
Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::buildCells(), ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::createPeriodicGhostParticles(), ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties... >::locateParticles(), ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::locateParticles(), ParticleBase(), ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange(), and ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::update().
|
private |
total number of particles (across all processes)
Definition at line 362 of file ParticleBase.h.
Referenced by create(), destroy(), and ParticleBase().