core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::halo::ParticleHaloTopology< Dim > Class Template Reference

#include <particle_halo_topology.hpp>

Classes

struct  FlatTopo
 

Public Member Functions

void init (const ParticleMigrator< Dim > &mig)
 Bind to a migrator (provides the decomposition, domain map, rank and comm).
 
void build (const std::vector< Vec< Dim > > &pos, double rcut, bool includePeriodicSelf=false)
 (Re)establish the owner<->ghost correspondence: every owned particle within rcut of another rank's block becomes a ghost there.
 
std::size_t numOwned () const
 
std::size_t numGhost () const
 
const std::vector< Vec< Dim > > & ghostPositions () const
 
void forwardPositions (const Vec< Dim > *owned, Vec< Dim > *ghost)
 owned[N] -> ghost[G], with the periodic image shift added (use for positions).
 
template<typename T >
void forward (const T *owned, T *ghost)
 owned[N] -> ghost[G], verbatim (translation-invariant fields: velocity, id, radius, ...).
 
template<typename T >
void reverse (const T *ghost, T *owned)
 ghost[G] -> owned[N], accumulated (T must have operator+=).
 
MPI_Comm comm () const
 
FlatTopo flatten () const
 

Detailed Description

template<int Dim>
class peclet::core::halo::ParticleHaloTopology< Dim >

Definition at line 36 of file particle_halo_topology.hpp.

Member Function Documentation

◆ init()

template<int Dim>
void peclet::core::halo::ParticleHaloTopology< Dim >::init ( const ParticleMigrator< Dim > &  mig)
inline

Bind to a migrator (provides the decomposition, domain map, rank and comm).

Definition at line 39 of file particle_halo_topology.hpp.

◆ build()

template<int Dim>
void peclet::core::halo::ParticleHaloTopology< Dim >::build ( const std::vector< Vec< Dim > > &  pos,
double  rcut,
bool  includePeriodicSelf = false 
)
inline

(Re)establish the owner<->ghost correspondence: every owned particle within rcut of another rank's block becomes a ghost there.

Call after migration / on neighbour-list rebuild.

includePeriodicSelf additionally emits LOCAL periodic self-ghosts: copies of an owned particle at its own periodic image(s) that fall within rcut of THIS rank's own block. They are needed when a rank borders itself across a periodic face — i.e. an undecomposed periodic axis (a "×1" ORB axis, e.g. the z of a 2×2×1 layout) or np=1 — where the periodic neighbour is owned by the same rank and so is never produced by the cross-rank exchange. Off by default => byte-identical to the cross-rank-only behaviour (no self-ghosts, no MPI self-messages). Self-ghosts occupy the ghost slots AFTER the received ones ([numReceived, numGhost)) and are filled locally (no MPI).

Definition at line 52 of file particle_halo_topology.hpp.

References peclet::core::halo::ParticleHaloTopology< Dim >::forwardPositions(), and MPI_Comm_size().

◆ numOwned()

template<int Dim>
std::size_t peclet::core::halo::ParticleHaloTopology< Dim >::numOwned ( ) const
inline

Definition at line 142 of file particle_halo_topology.hpp.

◆ numGhost()

template<int Dim>
std::size_t peclet::core::halo::ParticleHaloTopology< Dim >::numGhost ( ) const
inline

◆ ghostPositions()

template<int Dim>
const std::vector< Vec< Dim > > & peclet::core::halo::ParticleHaloTopology< Dim >::ghostPositions ( ) const
inline

Definition at line 144 of file particle_halo_topology.hpp.

◆ forwardPositions()

template<int Dim>
void peclet::core::halo::ParticleHaloTopology< Dim >::forwardPositions ( const Vec< Dim > *  owned,
Vec< Dim > *  ghost 
)
inline

owned[N] -> ghost[G], with the periodic image shift added (use for positions).

Direct point-to-point over the topology fixed by build() (no NBX consensus) – this is the per-iteration hot path, so it must not pay the dynamic-discovery cost every call.

Definition at line 149 of file particle_halo_topology.hpp.

Referenced by peclet::core::halo::ParticleHaloTopology< Dim >::build().

◆ forward()

template<int Dim>
template<typename T >
void peclet::core::halo::ParticleHaloTopology< Dim >::forward ( const T owned,
T ghost 
)
inline

owned[N] -> ghost[G], verbatim (translation-invariant fields: velocity, id, radius, ...).

Definition at line 164 of file particle_halo_topology.hpp.

◆ reverse()

template<int Dim>
template<typename T >
void peclet::core::halo::ParticleHaloTopology< Dim >::reverse ( const T ghost,
T owned 
)
inline

ghost[G] -> owned[N], accumulated (T must have operator+=).

Use for forces/torques/fluxes: each ghost's partial contribution is summed onto its owner. Owner array is added to in place.

Definition at line 178 of file particle_halo_topology.hpp.

References MPI_BYTE, MPI_Irecv(), MPI_Isend(), MPI_REQUEST_NULL, MPI_STATUSES_IGNORE, and MPI_Waitall().

◆ comm()

template<int Dim>
MPI_Comm peclet::core::halo::ParticleHaloTopology< Dim >::comm ( ) const
inline

◆ flatten()


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