ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ghosts.cpp File Reference

Ghost particles and particle exchange. More...

#include "ghosts.hpp"
#include "BoxGeometry.hpp"
#include "Particle.hpp"
#include "system/System.hpp"
#include <utils/serialization/memcpy_archive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/range/numeric.hpp>
#include <boost/serialization/vector.hpp>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <functional>
#include <iterator>
#include <span>
#include <vector>
+ Include dependency graph for ghosts.cpp:

Go to the source code of this file.

Classes

class  CommBuf
 Class that stores marshalled data for ghost communications. More...
 
class  SerializationSizeCalculator
 Pseudo-archive to calculate the size of the serialization buffer. More...
 

Macros

#define REQ_GHOST_SEND   100
 Tag for ghosts communications.
 

Enumerations

enum class  ReductionPolicy { MOVE , UPDATE }
 Type of reduction to carry out during serialization. More...
 
enum class  SerializationDirection { SAVE , LOAD }
 Whether to save the state to or load the state from the archive. More...
 

Functions

template<class Archive >
static void serialize_and_reduce (Archive &ar, Particle &p, unsigned int data_parts, ReductionPolicy policy, SerializationDirection direction, BoxGeometry const &box_geo, Utils::Vector3d const *ghost_shift)
 Serialize particle data, possibly with reduction.
 
static auto calc_transmit_size (BoxGeometry const &box_geo, unsigned data_parts)
 
static auto calc_transmit_size (GhostCommunication const &ghost_comm, BoxGeometry const &box_geo, unsigned int data_parts)
 
static void prepare_send_buffer (CommBuf &send_buffer, GhostCommunication const &ghost_comm, BoxGeometry const &box_geo, unsigned int data_parts)
 
static void prepare_ghost_cell (ParticleList *cell, std::size_t size)
 
static void prepare_recv_buffer (CommBuf &recv_buffer, GhostCommunication const &ghost_comm, BoxGeometry const &box_geo, unsigned int data_parts)
 
static void put_recv_buffer (CommBuf &recv_buffer, GhostCommunication const &ghost_comm, BoxGeometry const &box_geo, unsigned int data_parts)
 
static void add_rattle_correction_from_recv_buffer (CommBuf &recv_buffer, const GhostCommunication &ghost_comm)
 
static void add_forces_from_recv_buffer (CommBuf &recv_buffer, const GhostCommunication &ghost_comm)
 
static void cell_cell_transfer (GhostCommunication const &ghost_comm, BoxGeometry const &box_geo, unsigned int data_parts)
 
static bool is_send_op (int comm_type, int node, int this_node)
 
static bool is_recv_op (int comm_type, int node, int this_node)
 
static bool is_prefetchable (GhostCommunication const &ghost_comm, int this_node)
 
static bool is_poststorable (GhostCommunication const &ghost_comm, int this_node)
 
void ghost_communicator (GhostCommunicator const &gcr, BoxGeometry const &box_geo, unsigned int data_parts)
 Do a ghost communication with the specified data parts.
 

Detailed Description

Ghost particles and particle exchange.

For more information on ghosts, see ghosts.hpp

Note on variable naming:

  • a "GhostCommunicator" is always named "gcr",
  • a "GhostCommunication" is always named "ghost_comm".

Definition in file ghosts.cpp.

Macro Definition Documentation

◆ REQ_GHOST_SEND

#define REQ_GHOST_SEND   100

Tag for ghosts communications.

Definition at line 57 of file ghosts.cpp.

Enumeration Type Documentation

◆ ReductionPolicy

enum class ReductionPolicy
strong

Type of reduction to carry out during serialization.

Enumerator
MOVE 

Reduction for domain-to-domain particle communication.

UPDATE 

Reduction for cell-to-cell particle update.

Definition at line 108 of file ghosts.cpp.

◆ SerializationDirection

enum class SerializationDirection
strong

Whether to save the state to or load the state from the archive.

Enumerator
SAVE 
LOAD 

Definition at line 116 of file ghosts.cpp.

Function Documentation

◆ add_forces_from_recv_buffer()

static void add_forces_from_recv_buffer ( CommBuf recv_buffer,
const GhostCommunication ghost_comm 
)
static

Definition at line 364 of file ghosts.cpp.

References CommBuf::make_span(), and GhostCommunication::part_lists.

Referenced by ghost_communicator().

◆ add_rattle_correction_from_recv_buffer()

static void add_rattle_correction_from_recv_buffer ( CommBuf recv_buffer,
const GhostCommunication ghost_comm 
)
static

Definition at line 350 of file ghosts.cpp.

References CommBuf::make_span(), and GhostCommunication::part_lists.

Referenced by ghost_communicator().

◆ calc_transmit_size() [1/2]

static auto calc_transmit_size ( BoxGeometry const &  box_geo,
unsigned  data_parts 
)
static

◆ calc_transmit_size() [2/2]

static auto calc_transmit_size ( GhostCommunication const &  ghost_comm,
BoxGeometry const &  box_geo,
unsigned int  data_parts 
)
static

◆ cell_cell_transfer()

static void cell_cell_transfer ( GhostCommunication const &  ghost_comm,
BoxGeometry const &  box_geo,
unsigned int  data_parts 
)
static

◆ ghost_communicator()

◆ is_poststorable()

static bool is_poststorable ( GhostCommunication const &  ghost_comm,
int  this_node 
)
static

◆ is_prefetchable()

static bool is_prefetchable ( GhostCommunication const &  ghost_comm,
int  this_node 
)
static

◆ is_recv_op()

static bool is_recv_op ( int  comm_type,
int  node,
int  this_node 
)
static

Definition at line 420 of file ghosts.cpp.

References GHOST_BCST, GHOST_RDCE, GHOST_RECV, and this_node.

Referenced by ghost_communicator(), and is_poststorable().

◆ is_send_op()

static bool is_send_op ( int  comm_type,
int  node,
int  this_node 
)
static

Definition at line 415 of file ghosts.cpp.

References GHOST_BCST, GHOST_RDCE, GHOST_SEND, and this_node.

Referenced by ghost_communicator(), and is_prefetchable().

◆ prepare_ghost_cell()

static void prepare_ghost_cell ( ParticleList cell,
std::size_t  size 
)
static

Definition at line 289 of file ghosts.cpp.

References Utils::Bag< T >::resize().

Referenced by cell_cell_transfer(), and put_recv_buffer().

◆ prepare_recv_buffer()

static void prepare_recv_buffer ( CommBuf recv_buffer,
GhostCommunication const &  ghost_comm,
BoxGeometry const &  box_geo,
unsigned int  data_parts 
)
static

Definition at line 299 of file ghosts.cpp.

References CommBuf::bonds(), calc_transmit_size(), and CommBuf::resize().

Referenced by ghost_communicator().

◆ prepare_send_buffer()

static void prepare_send_buffer ( CommBuf send_buffer,
GhostCommunication const &  ghost_comm,
BoxGeometry const &  box_geo,
unsigned int  data_parts 
)
static

◆ put_recv_buffer()

static void put_recv_buffer ( CommBuf recv_buffer,
GhostCommunication const &  ghost_comm,
BoxGeometry const &  box_geo,
unsigned int  data_parts 
)
static

◆ serialize_and_reduce()

template<class Archive >
static void serialize_and_reduce ( Archive &  ar,
Particle p,
unsigned int  data_parts,
ReductionPolicy  policy,
SerializationDirection  direction,
BoxGeometry const &  box_geo,
Utils::Vector3d const *  ghost_shift 
)
static