ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
GhostComm::ExchangeBuffers Struct Reference

Persistent per-neighbor buffer pool for halo exchanges. More...

#include <HaloExchange.hpp>

+ Collaboration diagram for GhostComm::ExchangeBuffers:

Public Attributes

std::vector< CommBufsend
 Per-neighbor packed send buffers (index-aligned with plan->neighbors).
 
std::vector< CommBufrecv
 Per-neighbor recv buffers (index-aligned with plan->neighbors).
 
std::vector< boost::mpi::request > requests
 Outstanding non-blocking send/recv requests (cleared before each use).
 
std::vector< std::vector< ParticleList * > > send_cells
 Scratch cell-pointer arrays for the packing routines.
 
std::vector< std::vector< ParticleList * > > recv_cells
 
std::vector< std::size_t > slot_to_neighbor
 Scratch index map for the Overwrite (wait_any) path in halo_exchange_finish: maps active request slot -> original neighbor index.
 

Detailed Description

Persistent per-neighbor buffer pool for halo exchanges.

Owns the heap-allocated send/recv buffers, MPI-request slots, and cell-pointer scratch arrays for one set of neighbor communications. Holding this object across multiple calls to halo_exchange allows the underlying std::vector storage to be reused via resize — after the first exchange (warm-up) the vectors retain capacity and subsequent calls incur no heap allocations on the hot path.

Typical ownership: held as a member of the object that drives ghost communication (e.g. CellStructure::m_ghost_buffers) and passed to halo_exchange / halo_exchange_start as a mutable ref.

Thread-safety: a single instance must not be used from concurrent threads. The sequential ghost-exchange loop (each exchange completes via halo_exchange_finish before the next starts) is therefore safe.

Definition at line 69 of file HaloExchange.hpp.

Member Data Documentation

◆ recv

std::vector<CommBuf> GhostComm::ExchangeBuffers::recv

Per-neighbor recv buffers (index-aligned with plan->neighbors).

Definition at line 73 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().

◆ recv_cells

std::vector<std::vector<ParticleList *> > GhostComm::ExchangeBuffers::recv_cells

Definition at line 82 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().

◆ requests

std::vector<boost::mpi::request> GhostComm::ExchangeBuffers::requests

Outstanding non-blocking send/recv requests (cleared before each use).

Definition at line 75 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().

◆ send

std::vector<CommBuf> GhostComm::ExchangeBuffers::send

Per-neighbor packed send buffers (index-aligned with plan->neighbors).

Definition at line 71 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().

◆ send_cells

std::vector<std::vector<ParticleList *> > GhostComm::ExchangeBuffers::send_cells

Scratch cell-pointer arrays for the packing routines.

For the Reduce direction send/recv roles swap; we need the plain ParticleList* from the SendRegion list. These must outlive the pack/unpack calls.

Definition at line 81 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().

◆ slot_to_neighbor

std::vector<std::size_t> GhostComm::ExchangeBuffers::slot_to_neighbor

Scratch index map for the Overwrite (wait_any) path in halo_exchange_finish: maps active request slot -> original neighbor index.

Sized to the current neighbor count in halo_exchange_start alongside the other per-neighbor vectors; capacity is retained across calls so that no heap allocation occurs on the hot position-push path after the first (warm-up) exchange.

Definition at line 91 of file HaloExchange.hpp.

Referenced by GhostComm::halo_exchange_start().


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