Particle Pair Loop#
This section contains documentation for particle pair looping. Particle pair looping is a looping type similar to particle loop except that the kernel operates on two particles.
Construct |
Access Modes |
|---|---|
CellDatConst |
Read, Write, Add, Min, Max |
DescendantProducts |
Write |
LocalArray |
Read, Write, Add |
MaskArray |
Read, Write |
NDLocalArray |
Read, Write, Add, Max, Min |
ParticleMask |
Read, Write |
SymVector |
Read, Write |
ParticlePairLoopIndex |
Read |
KernelRNG |
Read |
TupleRNG |
Read |
Pair Lists Absolute#
These types define iteration sets for Particle Pair Loops. The type of the iteration set determines which pair loop is executed. Typically these absolute pair lists are constructed from pair lists that inherit a base class that corresponds to the pair list type.
-
template<typename GROUP_TYPE, typename PAIR_LIST_TYPE>
struct CellwisePairListAbsolute# Type for defining the A and B sets along with the pair list.
-
template<>
struct CellwisePairListAbsolute# - #include <cellwise_pair_list_absolute.hpp>
Type for defining the A and B sets along with the pair list where both A and B are ParticleGroups.
Public Functions
- ParticleGroupSharedPtr A,
- ParticleGroupSharedPtr B,
- CellwisePairListBlockInterfaceSharedPtr pair_list
Create cell wise pair list where the pair indices correspond to particle layers in two ParticleGroups A and B. A may equal B.
- Parameters:
A – First ParticleGroup which suppies the “i” particles.
B – Second ParticleGroup which suppies the “j” particles.
pair_list – Pair list of particle pairs.
Host Pair List#
The host pair list is a simple pair list construct where pairs are specified only on the host.
-
class CellwisePairListHost#
- #include <cellwise_pair_list_host.hpp>
Type to hold a list of pairs of particles that should collide in each cell.
Public Functions
-
CellwisePairListHost(const CellwisePairListHost &st) = delete#
Disable (implicit) copies.
- CellwisePairListHost &operator=(
- CellwisePairListHost const &a
Disable (implicit) copies.
-
CellwisePairListHost(const int num_mesh_cells)#
- Parameters:
num_mesh_cells – Number of cells to hold pairs for.
-
void push_back(const int cell, const int i, const int j)#
Adds a pair of particles to the pair list for a given cell.
-
int get_next_wave(const int cell, const int layer)#
- Parameters:
cell – Cell of particles.
layer – Layer of particle.
- Returns:
Minimum wave index that a pair involving the given particle could execute on.
-
void set_next_wave(const int cell, const int layer, const int wave)#
- Parameters:
cell – Cell of particles.
layer – Layer of particle.
wave – Next wave that can include the particle.
-
void clear()#
Clears all held state.
-
CellwisePairListHostMap &get()#
- Returns:
The host representation of the pair list.
Public Members
-
int num_mesh_cells = {0}#
Number of cells to hold pairs for.
-
CellwisePairListHost(const CellwisePairListHost &st) = delete#
Simple Pair List#
This simple pair list is a pair list construct where pairs are specified on the host.
-
class CellwisePairListSimple : public NESO::Particles::CellwisePairList#
- #include <cellwise_pair_list_simple.hpp>
Type to hold a list of pairs of particles that should collide in each cell.
Public Functions
-
CellwisePairListSimple(const CellwisePairListSimple &st) = delete#
Disable (implicit) copies.
- CellwisePairListSimple &operator=(
- CellwisePairListSimple const &a
Disable (implicit) copies.
- SYCLTargetSharedPtr sycl_target,
- const int num_mesh_cells
- Parameters:
sycl_target – Compute device for pairs.
num_mesh_cells – Number of cells to hold pairs for.
- void push_back(
- const std::vector<int> &c,
- const std::vector<int> &i,
- const std::vector<int> &j
Host callable utility method to push pairs (i,j) onto the cell list for cells c.
- Parameters:
c – Cells to push pair (i,j) onto the cell list for.
i – First particles of the pair.
j – Second particles of the pair.
Set the cell list from a host description of waves of pairs.
- Parameters:
pair_list – Host description of pairs.
-
void clear()#
Empty the pair list.
-
virtual CellwisePairListDevice get_pair_list() override#
Get a description of the pair list accessible on the device.
- Returns:
PairListDevice describing all the particle pairs. The returned object must have a lifetime equal or shorter than this host instance.
-
virtual CellwisePairListHostMap get_host_pair_list() override#
Get a description of the pair list accessible on the host.
- Returns:
Container of pairs for each cell.
-
virtual INT get_num_pairs() override#
- Returns:
The number of pairs in the pair list.
-
CellwisePairListSimple(const CellwisePairListSimple &st) = delete#
Particle Pair Loop Functions#
Functions that create Particle Pair Loops. These functions accept an absolute pair list as the iteration set specification.
- std::string name,
- std::vector<CellwisePairListAbsolute<ParticleGroup, CellwisePairList>> pair_lists,
- KERNEL kernel,
- ARGS... args
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList. This helper function is for backwards compatibility, the pair_lists vector must be size 1.
- Parameters:
name – Name for ParticlePairLoop.
pair_lists – Vector of CellwisePairListAbsolute pair lists.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
- std::vector<CellwisePairListAbsolute<ParticleGroup, CellwisePairList>> pair_lists,
- KERNEL kernel,
- ARGS... args
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList. This helper function is for backwards compatibility, the pair_lists vector must be size 1.
- Parameters:
pair_lists – Vector of CellwisePairListAbsolute pair lists.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
- std::string name,
- CellwisePairListAbsolute<ParticleGroup, CellwisePairList> pair_list,
- KERNEL kernel,
- ARGS... args
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList.
- Parameters:
name – Name for ParticlePairLoop.
pair_list – CellwisePairListAbsolute based pair list.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
-
)#
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList.
- Parameters:
pair_list – CellwisePairListAbsolute based pair list.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
- std::string name,
- std::vector<CellwisePairListAbsolute<ParticleGroup, CellwisePairListBlockInterface>> pair_lists,
- KERNEL kernel,
- ARGS... args
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList.
- Parameters:
name – Name for ParticlePairLoop.
pair_lists – Vector of CellwisePairListAbsolute pair lists.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
- std::vector<CellwisePairListAbsolute<ParticleGroup, CellwisePairListBlockInterface>> pair_lists,
- KERNEL kernel,
- ARGS... args
Create a ParticlePairLoop from cellwise pair lists. This is a helper function to create instances of ParticlePairLoopCellwisePairList.
- Parameters:
pair_lists – Vector of CellwisePairListAbsolute pair lists.
kernel – Kernel for pair loop.
args – Arguments for pair loop.
- Returns:
ParticlePairLoop for iteration set and arguments.
PairMask#
Construct for masking off pairs of particles, i.e. storing a boolean per particle pair.
-
struct Write#
- #include <pair_mask.hpp>
Kernel type for PairMask in write mode.
Helper Functions#
Helper functions for working with pair looping.
- CellwisePairListAbsolute<ParticleGroup, CellwisePairList> pair_list,
- ParticleMaskSharedPtr particle_mask
Set ParticleMask entries to false for particles which are referenced by a pair list. Particles which are not reference do not have their masks modified.
- Parameters:
pair_list – CellwisePairList containing pairs.
particle_mask – ParticleMask containing masks to set for first ParticleGroup.
Base Type#
Base type from which all Particle Pair Loops inherit.
-
class ParticlePairLoopBase#
- #include <particle_pair_loop_base.hpp>
Base type which all particle pair loops inherit from.
Subclassed by NESO::Particles::ParticlePairLoopArgs< ARGS… >, NESO::Particles::ParticlePairLoopArgs< ARGS >
Public Functions
- inline virtual void execute(
- const std::optional<int> cell_start = std::nullopt,
- const std::optional<int> cell_end = std::nullopt
Execute the ParticlePairLoop and block until execution is complete. Must be called collectively on the MPI communicator associated with the SYCLTarget this loop is over.
execute() Launches the ParticlePairLoop over all cells. execute(i) Launches the ParticlePairLoop over cell i. execute(i, i+4) Launches the ParticlePairLoop over cells i, i+1, i+2, i+3. Note cell_end itself is not visited.
- Parameters:
cell_start – Optional starting cell to launch the ParticlePairLoop over.
cell_end – Optional ending cell to launch the ParticlePairLoop over.
- inline virtual void submit(
- const std::optional<int> cell_start = std::nullopt,
- const std::optional<int> cell_end = std::nullopt
Launch the ParticlePairLoop and return. Must be called collectively over the MPI communicator of the ParticleGroup. Loop execution is complete when the corresponding call to wait returns.
submit() Launches the ParticlePairLoop over all cells. submit(i) Launches the ParticlePairLoop over cell i. submit(i, i+4) Launches the ParticlePairLoop over cells i, i+1, i+2, i+3. Note cell_end itself is not visited.
- Parameters:
cell_start – Optional starting cell to launch the ParticlePairLoop over.
cell_end – Optional ending cell to launch the ParticlePairLoop over.
-
inline virtual void wait() = 0#
Wait for loop execution to complete. On completion perform post-loop actions. Must be called collectively on communicator.
ParticlePairLoopIndex#
Particle Pair Loop construct for identifying the indices of particles in pairs.
-
struct ParticlePairLoopIndex#
- #include <particle_pair_loop_index.hpp>
Pass to pair loops with an access descriptor for the corresponding particle:
Access::A(Access::read(ParticlePairLoopIndex{})), Access::B(Access::read(ParticlePairLoopIndex{})), ...
-
struct Read#
- #include <particle_pair_loop_index.hpp>
Kernel type for read-only access to a ParticlePairLoopIndex. When the access descriptor is for particle A then the kernel argument will describe particle A. When the access descriptor is for particle B then the kernel argument will describe particle B.