IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties > Class Template Reference

#include <ParticleSpatialLayout.h>

Inheritance diagram for ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >:
Collaboration diagram for ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >:

Public Types

using Base = detail::ParticleLayout<T, Dim, PositionProperties...>
using hash_type = detail::hash_type<position_memory_space>
using locate_type = typename detail::ViewType<int, 1, position_memory_space>::view_type
using bool_type = typename detail::ViewType<bool, 1, position_memory_space>::view_type
using vector_type = typename Base::vector_type
using RegionLayout_t
using FieldLayout_t = typename ippl::FieldLayout<Dim>
using size_type = detail::size_type
typedef T value_type
typedef std::int64_t index_type
using particle_position_type
using position_memory_space
using position_execution_space
typedef std::array< BC, 2 *Dimbc_container_type

Public Member Functions

 ParticleSpatialLayout (FieldLayout< Dim > &, Mesh &)
 ParticleSpatialLayout ()
 ~ParticleSpatialLayout ()=default
void updateLayout (FieldLayout< Dim > &, Mesh &)
template<class ParticleContainer>
void update (ParticleContainer &pc)
const RegionLayout_tgetRegionLayout () const
template<typename ParticleContainer>
std::pair< size_type, size_typelocateParticles (const ParticleContainer &pc, locate_type &ranks, bool_type &invalid, locate_type &nSends_dview, locate_type &sends_dview) const
void fillHash (int rank, const locate_type &ranks, hash_type &hash)
size_t numberOfSends (int rank, const locate_type &ranks)
template<size_t... Idx>
KOKKOS_INLINE_FUNCTION constexpr bool positionInRegion (const std::index_sequence< Idx... > &, const vector_type &pos, const region_type &region)
template<typename ParticleContainer>
std::pair< detail::size_type, detail::size_typelocateParticles (const ParticleContainer &pc, locate_type &ranks, bool_type &invalid, locate_type &nSends_dview, locate_type &sends_dview) const
 This function determines to which rank particles need to be sent after the iteration step. It starts by first scanning direct rank neighbors, and only does a global scan if there are still unfound particles. It then calculates how many particles need to be sent to each rank and how many ranks are sent to in total.
void update (PBase &)
void setParticleBC (bc_container_type bcs)
void setParticleBC (BC bc)
const bc_container_typegetParticleBC () const
void applyBC (const particle_position_type &R, const NDRegion< T, Dim > &nr)

Static Public Attributes

static constexpr unsigned dim

Protected Types

using region_view_type = typename RegionLayout_t::view_type
 Type of the Kokkos view containing the local regions.
using region_type = typename region_view_type::value_type
 Type of a single Region object.
using neighbor_list = typename FieldLayout_t::neighbor_list
 Array of N rank lists, where N = number of hypercubes for the dimension Dim.

Protected Member Functions

size_type getNeighborSize (const neighbor_list &neighbors) const

Static Protected Member Functions

template<size_t... Idx>
KOKKOS_INLINE_FUNCTION static constexpr bool positionInRegion (const std::index_sequence< Idx... > &, const vector_type &pos, const region_type &region)

Protected Attributes

RegionLayout_t rlayout_m
 The RegionLayout which determines where our particles go.
FieldLayout_tflayout_m
 The FieldLayout containing information on nearest neighbors.
std::vector< size_typenRecvs_m
mpi::rma::Window< mpi::rma::Activewindow_m

Private Attributes

bc_container_type bcs_m
 the list of boundary conditions for this set of particles

Detailed Description

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
class ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >

ParticleSpatialLayout class definition.

Template Parameters
Tvalue type
Dimdimension
Meshtype

Definition at line 46 of file ParticleSpatialLayout.h.

Member Typedef Documentation

◆ Base

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::Base = detail::ParticleLayout<T, Dim, PositionProperties...>

Definition at line 48 of file ParticleSpatialLayout.h.

◆ bc_container_type

typedef std::array<BC, 2 * Dim> ippl::detail::ParticleLayout< T, Dim, PositionProperties >::bc_container_type
inherited

Definition at line 54 of file ParticleLayout.h.

◆ bool_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::bool_type = typename detail::ViewType<bool, 1, position_memory_space>::view_type

Definition at line 53 of file ParticleSpatialLayout.h.

◆ FieldLayout_t

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::FieldLayout_t = typename ippl::FieldLayout<Dim>

Definition at line 58 of file ParticleSpatialLayout.h.

◆ hash_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::hash_type = detail::hash_type<position_memory_space>

Definition at line 51 of file ParticleSpatialLayout.h.

◆ index_type

typedef std::int64_t ippl::detail::ParticleLayout< T, Dim, PositionProperties >::index_type
inherited

Definition at line 47 of file ParticleLayout.h.

◆ locate_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::locate_type = typename detail::ViewType<int, 1, position_memory_space>::view_type

Definition at line 52 of file ParticleSpatialLayout.h.

◆ neighbor_list

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::neighbor_list = typename FieldLayout_t::neighbor_list
protected

Array of N rank lists, where N = number of hypercubes for the dimension Dim.

Definition at line 97 of file ParticleSpatialLayout.h.

◆ particle_position_type

using ippl::detail::ParticleLayout< T, Dim, PositionProperties >::particle_position_type
inherited

Definition at line 50 of file ParticleLayout.h.

◆ position_execution_space

using ippl::detail::ParticleLayout< T, Dim, PositionProperties >::position_execution_space
inherited

Definition at line 52 of file ParticleLayout.h.

◆ position_memory_space

using ippl::detail::ParticleLayout< T, Dim, PositionProperties >::position_memory_space
inherited

Definition at line 51 of file ParticleLayout.h.

◆ region_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::region_type = typename region_view_type::value_type
protected

Type of a single Region object.

Definition at line 95 of file ParticleSpatialLayout.h.

◆ region_view_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::region_view_type = typename RegionLayout_t::view_type
protected

Type of the Kokkos view containing the local regions.

Definition at line 93 of file ParticleSpatialLayout.h.

◆ RegionLayout_t

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::RegionLayout_t
Initial value:

Definition at line 56 of file ParticleSpatialLayout.h.

◆ size_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::size_type = detail::size_type

Definition at line 60 of file ParticleSpatialLayout.h.

◆ value_type

typedef T ippl::detail::ParticleLayout< T, Dim, PositionProperties >::value_type
inherited

Definition at line 46 of file ParticleLayout.h.

◆ vector_type

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
using ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::vector_type = typename Base::vector_type

Definition at line 55 of file ParticleSpatialLayout.h.

Constructor & Destructor Documentation

◆ ParticleSpatialLayout() [1/2]

template<typename T, unsigned Dim, class Mesh, typename... Properties>
ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::ParticleSpatialLayout ( FieldLayout< Dim > & fl,
Mesh & mesh )

Definition at line 61 of file ParticleSpatialLayout.hpp.

References rlayout_m.

Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::ParticleSpatialOverlapLayout().

Here is the caller graph for this function:

◆ ParticleSpatialLayout() [2/2]

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::ParticleSpatialLayout ( )
inline

Definition at line 66 of file ParticleSpatialLayout.h.

◆ ~ParticleSpatialLayout()

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::~ParticleSpatialLayout ( )
default

Member Function Documentation

◆ applyBC()

void ippl::detail::ParticleLayout< T, Dim, PositionProperties >::applyBC ( const particle_position_type & R,
const NDRegion< T, Dim > & nr )
inherited

Apply the given boundary conditions to the current particle positions.

Template Parameters
Ris the particle position attribute
nris the NDRegion
Parameters

Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::particleExchange(), and ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::update().

Here is the caller graph for this function:

◆ fillHash()

template<typename T, unsigned Dim, class Mesh, typename... Properties>
void ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::fillHash ( int rank,
const locate_type & ranks,
hash_type & hash )
Parameters
rankwe sent to
ranksa container specifying where a particle at the i-th index should go.
hasha mapping to fill the send buffer contiguously

Definition at line 437 of file ParticleSpatialLayout.hpp.

◆ getNeighborSize()

template<typename T, unsigned Dim, class Mesh, typename... Properties>
detail::size_type ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::getNeighborSize ( const neighbor_list & neighbors) const
protected

Evaluates the total number of MPI ranks sharing the spatial nearest neighbors.

Parameters
neighborsstructure containing, for every spatial direction, a list of MPI ranks IDs corresponding to the nearest neighbors of the current local domain section.
Returns
The total number of the ranks.

Definition at line 245 of file ParticleSpatialLayout.hpp.

◆ getParticleBC()

const bc_container_type & ippl::detail::ParticleLayout< T, Dim, PositionProperties >::getParticleBC ( ) const
inlineinherited

Copy over the given boundary conditions.

Parameters
bcsare the boundary conditions

Definition at line 79 of file ParticleLayout.h.

References bcs_m.

Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::createPeriodicGhostParticles().

Here is the caller graph for this function:

◆ getRegionLayout()

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
const RegionLayout_t & ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::getRegionLayout ( ) const
inline

Definition at line 76 of file ParticleSpatialLayout.h.

◆ locateParticles() [1/2]

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
template<typename ParticleContainer>
std::pair< size_type, size_type > ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::locateParticles ( const ParticleContainer & pc,
locate_type & ranks,
bool_type & invalid,
locate_type & nSends_dview,
locate_type & sends_dview ) const

For each particle in the bunch, determine the rank on which it should be stored based on its location

Template Parameters
ParticleContainerthe particle container type
Parameters
pcthe particle container
ranksthe integer view in which to store the destination ranks
invalidthe boolean view in which to store whether each particle is invalidated, i.e. needs to be sent to another rank
Returns
The total number of invalidated particles

◆ locateParticles() [2/2]

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
template<typename ParticleContainer>
std::pair< detail::size_type, detail::size_type > ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::locateParticles ( const ParticleContainer & pc,
locate_type & ranks,
bool_type & invalid,
locate_type & nSends_dview,
locate_type & sends_dview ) const

This function determines to which rank particles need to be sent after the iteration step. It starts by first scanning direct rank neighbors, and only does a global scan if there are still unfound particles. It then calculates how many particles need to be sent to each rank and how many ranks are sent to in total.

Parameters
pcParticle Container
ranksA vector the length of the number of particles on the current rank, where each value refers to the new rank of the particle
invalidA vector marking the particles that need to be sent away, and thus locally deleted
nSends_dviewDevice view the length of number of ranks, where each value determines the number of particles sent to that rank from the current rank
sends_dviewDevice view for the number of ranks that are sent to from current rank
Returns
tuple with the number of particles sent away and the number of ranks sent to

outsideIds: Container of particle IDs that travelled outside of the neighborhood.

outsideCount: Tracks the number of particles that travelled outside of the neighborhood.

invalidCount: Tracks the number of particles that need to be sent to other ranks.

neighborSize: Size of a neighborhood in D dimentions.

neighbors_view: Kokkos view with the IDs of the neighboring MPI ranks.

Begin Kokkos loop: Step 1: search in current rank Step 2: search in neighbors Step 3: save information on whether the particle was located Step 4: run additional loop on non-located particles

Step 2

Step 3

Step 4

pID: (local) ID of the particle that is currently being searched.

inRegion: Checks whether particle pID is inside region j.

Definition at line 275 of file ParticleSpatialLayout.hpp.

◆ numberOfSends()

template<typename T, unsigned Dim, class Mesh, typename... Properties>
size_t ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::numberOfSends ( int rank,
const locate_type & ranks )
Parameters
rankwe sent to
ranksa container specifying where a particle at the i-th index should go.

Definition at line 461 of file ParticleSpatialLayout.hpp.

◆ positionInRegion() [1/2]

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
template<size_t... Idx>
KOKKOS_INLINE_FUNCTION static constexpr bool ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::positionInRegion ( const std::index_sequence< Idx... > & ,
const vector_type & pos,
const region_type & region )
staticconstexprprotected

◆ positionInRegion() [2/2]

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
template<size_t... Idx>
KOKKOS_INLINE_FUNCTION constexpr bool ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::positionInRegion ( const std::index_sequence< Idx... > & ,
const vector_type & pos,
const region_type & region )
constexpr

Definition at line 236 of file ParticleSpatialLayout.hpp.

◆ setParticleBC() [1/2]

void ippl::detail::ParticleLayout< T, Dim, PositionProperties >::setParticleBC ( BC bc)
inlineinherited

Use the same boundary condition on each face

Parameters
bcsare the boundary conditions

Definition at line 85 of file ParticleLayout.h.

References bcs_m.

◆ setParticleBC() [2/2]

void ippl::detail::ParticleLayout< T, Dim, PositionProperties >::setParticleBC ( bc_container_type bcs)
inlineinherited

Copy over the given boundary conditions.

Parameters
bcsare the boundary conditions

Definition at line 73 of file ParticleLayout.h.

References bcs_m.

◆ update() [1/2]

void ippl::detail::ParticleLayout< T, Dim, PositionProperties >::update ( PBase & )
inlineinherited

Definition at line 64 of file ParticleLayout.h.

◆ update() [2/2]

template<typename T, unsigned Dim, class Mesh, typename... Properties>
template<class ParticleContainer>
void ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::update ( ParticleContainer & pc)

Definition at line 81 of file ParticleSpatialLayout.hpp.

References ippl::detail::ParticleLayout< T, Dim, PositionProperties... >::applyBC(), ippl::Comm, IpplTimings::getTimer(), ippl::ParticleBase< PLayout, IDProperties >::R, rlayout_m, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ updateLayout()

template<typename T, unsigned Dim, class Mesh, typename... Properties>
void ippl::ParticleSpatialLayout< T, Dim, Mesh, Properties >::updateLayout ( FieldLayout< Dim > & fl,
Mesh & mesh )

Definition at line 73 of file ParticleSpatialLayout.hpp.

Member Data Documentation

◆ bcs_m

bc_container_type ippl::detail::ParticleLayout< T, Dim, PositionProperties >::bcs_m
privateinherited

the list of boundary conditions for this set of particles

Definition at line 97 of file ParticleLayout.h.

Referenced by getParticleBC(), ParticleLayout(), setParticleBC(), and setParticleBC().

◆ dim

unsigned ippl::detail::ParticleLayout< T, Dim, PositionProperties >::dim
staticconstexprinherited

Definition at line 56 of file ParticleLayout.h.

◆ flayout_m

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
FieldLayout_t& ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::flayout_m
protected

The FieldLayout containing information on nearest neighbors.

Definition at line 83 of file ParticleSpatialLayout.h.

Referenced by ippl::ParticleSpatialOverlapLayout< T, Dim, Mesh, PositionProperties >::locateParticles().

◆ nRecvs_m

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
std::vector<size_type> ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::nRecvs_m
protected

◆ rlayout_m

◆ window_m

template<typename T, unsigned Dim, class Mesh = UniformCartesian<T, Dim>, typename... PositionProperties>
mpi::rma::Window<mpi::rma::Active> ippl::ParticleSpatialLayout< T, Dim, Mesh, PositionProperties >::window_m
protected

The documentation for this class was generated from the following files: