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

Class that stores marshalled data for ghost communications. More...

#include <particle_packing.hpp>

Public Member Functions

char * data ()
 Returns a pointer to the non-bond storage.
 
const char * data () const
 
std::size_t size () const
 Returns the number of elements in the non-bond storage.
 
void resize (std::size_t new_size)
 Resizes the underlying storage s.t.
 
auto & bonds ()
 Returns a reference to the bond storage.
 
const auto & bonds () const
 
auto make_span ()
 

Detailed Description

Class that stores marshalled data for ghost communications.

To store and retrieve data, use the adapter classes below.

Invariant: every byte in the non-bond buffer is written by the caller (pack_cells / MPI irecv) before it is read (unpack_cells / add_forces). The buffer therefore uses a default-init allocator so that resize()-on-grow does not zero-fill bytes that will be immediately overwritten, eliminating the __memset_avx2 overhead visible in perf profiles at large particle counts. The bond buffer is kept as a plain std::vector<char> because it is serialized via boost.mpi (which requires exact byte semantics) and is on the cold resort-only path.

Definition at line 91 of file particle_packing.hpp.

Member Function Documentation

◆ bonds() [1/2]

auto & GhostComm::CommBuf::bonds ( )
inline

Returns a reference to the bond storage.

Definition at line 110 of file particle_packing.hpp.

Referenced by GhostComm::pack_cells(), GhostComm::anonymous_namespace{HaloExchange.cpp}::run_collective(), and GhostComm::unpack_cells().

◆ bonds() [2/2]

const auto & GhostComm::CommBuf::bonds ( ) const
inline

Definition at line 111 of file particle_packing.hpp.

◆ data() [1/2]

char * GhostComm::CommBuf::data ( )
inline

Returns a pointer to the non-bond storage.

Definition at line 96 of file particle_packing.hpp.

◆ data() [2/2]

const char * GhostComm::CommBuf::data ( ) const
inline

Definition at line 97 of file particle_packing.hpp.

◆ make_span()

◆ resize()

void GhostComm::CommBuf::resize ( std::size_t  new_size)
inline

Resizes the underlying storage s.t.

the object is capable of holding new_size chars. Bytes added by growth are left uninitialized; the caller must write them (pack_cells / MPI irecv) before reading.

Definition at line 107 of file particle_packing.hpp.

Referenced by GhostComm::local_cell_copy(), GhostComm::pack_cells(), and GhostComm::anonymous_namespace{HaloExchange.cpp}::run_collective().

◆ size()

std::size_t GhostComm::CommBuf::size ( ) const
inline

Returns the number of elements in the non-bond storage.

Definition at line 100 of file particle_packing.hpp.

Referenced by GhostComm::pack_cells(), GhostComm::anonymous_namespace{HaloExchange.cpp}::run_collective(), and GhostComm::unpack_cells().


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