|
IPPL API Reference
Independent Parallel Particle Layer C++ API
|
#include <ParticleBase.h>
Inheritance diagram for ippl::ParticleBase< PLayout, IDProperties >:
Collaboration diagram for ippl::ParticleBase< PLayout, IDProperties >: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 = typename detail::ContainerForAllSpaces< container_type >::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) | |
| 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, bool non_destructive=false) |
| void | alloc (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) |
| 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) |
| ippl::ParticleBase< PLayout, IP >::ParticleBase | ( | ) |
If this constructor is used, the user must call 'initialize' with a layout object in order to use this.
| 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. |
| void ippl::ParticleBase< PLayout, IP >::addAttribute | ( | detail::ParticleAttribBase< MemorySpace > & | pa | ) |
Add particle attribute
| pa | attribute to be added to ParticleBase |
| void ippl::ParticleBase< PLayout, IP >::alloc | ( | size_type | nLocal | ) |
Pre-allocate capacity for nLocal particles on every attribute, without touching the logical particle count or assigning IDs. Caller is responsible for filling the entries. Overallocation is additionally applied.
| nLocal | capacity (in particles) to allocate per attribute. |
| void ippl::ParticleBase< PLayout, IP >::create | ( | size_type | nLocal, |
| bool | non_destructive = false |
||
| ) |
Create nLocal rank local particles. This is a collective call, i.e. all MPI ranks must call this.
| nLocal | number of local particles to be created (delta, not total). |
| non_destructive | if true, preserve existing particle data when the underlying views must grow (uses Kokkos::resize). Default false keeps the destructive-on-grow behavior. |
| 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 |
| void ippl::ParticleBase< PLayout, IP >::deserialize | ( | Archive & | ar, |
| size_type | nrecvs | ||
| ) |
Deserialize to do MPI calls.
| ar | archive |
| nrecvs | number of particles to deserialize |
| 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 |
|
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> |
|
inline |
Get particle attribute
| i | attribute number in container |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| 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 |
| 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.
|
protected |
Fill attributes of buffer.
| hash | function to access index. |
| 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 |
| 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 |
| nRecvs | the number of particles to receive |
| 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 |
| 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 |
| void ippl::ParticleBase< PLayout, IP >::serialize | ( | Archive & | ar, |
| size_type | nsends | ||
| ) |
Serialize to do MPI calls.
| ar | archive |
| nsends | number of particles to serialize |
|
inline |
Set all boundary conditions to this BC
| bc | the boundary conditions |
|
inline |
Set all boundary conditions
| bcs | the boundary conditions |
|
protected |
Fill my attributes.
| nrecvs | number of particles to unpack |