preCICE
Loading...
Searching...
No Matches
precice::com Namespace Reference

contains the data communication abstraction layer. More...

Namespaces

namespace  impl
namespace  serialize
 contains serialization logic

Classes

struct  AsVectorTag
class  CommunicationFactory
class  CommunicationConfiguration
 Configuration for communication channels between a primary and its secondary ranks. The communication between two solvers is configured in m2n::M2NConfiguration. More...
class  ConnectionInfoPublisher
class  ConnectionInfoReader
 Reads the connection info for the given participant/rank information. More...
class  ConnectionInfoWriter
 Writes the connection info for the given participant/rank information. More...
class  MPICommunication
 Provides implementation for basic MPI point-to-point communication. More...
class  MPIDirectCommunication
 Provides connection methods for processes located in one communicator. More...
class  MPIPortsCommunication
 Provides connection methods based on MPI ports (part of MPI 2.0). More...
class  MPIPortsCommunicationFactory
class  MPIRequest
class  MPISinglePortsCommunication
 Provides connection methods based on MPI ports (part of MPI 2.0). More...
class  MPISinglePortsCommunicationFactory
class  Request
class  SocketCommunication
 Implements Communication by using sockets. More...
class  SocketCommunicationFactory
class  SocketRequest
class  SocketSendQueue

Typedefs

using PtrCommunication = std::shared_ptr<Communication>
using PtrCommunicationFactory = std::shared_ptr<CommunicationFactory>
using PtrRequest = std::shared_ptr<Request>

Functions

void connectCircularComm (std::string const &participantName, std::string const &tag, int rank, int size, com::Communication &left, com::Communication &right)
void setRankOffset (Rank rankOffset)
 Set rank offset.
virtual int adjustRank (Rank rank) const
 Adjusts the given rank bases on the _rankOffset.
void sendMesh (Communication &communication, int rankReceiver, const mesh::Mesh &mesh)
void receiveMesh (Communication &communication, int rankSender, mesh::Mesh &mesh)
void broadcastSendMesh (Communication &communication, const mesh::Mesh &mesh)
void broadcastReceiveMesh (Communication &communication, mesh::Mesh &mesh)
void sendConnectionMap (Communication &communication, int rankReceiver, const mesh::Mesh::ConnectionMap &cm)
void receiveConnectionMap (Communication &communication, int rankSender, mesh::Mesh::ConnectionMap &cm)
void broadcastSendConnectionMap (Communication &communication, const mesh::Mesh::ConnectionMap &cm)
void broadcastReceiveConnectionMap (Communication &communication, mesh::Mesh::ConnectionMap &cm)
void sendBoundingBox (Communication &communication, int rankReceiver, const mesh::BoundingBox &bb)
void receiveBoundingBox (Communication &communication, int rankSender, mesh::BoundingBox &bb)
void sendBoundingBoxMap (Communication &communication, int rankReceiver, const mesh::Mesh::BoundingBoxMap &bbm)
void receiveBoundingBoxMap (Communication &communication, int rankSender, mesh::Mesh::BoundingBoxMap &bbm)
void broadcastSendBoundingBoxMap (Communication &communication, const mesh::Mesh::BoundingBoxMap &bbm)
void broadcastReceiveBoundingBoxMap (Communication &communication, mesh::Mesh::BoundingBoxMap &bbm)
Connection Setup

Interface for all interprocess communication classes.

By default, communication is done within the local communication space. In order to connect to a different communication space, i.e. coupling participant, the methods acceptConnection() and requestConnection() have to called by the two participants which intend to establish a connection. All following communication and process ranking refers to the remote communication space afterwards.

Sending methods prefixed with `a' are asynchronous. It means that they return immediately, even though either the actual sending might have not been started yet or data from user buffer that is being supplied has not been safely stored away (to system buffer) yet. This implies that user buffer cannot be immediately reused (for writing) after asynchronous sending call returns. However, a special corresponding "request" object is returned by all asynchronous sending methods, which could be further used in future in order to properly wait (block execution) until either the corresponding sending request has truly finished or data from user buffer that is being supplied has been safely stored away (to system buffer) and, thus, can be reused (for writing).

The main benefit from asynchronous sending methods is their deterministic behavior, i.e. the guarantee that they can never block the execution (return immediately). The two typical scenarios where this comes handy are:

  1. Robustness — allows one to write deadlock-prone communication algorithms (see point-to-point communication).
  2. Efficiency — allows one to perform some useful computational work while sending is happening on the background.
Attention
All receive methods, that accept a raw array, expect it to be sized appropriately. Asynchronous receive methods also expect the vector be sized correctly. */ class Communication {

public: Communication &operator=(Communication &&) = delete;

/ Destructor, empty. virtual ~Communication() = default;

/ /

/ Returns true, if a connection to a remote participant has been setup. virtual bool isConnected() { return _isConnected; }

/**

Returns the number of processes in the remote communicator.

Precondition
A connection to the remote participant has been set up.
virtual size_t getRemoteCommunicatorSize ()=0
auto remoteCommunicatorRanks ()
 Returns a range over all valid remote ranks.
virtual void acceptConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int rankOffset=0)=0
 Accepts connection from another communicator, which has to call requestConnection().
virtual void acceptConnectionAsServer (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int requesterCommunicatorSize)=0
 Accepts connection from another communicator, which has to call requestConnectionAsClient().
virtual void requestConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int requesterRank, int requesterCommunicatorSize)=0
 Connects to another communicator, which has to call acceptConnection().
virtual void requestConnectionAsClient (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, std::set< int > const &acceptorRanks, int requesterRank)=0
 Connects to another communicator, which has to call acceptConnectionAsServer().
void connectIntraComm (std::string const &participantName, std::string const &tag, int rank, int size)
virtual void closeConnection ()=0
 Disconnects from communication space, i.e. participant.
virtual void prepareEstablishment (std::string const &acceptorName, std::string const &requesterName)
 Prepare environment used to establish the communication.
virtual void cleanupEstablishment (std::string const &acceptorName, std::string const &requesterName)
 Clean-up environment used to establish the communication.
Reduction
virtual void reduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive, Rank primaryRank)
 Performs a reduce summation on the rank given by primaryRank.
virtual void reduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive)
 Performs a reduce summation on the primary rank, every other rank has to call reduceSum.
virtual void reduceSum (int itemToSend, int &itemToReceive, Rank primaryRank)
virtual void reduceSum (int itemsToSend, int &itemsToReceive)
virtual void allreduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive, Rank primaryRank)
virtual void allreduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive)
virtual void allreduceSum (double itemToSend, double &itemToReceive, Rank primaryRank)
virtual void allreduceSum (double itemToSend, double &itemToReceive)
virtual void allreduceSum (int itemToSend, int &itemToReceive, Rank primaryRank)
virtual void allreduceSum (int itemToSend, int &itemToReceive)
Broadcast
virtual void broadcast (precice::span< const int > itemsToSend)
virtual void broadcast (precice::span< int > itemsToReceive, Rank rankBroadcaster)
virtual void broadcast (int itemToSend)
virtual void broadcast (int &itemToReceive, Rank rankBroadcaster)
virtual void broadcast (precice::span< const double > itemsToSend)
virtual void broadcast (precice::span< double > itemsToReceive, Rank rankBroadcaster)
virtual void broadcast (double itemToSend)
virtual void broadcast (double &itemToReceive, Rank rankBroadcaster)
virtual void broadcast (bool itemToSend)
virtual void broadcast (bool &itemToReceive, Rank rankBroadcaster)
virtual void broadcast (std::vector< int > const &v)
virtual void broadcast (std::vector< int > &v, Rank rankBroadcaster)
virtual void broadcast (std::vector< double > const &v)
virtual void broadcast (std::vector< double > &v, Rank rankBroadcaster)
Send
virtual void send (std::string const &itemToSend, Rank rankReceiver)=0
 Sends a std::string to process with given rank.
virtual void send (precice::span< const int > itemsToSend, Rank rankReceiver)=0
 Sends an array of integer values.
virtual PtrRequest aSend (precice::span< const int > itemsToSend, Rank rankReceiver)=0
 Asynchronously sends an array of integer values.
virtual void send (precice::span< const double > itemsToSend, Rank rankReceiver)=0
 Sends an array of double values.
virtual PtrRequest aSend (precice::span< const double > itemsToSend, Rank rankReceiver)=0
 Asynchronously sends an array of double values.
virtual void send (double itemToSend, Rank rankReceiver)=0
 Sends a double to process with given rank.
virtual PtrRequest aSend (const double &itemToSend, Rank rankReceiver)=0
 Asynchronously sends a double to process with given rank.
virtual void send (int itemToSend, Rank rankReceiver)=0
 Sends an int to process with given rank.
virtual PtrRequest aSend (const int &itemToSend, Rank rankReceiver)=0
 Asynchronously sends an int to process with given rank.
virtual void send (bool itemToSend, Rank rankReceiver)=0
 Sends a bool to process with given rank.
virtual PtrRequest aSend (const bool &itemToSend, Rank rankReceiver)=0
 Asynchronously sends a bool to process with given rank.
Receive
virtual void receive (std::string &itemToReceive, Rank rankSender)=0
 Receives a std::string from process with given rank.
virtual void receive (precice::span< int > itemsToReceive, Rank rankSender)=0
 Receives an array of integer values.
virtual void receive (precice::span< double > itemsToReceive, Rank rankSender)=0
 Receives an array of double values.
virtual PtrRequest aReceive (precice::span< double > itemsToReceive, int rankSender)=0
 Asynchronously receives an array of double values.
virtual void receive (double &itemToReceive, Rank rankSender)=0
 Receives a double from process with given rank.
virtual PtrRequest aReceive (double &itemToReceive, Rank rankSender)=0
 Asynchronously receives a double from process with given rank.
virtual void receive (int &itemToReceive, Rank rankSender)=0
 Receives an int from process with given rank.
virtual PtrRequest aReceive (int &itemToReceive, Rank rankSender)=0
 Asynchronously receives an int from process with given rank.
virtual void receive (bool &itemToReceive, Rank rankSender)=0
 Receives a bool from process with given rank.
virtual PtrRequest aReceive (bool &itemToReceive, Rank rankSender)=0
 Asynchronously receives a bool from process with given rank.
Range communication
void sendRange (precice::span< const double > itemsToSend, Rank rankReceiver)
 Sends a range of doubles (size + content).
void sendRange (precice::span< const int > itemsToSend, Rank rankReceiver)
 Sends a range of ints (size + content).
std::vector< int > receiveRange (Rank rankSender, AsVectorTag< int >)
 Receives a range of ints as a vector<int>.
std::vector< double > receiveRange (Rank rankSender, AsVectorTag< double >)
 Receives a range of doubles as a vector<double>.

Variables

int _rankOffset = 0
 Rank offset for primaries-secondary communication, since ranks are from 0 to size-2.
bool _isConnected = false
logging::Logger _log {"com::Communication"}
template<typename T>
constexpr auto asVector = Communication::AsVectorTag<T>{}
 Allows to use Communication::AsVectorTag in a less verbose way.

Detailed Description

contains the data communication abstraction layer.

Typedef Documentation

◆ PtrCommunication

using precice::com::PtrCommunication = std::shared_ptr<Communication>

Definition at line 11 of file SharedPointer.hpp.

◆ PtrCommunicationFactory

Definition at line 12 of file SharedPointer.hpp.

◆ PtrRequest

using precice::com::PtrRequest = std::shared_ptr<Request>

Definition at line 13 of file SharedPointer.hpp.

Function Documentation

◆ acceptConnection()

virtual void precice::com::acceptConnection ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int acceptorRank,
int rankOffset = 0 )
pure virtual

Accepts connection from another communicator, which has to call requestConnection().

Establishes a 1-to-N communication, whereas the acceptor's side is the "1". Contrary to acceptConnectionAsServer(), the other side needs to be a proper communicator with ranks from 0 to N-1. It is not necessary to know this "N" a-priori on the acceptor's side. This communication is used for the 1:1 communication between two primary ranks and for the intra-participant communication. For the last case, setRankOffset() has to be set.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.
[in]tagTag for establishing this connection
[in]acceptorRankRank of the accepting process, usually the calling one.

◆ acceptConnectionAsServer()

virtual void precice::com::acceptConnectionAsServer ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int acceptorRank,
int requesterCommunicatorSize )
pure virtual

Accepts connection from another communicator, which has to call requestConnectionAsClient().

Establishes a 1-to-N communication, whereas the acceptor's side is the "1". Contrary to acceptConnection(), the other side can have arbitrary ranks. However, we need to know its size "N" a-priori. This communication is only used in PointToPointCommunication, i.e. for the M-to-N communication between two participants.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.
[in]tagTag for establishing this connection
[in]acceptorRankRank of accepting server, usually the rank of the current process.
[in]requesterCommunicatorSizeSize of the requester (N)

◆ adjustRank()

virtual int precice::com::adjustRank ( Rank rank) const
protectedvirtual

Adjusts the given rank bases on the _rankOffset.

◆ allreduceSum() [1/6]

virtual void precice::com::allreduceSum ( double itemToSend,
double & itemToReceive )
virtual

◆ allreduceSum() [2/6]

virtual void precice::com::allreduceSum ( double itemToSend,
double & itemToReceive,
Rank primaryRank )
virtual

◆ allreduceSum() [3/6]

virtual void precice::com::allreduceSum ( int itemToSend,
int & itemToReceive )
virtual

◆ allreduceSum() [4/6]

virtual void precice::com::allreduceSum ( int itemToSend,
int & itemToReceive,
Rank primaryRank )
virtual

◆ allreduceSum() [5/6]

virtual void precice::com::allreduceSum ( precice::span< double const > itemsToSend,
precice::span< double > itemsToReceive )
virtual

◆ allreduceSum() [6/6]

virtual void precice::com::allreduceSum ( precice::span< double const > itemsToSend,
precice::span< double > itemsToReceive,
Rank primaryRank )
virtual

◆ aReceive() [1/4]

virtual PtrRequest precice::com::aReceive ( bool & itemToReceive,
Rank rankSender )
pure virtual

Asynchronously receives a bool from process with given rank.

◆ aReceive() [2/4]

virtual PtrRequest precice::com::aReceive ( double & itemToReceive,
Rank rankSender )
pure virtual

Asynchronously receives a double from process with given rank.

◆ aReceive() [3/4]

virtual PtrRequest precice::com::aReceive ( int & itemToReceive,
Rank rankSender )
pure virtual

Asynchronously receives an int from process with given rank.

◆ aReceive() [4/4]

virtual PtrRequest precice::com::aReceive ( precice::span< double > itemsToReceive,
int rankSender )
pure virtual

Asynchronously receives an array of double values.

◆ aSend() [1/5]

virtual PtrRequest precice::com::aSend ( const bool & itemToSend,
Rank rankReceiver )
pure virtual

Asynchronously sends a bool to process with given rank.

Attention
The caller must guarantee that the lifetime of the item extends to the completion of the request!

◆ aSend() [2/5]

virtual PtrRequest precice::com::aSend ( const double & itemToSend,
Rank rankReceiver )
pure virtual

Asynchronously sends a double to process with given rank.

Attention
The caller must guarantee that the lifetime of the item extends to the completion of the request!

◆ aSend() [3/5]

virtual PtrRequest precice::com::aSend ( const int & itemToSend,
Rank rankReceiver )
pure virtual

Asynchronously sends an int to process with given rank.

Attention
The caller must guarantee that the lifetime of the item extends to the completion of the request!

◆ aSend() [4/5]

virtual PtrRequest precice::com::aSend ( precice::span< const double > itemsToSend,
Rank rankReceiver )
pure virtual

Asynchronously sends an array of double values.

Attention
The caller must guarantee that the lifetime of the item extends to the completion of the request!

◆ aSend() [5/5]

virtual PtrRequest precice::com::aSend ( precice::span< const int > itemsToSend,
Rank rankReceiver )
pure virtual

Asynchronously sends an array of integer values.

Attention
The caller must guarantee that the lifetime of the item extends to the completion of the request!

◆ broadcast() [1/14]

virtual void precice::com::broadcast ( bool & itemToReceive,
Rank rankBroadcaster )
virtual

◆ broadcast() [2/14]

virtual void precice::com::broadcast ( bool itemToSend)
virtual

◆ broadcast() [3/14]

virtual void precice::com::broadcast ( double & itemToReceive,
Rank rankBroadcaster )
virtual

◆ broadcast() [4/14]

virtual void precice::com::broadcast ( double itemToSend)
virtual

◆ broadcast() [5/14]

virtual void precice::com::broadcast ( int & itemToReceive,
Rank rankBroadcaster )
virtual

◆ broadcast() [6/14]

virtual void precice::com::broadcast ( int itemToSend)
virtual

◆ broadcast() [7/14]

virtual void precice::com::broadcast ( precice::span< const double > itemsToSend)
virtual

◆ broadcast() [8/14]

virtual void precice::com::broadcast ( precice::span< const int > itemsToSend)
virtual

◆ broadcast() [9/14]

virtual void precice::com::broadcast ( precice::span< double > itemsToReceive,
Rank rankBroadcaster )
virtual

◆ broadcast() [10/14]

virtual void precice::com::broadcast ( precice::span< int > itemsToReceive,
Rank rankBroadcaster )
virtual

◆ broadcast() [11/14]

virtual void precice::com::broadcast ( std::vector< double > & v,
Rank rankBroadcaster )
virtual

◆ broadcast() [12/14]

virtual void precice::com::broadcast ( std::vector< double > const & v)
virtual

◆ broadcast() [13/14]

virtual void precice::com::broadcast ( std::vector< int > & v,
Rank rankBroadcaster )
virtual

◆ broadcast() [14/14]

virtual void precice::com::broadcast ( std::vector< int > const & v)
virtual

◆ broadcastReceiveBoundingBoxMap()

void precice::com::broadcastReceiveBoundingBoxMap ( Communication & communication,
mesh::Mesh::BoundingBoxMap & bbm )

Definition at line 73 of file Extra.cpp.

Here is the call graph for this function:

◆ broadcastReceiveConnectionMap()

void precice::com::broadcastReceiveConnectionMap ( Communication & communication,
mesh::Mesh::ConnectionMap & cm )

Definition at line 43 of file Extra.cpp.

Here is the call graph for this function:

◆ broadcastReceiveMesh()

void precice::com::broadcastReceiveMesh ( Communication & communication,
mesh::Mesh & mesh )

Definition at line 23 of file Extra.cpp.

Here is the call graph for this function:

◆ broadcastSendBoundingBoxMap()

void precice::com::broadcastSendBoundingBoxMap ( Communication & communication,
const mesh::Mesh::BoundingBoxMap & bbm )

Definition at line 68 of file Extra.cpp.

Here is the call graph for this function:

◆ broadcastSendConnectionMap()

void precice::com::broadcastSendConnectionMap ( Communication & communication,
const mesh::Mesh::ConnectionMap & cm )

Definition at line 38 of file Extra.cpp.

Here is the call graph for this function:

◆ broadcastSendMesh()

void precice::com::broadcastSendMesh ( Communication & communication,
const mesh::Mesh & mesh )

Definition at line 18 of file Extra.cpp.

Here is the call graph for this function:

◆ cleanupEstablishment()

virtual void precice::com::cleanupEstablishment ( std::string const & acceptorName,
std::string const & requesterName )
virtual

Clean-up environment used to establish the communication.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.

Definition at line 204 of file Communication.hpp.

◆ closeConnection()

virtual void precice::com::closeConnection ( )
pure virtual

Disconnects from communication space, i.e. participant.

This method is called on destruction.

◆ connectCircularComm()

void precice::com::connectCircularComm ( std::string const & participantName,
std::string const & tag,
int rank,
int size,
com::Communication & left,
com::Communication & right )

Establishes a circular communication for the given participant.

rank "0" connects left to rank "size-1" rank "size" connects right to rank "0"

Definition at line 359 of file Communication.cpp.

◆ connectIntraComm()

void precice::com::Communication::connectIntraComm ( std::string const & participantName,
std::string const & tag,
int rank,
int size )

Establishes the intra-participant communication connection.

Parameters
[in]participantNameName of the calling participant.
[in]tagTag for establishing this connection
[in]rankThe current rank in the participant
[in]sizeTotal size of the participant

Definition at line 14 of file Communication.cpp.

Here is the call graph for this function:

◆ getRemoteCommunicatorSize()

virtual size_t precice::com::getRemoteCommunicatorSize ( )
pure virtual

◆ prepareEstablishment()

virtual void precice::com::prepareEstablishment ( std::string const & acceptorName,
std::string const & requesterName )
virtual

Prepare environment used to establish the communication.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.

Definition at line 195 of file Communication.hpp.

◆ receive() [1/6]

virtual void precice::com::receive ( bool & itemToReceive,
Rank rankSender )
pure virtual

Receives a bool from process with given rank.

◆ receive() [2/6]

virtual void precice::com::receive ( double & itemToReceive,
Rank rankSender )
pure virtual

Receives a double from process with given rank.

◆ receive() [3/6]

virtual void precice::com::receive ( int & itemToReceive,
Rank rankSender )
pure virtual

Receives an int from process with given rank.

◆ receive() [4/6]

virtual void precice::com::receive ( precice::span< double > itemsToReceive,
Rank rankSender )
pure virtual

Receives an array of double values.

◆ receive() [5/6]

virtual void precice::com::receive ( precice::span< int > itemsToReceive,
Rank rankSender )
pure virtual

Receives an array of integer values.

◆ receive() [6/6]

virtual void precice::com::receive ( std::string & itemToReceive,
Rank rankSender )
pure virtual

Receives a std::string from process with given rank.

◆ receiveBoundingBox()

void precice::com::receiveBoundingBox ( Communication & communication,
int rankSender,
mesh::BoundingBox & bb )

Definition at line 53 of file Extra.cpp.

Here is the call graph for this function:

◆ receiveBoundingBoxMap()

void precice::com::receiveBoundingBoxMap ( Communication & communication,
int rankSender,
mesh::Mesh::BoundingBoxMap & bbm )

Definition at line 63 of file Extra.cpp.

Here is the call graph for this function:

◆ receiveConnectionMap()

void precice::com::receiveConnectionMap ( Communication & communication,
int rankSender,
mesh::Mesh::ConnectionMap & cm )

Definition at line 33 of file Extra.cpp.

Here is the call graph for this function:

◆ receiveMesh()

void precice::com::receiveMesh ( Communication & communication,
int rankSender,
mesh::Mesh & mesh )

Definition at line 13 of file Extra.cpp.

Here is the call graph for this function:

◆ receiveRange() [1/2]

std::vector< double > precice::com::Communication::receiveRange ( Rank rankSender,
AsVectorTag< double >  )

Receives a range of doubles as a vector<double>.

Definition at line 341 of file Communication.cpp.

Here is the call graph for this function:

◆ receiveRange() [2/2]

std::vector< int > precice::com::Communication::receiveRange ( Rank rankSender,
AsVectorTag< int >  )

Receives a range of ints as a vector<int>.

Definition at line 328 of file Communication.cpp.

Here is the call graph for this function:

◆ reduceSum() [1/4]

virtual void precice::com::reduceSum ( int itemsToSend,
int & itemsToReceive )
virtual

◆ reduceSum() [2/4]

virtual void precice::com::reduceSum ( int itemToSend,
int & itemToReceive,
Rank primaryRank )
virtual

◆ reduceSum() [3/4]

virtual void precice::com::reduceSum ( precice::span< double const > itemsToSend,
precice::span< double > itemsToReceive )
virtual

Performs a reduce summation on the primary rank, every other rank has to call reduceSum.

◆ reduceSum() [4/4]

virtual void precice::com::reduceSum ( precice::span< double const > itemsToSend,
precice::span< double > itemsToReceive,
Rank primaryRank )
virtual

Performs a reduce summation on the rank given by primaryRank.

◆ remoteCommunicatorRanks()

auto precice::com::remoteCommunicatorRanks ( )

Returns a range over all valid remote ranks.

Precondition
A connection to the remote participant has been set up.
See also
getRemoteCommunicatorSize()

Definition at line 82 of file Communication.hpp.

Here is the call graph for this function:

◆ requestConnection()

virtual void precice::com::requestConnection ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int requesterRank,
int requesterCommunicatorSize )
pure virtual

Connects to another communicator, which has to call acceptConnection().

Establishes a 1-to-N communication, whereas the requestor's side is the "N". Contrary to requestConnectionAsClient(), this side needs to be a proper communicator with ranks from 0 to N-1. All ranks need to call this function. This communication is used for the 1:1 communication between two primary ranks, and for the intra-participant communication.

Parameters
[in]acceptorNameName of remote participant to connect to.
[in]requesterNameName of calling participant.
[in]tagTag for establishing this connection
[in]requesterRankRank of the requester (has to go from 0 to N-1)
[in]requesterCommunicatorSizeSize of the requester (N)

◆ requestConnectionAsClient()

virtual void precice::com::requestConnectionAsClient ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
std::set< int > const & acceptorRanks,
int requesterRank )
pure virtual

Connects to another communicator, which has to call acceptConnectionAsServer().

Establishes a 1-to-N communication, whereas the requestor's side is the "N". Contrary to requestConnection(), this side can have arbitrary ranks (e.g. 2,3,7). All ranks need to call this function. This communication is only used in PointToPointCommunication, i.e. for the M-to-N communication between two participants.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to
[in]tagTag for establishing this connection
[in]acceptorRanksSet of ranks that accept a connection
[in]requesterRankRank that requests the connection, usually the caller's rank

◆ send() [1/6]

virtual void precice::com::send ( bool itemToSend,
Rank rankReceiver )
pure virtual

Sends a bool to process with given rank.

◆ send() [2/6]

virtual void precice::com::send ( double itemToSend,
Rank rankReceiver )
pure virtual

Sends a double to process with given rank.

◆ send() [3/6]

virtual void precice::com::send ( int itemToSend,
Rank rankReceiver )
pure virtual

Sends an int to process with given rank.

◆ send() [4/6]

virtual void precice::com::send ( precice::span< const double > itemsToSend,
Rank rankReceiver )
pure virtual

Sends an array of double values.

◆ send() [5/6]

virtual void precice::com::send ( precice::span< const int > itemsToSend,
Rank rankReceiver )
pure virtual

Sends an array of integer values.

◆ send() [6/6]

virtual void precice::com::send ( std::string const & itemToSend,
Rank rankReceiver )
pure virtual

Sends a std::string to process with given rank.

◆ sendBoundingBox()

void precice::com::sendBoundingBox ( Communication & communication,
int rankReceiver,
const mesh::BoundingBox & bb )

Definition at line 48 of file Extra.cpp.

Here is the call graph for this function:

◆ sendBoundingBoxMap()

void precice::com::sendBoundingBoxMap ( Communication & communication,
int rankReceiver,
const mesh::Mesh::BoundingBoxMap & bbm )

Definition at line 58 of file Extra.cpp.

Here is the call graph for this function:

◆ sendConnectionMap()

void precice::com::sendConnectionMap ( Communication & communication,
int rankReceiver,
const mesh::Mesh::ConnectionMap & cm )

Definition at line 28 of file Extra.cpp.

Here is the call graph for this function:

◆ sendMesh()

void precice::com::sendMesh ( Communication & communication,
int rankReceiver,
const mesh::Mesh & mesh )

Definition at line 8 of file Extra.cpp.

Here is the call graph for this function:

◆ sendRange() [1/2]

void precice::com::Communication::sendRange ( precice::span< const double > itemsToSend,
Rank rankReceiver )

Sends a range of doubles (size + content).

Definition at line 310 of file Communication.cpp.

Here is the call graph for this function:

◆ sendRange() [2/2]

void precice::com::Communication::sendRange ( precice::span< const int > itemsToSend,
Rank rankReceiver )

Sends a range of ints (size + content).

Definition at line 319 of file Communication.cpp.

Here is the call graph for this function:

◆ setRankOffset()

void precice::com::setRankOffset ( Rank rankOffset)

Set rank offset.

Definition at line 361 of file Communication.hpp.

Variable Documentation

◆ _isConnected

bool precice::com::_isConnected = false
protected

Definition at line 370 of file Communication.hpp.

◆ _log

logging::Logger precice::com::_log {"com::Communication"}
private

Definition at line 376 of file Communication.hpp.

◆ _rankOffset

int precice::com::_rankOffset = 0
protected

Rank offset for primaries-secondary communication, since ranks are from 0 to size-2.

Definition at line 368 of file Communication.hpp.

◆ asVector

template<typename T>
auto precice::com::asVector = Communication::AsVectorTag<T>{}
inlineconstexprprivate

Allows to use Communication::AsVectorTag in a less verbose way.

Definition at line 381 of file Communication.hpp.