preCICE v3.1.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
precice::m2n::DistributedCommunication Class Referenceabstract

Interface for all distributed solver to solver communication classes. More...

#include <DistributedCommunication.hpp>

Inheritance diagram for precice::m2n::DistributedCommunication:
[legend]
Collaboration diagram for precice::m2n::DistributedCommunication:
[legend]

Public Types

using SharedPointer = std::shared_ptr<DistributedCommunication>
 
using CommunicationMap = std::map<int, std::vector<int>>
 

Public Member Functions

 DistributedCommunication (mesh::PtrMesh mesh)
 
virtual ~DistributedCommunication ()
 Destructor, empty.
 
virtual bool isConnected () const =0
 Returns true, if a connection to a remote participant has been setup.
 
virtual void acceptConnection (const std::string &acceptorName, const std::string &requesterName)=0
 Connects to another participant, which has to call requestConnection().
 
virtual void requestConnection (const std::string &acceptorName, const std::string &requesterName)=0
 Connects to another participant, which has to call acceptConnection().
 
virtual void acceptPreConnection (std::string const &acceptorName, std::string const &requesterName)=0
 Connects to another participant, which has to call requestPreConnection(). Exchanged vertex list is not included, only connection between ranks is established.
 
virtual void requestPreConnection (std::string const &acceptorName, std::string const &requesterName)=0
 Connects to another participant, which has to call acceptPreConnection(). Exchanged vertex list is not included, only connection between ranks is established.
 
virtual void completeSecondaryRanksConnection ()=0
 
virtual void closeConnection ()=0
 Disconnects from communication space, i.e. participant.
 
virtual void send (precice::span< double const > itemsToSend, int valueDimension)=0
 Sends an array of double values from all ranks (different for each rank).
 
virtual void receive (precice::span< double > itemsToReceive, int valueDimension)=0
 All ranks receive an array of doubles (different for each rank).
 
virtual void broadcastSend (int itemToSend)=0
 Broadcasts an int to connected ranks on remote participant.
 
virtual void broadcastReceiveAll (std::vector< int > &itemToReceive)=0
 Receives an int per connected rank on remote participant @para[out] itemToReceive received ints from remote ranks are stored with the sender rank order.
 
virtual void broadcastSendMesh ()=0
 Broadcasts a mesh to connected ranks on remote participant.
 
virtual void broadcastReceiveAllMesh ()=0
 Receive mesh partitions per connected rank on remote participant.
 
virtual void scatterAllCommunicationMap (CommunicationMap &localCommunicationMap)=0
 Scatters a communication map over connected ranks on remote participant.
 
virtual void gatherAllCommunicationMap (CommunicationMap &localCommunicationMap)=0
 Gathers a communication maps from connected ranks on remote participant.
 

Protected Attributes

mesh::PtrMesh _mesh
 mesh that dictates the distribution of this mapping
 

Detailed Description

Interface for all distributed solver to solver 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.

This interface organizes the communication between 2 distributed participants. The core communication (e.g. Sockets or MPI) is still handled in com/Communication.hpp . The information on how the mesh is distributed can be accessed through the member variable _mesh.

The class offers methods to communicate between all processors. This can either mean that data is communicated in a distributed way, in case of arrays, or that single values are broadcasted.

Definition at line 33 of file DistributedCommunication.hpp.

Member Typedef Documentation

◆ CommunicationMap

Definition at line 117 of file DistributedCommunication.hpp.

◆ SharedPointer

Definition at line 35 of file DistributedCommunication.hpp.

Constructor & Destructor Documentation

◆ DistributedCommunication()

precice::m2n::DistributedCommunication::DistributedCommunication ( mesh::PtrMesh mesh)
inlineexplicit

Definition at line 37 of file DistributedCommunication.hpp.

◆ ~DistributedCommunication()

virtual precice::m2n::DistributedCommunication::~DistributedCommunication ( )
inlinevirtual

Destructor, empty.

Definition at line 43 of file DistributedCommunication.hpp.

Member Function Documentation

◆ acceptConnection()

virtual void precice::m2n::DistributedCommunication::acceptConnection ( const std::string & acceptorName,
const std::string & requesterName )
pure virtual

Connects to another participant, which has to call requestConnection().

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

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ acceptPreConnection()

virtual void precice::m2n::DistributedCommunication::acceptPreConnection ( std::string const & acceptorName,
std::string const & requesterName )
pure virtual

Connects to another participant, which has to call requestPreConnection(). Exchanged vertex list is not included, only connection between ranks is established.

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

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ broadcastReceiveAll()

virtual void precice::m2n::DistributedCommunication::broadcastReceiveAll ( std::vector< int > & itemToReceive)
pure virtual

Receives an int per connected rank on remote participant @para[out] itemToReceive received ints from remote ranks are stored with the sender rank order.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ broadcastReceiveAllMesh()

virtual void precice::m2n::DistributedCommunication::broadcastReceiveAllMesh ( )
pure virtual

Receive mesh partitions per connected rank on remote participant.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ broadcastSend()

virtual void precice::m2n::DistributedCommunication::broadcastSend ( int itemToSend)
pure virtual

Broadcasts an int to connected ranks on remote participant.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ broadcastSendMesh()

virtual void precice::m2n::DistributedCommunication::broadcastSendMesh ( )
pure virtual

Broadcasts a mesh to connected ranks on remote participant.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ closeConnection()

virtual void precice::m2n::DistributedCommunication::closeConnection ( )
pure virtual

Disconnects from communication space, i.e. participant.

This method is called on destruction.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ completeSecondaryRanksConnection()

virtual void precice::m2n::DistributedCommunication::completeSecondaryRanksConnection ( )
pure virtual

◆ gatherAllCommunicationMap()

virtual void precice::m2n::DistributedCommunication::gatherAllCommunicationMap ( CommunicationMap & localCommunicationMap)
pure virtual

Gathers a communication maps from connected ranks on remote participant.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ isConnected()

virtual bool precice::m2n::DistributedCommunication::isConnected ( ) const
pure virtual

Returns true, if a connection to a remote participant has been setup.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ receive()

virtual void precice::m2n::DistributedCommunication::receive ( precice::span< double > itemsToReceive,
int valueDimension )
pure virtual

All ranks receive an array of doubles (different for each rank).

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ requestConnection()

virtual void precice::m2n::DistributedCommunication::requestConnection ( const std::string & acceptorName,
const std::string & requesterName )
pure virtual

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

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

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ requestPreConnection()

virtual void precice::m2n::DistributedCommunication::requestPreConnection ( std::string const & acceptorName,
std::string const & requesterName )
pure virtual

Connects to another participant, which has to call acceptPreConnection(). Exchanged vertex list is not included, only connection between ranks is established.

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

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ scatterAllCommunicationMap()

virtual void precice::m2n::DistributedCommunication::scatterAllCommunicationMap ( CommunicationMap & localCommunicationMap)
pure virtual

Scatters a communication map over connected ranks on remote participant.

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

◆ send()

virtual void precice::m2n::DistributedCommunication::send ( precice::span< double const > itemsToSend,
int valueDimension )
pure virtual

Sends an array of double values from all ranks (different for each rank).

Implemented in precice::m2n::GatherScatterCommunication, and precice::m2n::PointToPointCommunication.

Member Data Documentation

◆ _mesh

mesh::PtrMesh precice::m2n::DistributedCommunication::_mesh
protected

mesh that dictates the distribution of this mapping

Todo
maybe change this directly to vertexDistribution

Definition at line 146 of file DistributedCommunication.hpp.


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