preCICE v3.1.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
precice::m2n::GatherScatterCommunication Class Reference

Implements DistributedCommunication by using a gathering/scattering methodology. Arrays of data are always gathered and scattered at the primary. No direct communication between secondary ranks is used. For more details see m2n/DistributedCommunication.hpp. More...

#include <GatherScatterCommunication.hpp>

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

Public Member Functions

 GatherScatterCommunication (com::PtrCommunication com, mesh::PtrMesh mesh)
 
 ~GatherScatterCommunication () override
 
bool isConnected () const override
 Returns true, if a connection to a remote participant has been setup.
 
void acceptConnection (const std::string &acceptorName, const std::string &requesterName) override
 Accepts connection from participant, which has to call requestConnection().
 
void requestConnection (const std::string &acceptorName, const std::string &requesterName) override
 Requests connection from participant, which has to call acceptConnection().
 
void acceptPreConnection (std::string const &acceptorName, std::string const &requesterName) override
 
void requestPreConnection (std::string const &acceptorName, std::string const &requesterName) override
 
void completeSecondaryRanksConnection () override
 Completes the secondary connections for both acceptor and requester by updating the vertex list in _mappings.
 
void closeConnection () override
 Disconnects from communication space, i.e. participant.
 
void send (precice::span< double const > itemsToSend, int valueDimension) override
 Sends an array of double values from all ranks (different for each rank).
 
void receive (precice::span< double > itemsToReceive, int valueDimension) override
 All ranks receive an array of doubles (different for each rank).
 
void broadcastSend (int itemToSend) override
 Broadcasts an int to connected ranks on remote participant. Not available for GatherScatterCommunication.
 
void broadcastReceiveAll (std::vector< int > &itemToReceive) override
 Receives an int per connected rank on remote participant. Not available for GatherScatterCommunication. @para[out] itemToReceive received ints from remote ranks are stored with the sender rank order.
 
void broadcastSendMesh () override
 Broadcasts a mesh to connected ranks on remote participant. Not available for GatherScatterCommunication.
 
void broadcastReceiveAllMesh () override
 Receive mesh partitions per connected rank on remote participant. Not available for GatherScatterCommunication.
 
void scatterAllCommunicationMap (CommunicationMap &localCommunicationMap) override
 Scatters a communication map over connected ranks on remote participant. Not available for GatherScatterCommunication.
 
void gatherAllCommunicationMap (CommunicationMap &localCommunicationMap) override
 Gathers a communication maps from connected ranks on remote participant. Not available for GatherScatterCommunication.
 
- Public Member Functions inherited from precice::m2n::DistributedCommunication
 DistributedCommunication (mesh::PtrMesh mesh)
 
virtual ~DistributedCommunication ()
 Destructor, empty.
 

Private Attributes

logging::Logger _log {"m2n::GatherScatterCommunication"}
 
com::PtrCommunication _com
 primary to primary basic communication
 
bool _isConnected
 Global communication is set up or not.
 

Additional Inherited Members

- Public Types inherited from precice::m2n::DistributedCommunication
using SharedPointer = std::shared_ptr<DistributedCommunication>
 
using CommunicationMap = std::map<int, std::vector<int>>
 
- Protected Attributes inherited from precice::m2n::DistributedCommunication
mesh::PtrMesh _mesh
 mesh that dictates the distribution of this mapping
 

Detailed Description

Implements DistributedCommunication by using a gathering/scattering methodology. Arrays of data are always gathered and scattered at the primary. No direct communication between secondary ranks is used. For more details see m2n/DistributedCommunication.hpp.

Definition at line 20 of file GatherScatterCommunication.hpp.

Constructor & Destructor Documentation

◆ GatherScatterCommunication()

precice::m2n::GatherScatterCommunication::GatherScatterCommunication ( com::PtrCommunication com,
mesh::PtrMesh mesh )

Definition at line 19 of file GatherScatterCommunication.cpp.

◆ ~GatherScatterCommunication()

precice::m2n::GatherScatterCommunication::~GatherScatterCommunication ( )
override

Definition at line 28 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ acceptConnection()

void precice::m2n::GatherScatterCommunication::acceptConnection ( const std::string & acceptorName,
const std::string & requesterName )
overridevirtual

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

If several connections are going in to a server, the server has to call this method, while the clients have to call requestConnection().

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

Implements precice::m2n::DistributedCommunication.

Definition at line 40 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

◆ acceptPreConnection()

void precice::m2n::GatherScatterCommunication::acceptPreConnection ( std::string const & acceptorName,
std::string const & requesterName )
overridevirtual

This method has not been implemented yet.

Todo
: Ideally this should not be here

Implements precice::m2n::DistributedCommunication.

Definition at line 209 of file GatherScatterCommunication.cpp.

◆ broadcastReceiveAll()

void precice::m2n::GatherScatterCommunication::broadcastReceiveAll ( std::vector< int > & itemToReceive)
overridevirtual

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

Implements precice::m2n::DistributedCommunication.

Definition at line 228 of file GatherScatterCommunication.cpp.

◆ broadcastReceiveAllMesh()

void precice::m2n::GatherScatterCommunication::broadcastReceiveAllMesh ( )
overridevirtual

Receive mesh partitions per connected rank on remote participant. Not available for GatherScatterCommunication.

Implements precice::m2n::DistributedCommunication.

Definition at line 238 of file GatherScatterCommunication.cpp.

◆ broadcastSend()

void precice::m2n::GatherScatterCommunication::broadcastSend ( int itemToSend)
overridevirtual

Broadcasts an int to connected ranks on remote participant. Not available for GatherScatterCommunication.

Implements precice::m2n::DistributedCommunication.

Definition at line 223 of file GatherScatterCommunication.cpp.

◆ broadcastSendMesh()

void precice::m2n::GatherScatterCommunication::broadcastSendMesh ( )
overridevirtual

Broadcasts a mesh to connected ranks on remote participant. Not available for GatherScatterCommunication.

Implements precice::m2n::DistributedCommunication.

Definition at line 233 of file GatherScatterCommunication.cpp.

◆ closeConnection()

void precice::m2n::GatherScatterCommunication::closeConnection ( )
overridevirtual

Disconnects from communication space, i.e. participant.

This method is called on destruction.

Implements precice::m2n::DistributedCommunication.

Definition at line 58 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

◆ completeSecondaryRanksConnection()

void precice::m2n::GatherScatterCommunication::completeSecondaryRanksConnection ( )
overridevirtual

Completes the secondary connections for both acceptor and requester by updating the vertex list in _mappings.

Implements precice::m2n::DistributedCommunication.

Definition at line 253 of file GatherScatterCommunication.cpp.

◆ gatherAllCommunicationMap()

void precice::m2n::GatherScatterCommunication::gatherAllCommunicationMap ( CommunicationMap & localCommunicationMap)
overridevirtual

Gathers a communication maps from connected ranks on remote participant. Not available for GatherScatterCommunication.

Implements precice::m2n::DistributedCommunication.

Definition at line 248 of file GatherScatterCommunication.cpp.

◆ isConnected()

bool precice::m2n::GatherScatterCommunication::isConnected ( ) const
overridevirtual

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

Implements precice::m2n::DistributedCommunication.

Definition at line 35 of file GatherScatterCommunication.cpp.

◆ receive()

void precice::m2n::GatherScatterCommunication::receive ( precice::span< double > itemsToReceive,
int valueDimension )
overridevirtual

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

Implements precice::m2n::DistributedCommunication.

Definition at line 152 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

◆ requestConnection()

void precice::m2n::GatherScatterCommunication::requestConnection ( const std::string & acceptorName,
const std::string & requesterName )
overridevirtual

Requests connection from participant, which has to call acceptConnection().

If several connections are going in to a server, the clients have to call this method, while the server has to call acceptConnection().

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

Implements precice::m2n::DistributedCommunication.

Definition at line 49 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

◆ requestPreConnection()

void precice::m2n::GatherScatterCommunication::requestPreConnection ( std::string const & acceptorName,
std::string const & requesterName )
overridevirtual

This method has not been implemented yet.

Todo
: Ideally this should not be here

Implements precice::m2n::DistributedCommunication.

Definition at line 216 of file GatherScatterCommunication.cpp.

◆ scatterAllCommunicationMap()

void precice::m2n::GatherScatterCommunication::scatterAllCommunicationMap ( CommunicationMap & localCommunicationMap)
overridevirtual

Scatters a communication map over connected ranks on remote participant. Not available for GatherScatterCommunication.

Implements precice::m2n::DistributedCommunication.

Definition at line 243 of file GatherScatterCommunication.cpp.

◆ send()

void precice::m2n::GatherScatterCommunication::send ( precice::span< double const > itemsToSend,
int valueDimension )
overridevirtual

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

Implements precice::m2n::DistributedCommunication.

Definition at line 100 of file GatherScatterCommunication.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _com

com::PtrCommunication precice::m2n::GatherScatterCommunication::_com
private

primary to primary basic communication

Definition at line 115 of file GatherScatterCommunication.hpp.

◆ _isConnected

bool precice::m2n::GatherScatterCommunication::_isConnected
private

Global communication is set up or not.

Definition at line 118 of file GatherScatterCommunication.hpp.

◆ _log

logging::Logger precice::m2n::GatherScatterCommunication::_log {"m2n::GatherScatterCommunication"}
private

Definition at line 112 of file GatherScatterCommunication.hpp.


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