|
core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
|
#include <particle_migrator.hpp>
Public Member Functions | |
| void | init (const decomp::BlockDecomposer< Dim > &dec, int rank, DomainMap< Dim > map, MPI_Comm comm=MPI_COMM_WORLD) |
| IVec< Dim > | cellOf (const Vec< Dim > &x) const |
| Global decomposition cell containing position x (after periodic wrap / boundary clamp). | |
| int | ownerOf (const Vec< Dim > &x) const |
| Rank that owns the block containing position x (after periodic wrap / boundary clamp). | |
| Vec< Dim > | wrapPosition (Vec< Dim > x) const |
| Wrap a position into the periodic box (no-op on non-periodic axes). | |
| std::size_t | migrate (std::vector< Vec< Dim > > &pos, std::vector< char > &payload, std::size_t stride) |
| Reassign every particle to its owning rank. | |
| std::size_t | lastSent () const |
| std::size_t | lastReceived () const |
| int | rank () const |
| MPI_Comm | comm () const |
| const decomp::BlockDecomposer< Dim > & | decomposer () const |
| bool | withinRcutOfBlock (const Vec< Dim > &x, int r, double rcut, Vec< Dim > &img) const |
True if x (via its closest periodic image) comes within rcut of block r's physical AABB. | |
| void | imagesWithinRcutOfBlock (const Vec< Dim > &x, int r, double rcut, bool allowIdentity, std::vector< Vec< Dim > > &outShifts) const |
Append the shift (= image − x) of EVERY periodic image of x that comes within rcut of block r's AABB (enumerating the up-to-3^Dim images: 0 and ±L per periodic axis). | |
| std::size_t | gatherGhosts (const std::vector< Vec< Dim > > &pos, const std::vector< char > &payload, std::size_t stride, double rcut, std::vector< Vec< Dim > > &ghostPos, std::vector< char > &ghostPayload) |
Gather ghost copies of particles within rcut of this rank's block boundary. | |
Definition at line 40 of file particle_migrator.hpp.
|
inline |
Definition at line 42 of file particle_migrator.hpp.
References peclet::core::halo::ParticleMigrator< Dim >::comm(), and peclet::core::halo::ParticleMigrator< Dim >::rank().
|
inline |
Global decomposition cell containing position x (after periodic wrap / boundary clamp).
This is the binning index for weighted load-balancing — ownerOf(x) == decomposer().ownerOf(cellOf(x)).
Definition at line 53 of file particle_migrator.hpp.
References peclet::core::wrap().
Referenced by peclet::core::halo::ParticleMigrator< Dim >::ownerOf().
|
inline |
Rank that owns the block containing position x (after periodic wrap / boundary clamp).
Definition at line 70 of file particle_migrator.hpp.
References peclet::core::halo::ParticleMigrator< Dim >::cellOf().
Referenced by peclet::core::halo::ParticleMigrator< Dim >::migrate().
|
inline |
Wrap a position into the periodic box (no-op on non-periodic axes).
Definition at line 73 of file particle_migrator.hpp.
Referenced by peclet::core::halo::ParticleMigrator< Dim >::migrate().
|
inline |
Reassign every particle to its owning rank.
pos and payload (stride bytes per particle) are rewritten in place to hold exactly this rank's particles after migration. Returns the new local count. Last-migrated stats are available via lastSent()/lastReceived().
Definition at line 89 of file particle_migrator.hpp.
References peclet::core::halo::ParticleMigrator< Dim >::ownerOf(), and peclet::core::halo::ParticleMigrator< Dim >::wrapPosition().
|
inline |
Definition at line 154 of file particle_migrator.hpp.
|
inline |
Definition at line 155 of file particle_migrator.hpp.
|
inline |
Definition at line 157 of file particle_migrator.hpp.
Referenced by peclet::core::halo::ParticleMigrator< Dim >::init().
|
inline |
Definition at line 158 of file particle_migrator.hpp.
Referenced by peclet::core::halo::ParticleMigrator< Dim >::init().
|
inline |
Definition at line 159 of file particle_migrator.hpp.
|
inline |
True if x (via its closest periodic image) comes within rcut of block r's physical AABB.
On success img is that closest image — the position to ship so rank r has correct coords.
Definition at line 163 of file particle_migrator.hpp.
Referenced by peclet::core::halo::ParticleMigrator< Dim >::gatherGhosts().
|
inline |
Append the shift (= image − x) of EVERY periodic image of x that comes within rcut of block r's AABB (enumerating the up-to-3^Dim images: 0 and ±L per periodic axis).
Unlike withinRcutOfBlock (which keeps only the single nearest image), this yields all qualifying images — the owner-based view a ghost layer needs when one rank borders ITSELF across a periodic face (an undecomposed periodic axis, or np=1). allowIdentity=false drops the un-shifted image, so r==self yields only the periodic self-wrap copies (a particle is never its own ghost).
Definition at line 202 of file particle_migrator.hpp.
|
inline |
Gather ghost copies of particles within rcut of this rank's block boundary.
For each particle this rank owns, a copy (the periodic image closest to the target block) is sent to every OTHER rank whose block comes within rcut. Received ghosts are written to ghostPos/ghostPayload (cleared first). Returns the number of ghosts received. This is the Lagrangian halo: after it, each rank's neighbour search runs locally over its owned + ghost particles.
Definition at line 251 of file particle_migrator.hpp.
References MPI_Comm_size(), and peclet::core::halo::ParticleMigrator< Dim >::withinRcutOfBlock().