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

M2N communication class. This layer is necessary since communication between two participants can be working via several meshes, each possibly with a different decomposition. In principle, this class is only a map from meshes to DistributedCommunications. More...

#include <M2N.hpp>

Collaboration diagram for precice::m2n::M2N:
[legend]

Public Member Functions

 M2N (com::PtrCommunication intraComm, DistributedComFactory::SharedPointer distrFactory, bool useOnlyPrimaryCom=false, bool useTwoLevelInit=false)
 
 ~M2N ()
 Destructor, empty.
 
bool isConnected ()
 Returns true, if a connection to a remote participant has been setup.
 
void acceptPrimaryRankConnection (const std::string &acceptorName, const std::string &requesterName)
 Connects to another participant, which has to call requestConnection().
 
void requestPrimaryRankConnection (const std::string &acceptorName, const std::string &requesterName)
 Connects to another participant, which has to call acceptConnection().
 
void acceptSecondaryRanksConnection (const std::string &acceptorName, const std::string &requesterName)
 Connects to another participant, which has to call requestConnection().
 
void requestSecondaryRanksConnection (const std::string &acceptorName, const std::string &requesterName)
 Connects to another participant, which has to call acceptConnection().
 
void acceptSecondaryRanksPreConnection (const std::string &acceptorName, const std::string &requesterName)
 
void requestSecondaryRanksPreConnection (const std::string &acceptorName, const std::string &requesterName)
 
void completeSecondaryRanksConnection ()
 
void prepareEstablishment (const std::string &acceptorName, const std::string &requesterName)
 prepares to establish the connections
 
void cleanupEstablishment (const std::string &acceptorName, const std::string &requesterName)
 cleans-up to establish the connections
 
void closeConnection ()
 Disconnects from communication space, i.e. participant.
 
void closePrimaryRankConnection ()
 Disconnects the primary connection.
 
void closeDistributedConnections ()
 Disconnects all connections of the DistributedCommunication.
 
com::PtrCommunication getPrimaryRankCommunication ()
 Get the basic communication between the 2 primary ranks.
 
void createDistributedCommunication (const mesh::PtrMesh &mesh)
 Creates a new distributes communication for that mesh, stores the pointer in _distComs.
 
void send (precice::span< double const > itemsToSend, int meshID, int valueDimension)
 Sends an array of double values from all ranks (different for each rank).
 
void send (bool itemToSend)
 The primary rank sends a bool to the other primary rank, for performance reasons, we neglect the gathering and checking step.
 
void send (double itemToSend)
 The primary rank sends a double to the other primary rank, for performance reasons, we neglect the gathering and checking step.
 
void send (precice::span< double const > itemsToSend)
 The primary rank sends a span of doubles to the other primary rank, for performance reasons, we neglect the gathering and checking step.
 
void send (int itemToSend)
 The primary rank sends an int to the other primary rank, for performance reasons, we neglect the gathering and checking step.
 
void broadcastSendMesh (mesh::Mesh &mesh)
 Broadcasts a mesh to connected ranks on remote participant (concerning the given mesh)
 
void scatterAllCommunicationMap (std::map< int, std::vector< int > > &localCommunicationMap, mesh::Mesh &mesh)
 Scatters a communication map over connected ranks on remote participant (concerning the given mesh)
 
void broadcastSend (int itemToSend, mesh::Mesh &mesh)
 Broadcasts an int to connected ranks on remote participant (concerning the given mesh)
 
void receive (precice::span< double > itemsToReceive, int meshID, int valueDimension)
 
void receive (bool &itemToReceive)
 All ranks receive a bool (the same for each rank).
 
void receive (double &itemToReceive)
 All ranks receive a double (the same for each rank).
 
void receive (precice::span< double > itemsToReceive)
 All ranks receive a double values (the same for each rank).
 
void receive (int &itemToReceive)
 All ranks receive an int (the same for each rank).
 
void broadcastReceiveAllMesh (mesh::Mesh &mesh)
 Receive mesh partitions per connected rank on remote participant (concerning the given mesh)
 
void gatherAllCommunicationMap (std::map< int, std::vector< int > > &localCommunicationMap, mesh::Mesh &mesh)
 Gathers a communication maps from connected ranks on remote participant (concerning the given mesh)
 
void broadcastReceiveAll (std::vector< int > &itemToReceive, mesh::Mesh &mesh)
 Receives an int per connected rank on remote participant (concerning the given mesh) @para[out] itemToReceive received ints from remote ranks are stored with the sender rank order.
 
bool usesTwoLevelInitialization ()
 

Private Attributes

logging::Logger _log {"m2n::M2N"}
 
std::map< int, DistributedCommunication::SharedPointer_distComs
 mesh::getID() -> Pointer to distributed communication
 
com::PtrCommunication _intraComm
 
DistributedComFactory::SharedPointer _distrFactory
 
bool _isPrimaryRankConnected = false
 
bool _areSecondaryRanksConnected = false
 
bool _useOnlyPrimaryCom = false
 between two serial participants, only use the primary com and no secondary com
 
bool _useTwoLevelInit = false
 use the two-level initialization concept
 

Friends

struct WhiteboxAccessor
 

Detailed Description

M2N communication class. This layer is necessary since communication between two participants can be working via several meshes, each possibly with a different decomposition. In principle, this class is only a map from meshes to DistributedCommunications.

Definition at line 31 of file M2N.hpp.

Constructor & Destructor Documentation

◆ M2N()

precice::m2n::M2N::M2N ( com::PtrCommunication intraComm,
DistributedComFactory::SharedPointer distrFactory,
bool useOnlyPrimaryCom = false,
bool useTwoLevelInit = false )

Definition at line 21 of file M2N.cpp.

◆ ~M2N()

precice::m2n::M2N::~M2N ( )

Destructor, empty.

Definition at line 29 of file M2N.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ acceptPrimaryRankConnection()

void precice::m2n::M2N::acceptPrimaryRankConnection ( const std::string & acceptorName,
const std::string & requesterName )

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

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

Definition at line 41 of file M2N.cpp.

Here is the call graph for this function:

◆ acceptSecondaryRanksConnection()

void precice::m2n::M2N::acceptSecondaryRanksConnection ( const std::string & acceptorName,
const std::string & requesterName )

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

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

Definition at line 77 of file M2N.cpp.

◆ acceptSecondaryRanksPreConnection()

void precice::m2n::M2N::acceptSecondaryRanksPreConnection ( const std::string & acceptorName,
const std::string & requesterName )

Same as acceptSecondaryRanksConnection except this only creates the channels, no vertex list needed!

Definition at line 125 of file M2N.cpp.

◆ broadcastReceiveAll()

void precice::m2n::M2N::broadcastReceiveAll ( std::vector< int > & itemToReceive,
mesh::Mesh & mesh )

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

Definition at line 370 of file M2N.cpp.

Here is the call graph for this function:

◆ broadcastReceiveAllMesh()

void precice::m2n::M2N::broadcastReceiveAllMesh ( mesh::Mesh & mesh)

Receive mesh partitions per connected rank on remote participant (concerning the given mesh)

Definition at line 379 of file M2N.cpp.

Here is the call graph for this function:

◆ broadcastSend()

void precice::m2n::M2N::broadcastSend ( int itemToSend,
mesh::Mesh & mesh )

Broadcasts an int to connected ranks on remote participant (concerning the given mesh)

Definition at line 287 of file M2N.cpp.

Here is the call graph for this function:

◆ broadcastSendMesh()

void precice::m2n::M2N::broadcastSendMesh ( mesh::Mesh & mesh)

Broadcasts a mesh to connected ranks on remote participant (concerning the given mesh)

Definition at line 266 of file M2N.cpp.

Here is the call graph for this function:

◆ cleanupEstablishment()

void precice::m2n::M2N::cleanupEstablishment ( const std::string & acceptorName,
const std::string & requesterName )

cleans-up to establish the connections

This should be called after calling the accept and request methods. Calling this function forwards the call to the configured primary communication.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.
See also
com::Communication::cleanupEstablishment()
prepareEstablishment()

Definition at line 118 of file M2N.cpp.

◆ closeConnection()

void precice::m2n::M2N::closeConnection ( )

Disconnects from communication space, i.e. participant.

Calls closePrimaryRankConnection() and closeSecondaryRanksConnection() This method is called on destruction.

Definition at line 161 of file M2N.cpp.

Here is the call graph for this function:

◆ closeDistributedConnections()

void precice::m2n::M2N::closeDistributedConnections ( )

Disconnects all connections of the DistributedCommunication.

Definition at line 180 of file M2N.cpp.

◆ closePrimaryRankConnection()

void precice::m2n::M2N::closePrimaryRankConnection ( )

Disconnects the primary connection.

Definition at line 168 of file M2N.cpp.

Here is the call graph for this function:

◆ completeSecondaryRanksConnection()

void precice::m2n::M2N::completeSecondaryRanksConnection ( )

Definition at line 153 of file M2N.cpp.

◆ createDistributedCommunication()

void precice::m2n::M2N::createDistributedCommunication ( const mesh::PtrMesh & mesh)

Creates a new distributes communication for that mesh, stores the pointer in _distComs.

Definition at line 201 of file M2N.cpp.

◆ gatherAllCommunicationMap()

void precice::m2n::M2N::gatherAllCommunicationMap ( std::map< int, std::vector< int > > & localCommunicationMap,
mesh::Mesh & mesh )

Gathers a communication maps from connected ranks on remote participant (concerning the given mesh)

Definition at line 390 of file M2N.cpp.

Here is the call graph for this function:

◆ getPrimaryRankCommunication()

com::PtrCommunication precice::m2n::M2N::getPrimaryRankCommunication ( )

Get the basic communication between the 2 primary ranks.

Todo
maybe it would be a nicer design to not offer this

Definition at line 195 of file M2N.cpp.

Here is the call graph for this function:

◆ isConnected()

bool precice::m2n::M2N::isConnected ( )

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

Definition at line 36 of file M2N.cpp.

◆ prepareEstablishment()

void precice::m2n::M2N::prepareEstablishment ( const std::string & acceptorName,
const std::string & requesterName )

prepares to establish the connections

This should be called before calling the accept and request methods. Calling this function forwards the call to the configured primary communication.

Parameters
[in]acceptorNameName of calling participant.
[in]requesterNameName of remote participant to connect to.
See also
com::Communication::prepareEstablishment()
cleanupEstablishment()

Definition at line 111 of file M2N.cpp.

◆ receive() [1/5]

void precice::m2n::M2N::receive ( bool & itemToReceive)

All ranks receive a bool (the same for each rank).

Definition at line 324 of file M2N.cpp.

Here is the call graph for this function:

◆ receive() [2/5]

void precice::m2n::M2N::receive ( double & itemToReceive)

All ranks receive a double (the same for each rank).

Definition at line 336 of file M2N.cpp.

Here is the call graph for this function:

◆ receive() [3/5]

void precice::m2n::M2N::receive ( int & itemToReceive)

All ranks receive an int (the same for each rank).

Definition at line 360 of file M2N.cpp.

Here is the call graph for this function:

◆ receive() [4/5]

void precice::m2n::M2N::receive ( precice::span< double > itemsToReceive)

All ranks receive a double values (the same for each rank).

Definition at line 348 of file M2N.cpp.

Here is the call graph for this function:

◆ receive() [5/5]

void precice::m2n::M2N::receive ( precice::span< double > itemsToReceive,
int meshID,
int valueDimension )

All ranks receive an array of doubles (different for each rank). The values received can be gradient data Gradient dimension : 0: dx-values, 1: dy-values, 2:dz-values

Definition at line 296 of file M2N.cpp.

Here is the call graph for this function:

◆ requestPrimaryRankConnection()

void precice::m2n::M2N::requestPrimaryRankConnection ( const std::string & acceptorName,
const std::string & requesterName )

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

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

Definition at line 59 of file M2N.cpp.

Here is the call graph for this function:

◆ requestSecondaryRanksConnection()

void precice::m2n::M2N::requestSecondaryRanksConnection ( const std::string & acceptorName,
const std::string & requesterName )

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

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

Definition at line 94 of file M2N.cpp.

◆ requestSecondaryRanksPreConnection()

void precice::m2n::M2N::requestSecondaryRanksPreConnection ( const std::string & acceptorName,
const std::string & requesterName )

Same as requestSecondaryRanksConnection except this only creates the channels, no vertex list needed!

Definition at line 139 of file M2N.cpp.

◆ scatterAllCommunicationMap()

void precice::m2n::M2N::scatterAllCommunicationMap ( std::map< int, std::vector< int > > & localCommunicationMap,
mesh::Mesh & mesh )

Scatters a communication map over connected ranks on remote participant (concerning the given mesh)

Definition at line 277 of file M2N.cpp.

Here is the call graph for this function:

◆ send() [1/5]

void precice::m2n::M2N::send ( bool itemToSend)

The primary rank sends a bool to the other primary rank, for performance reasons, we neglect the gathering and checking step.

Definition at line 234 of file M2N.cpp.

Here is the call graph for this function:

◆ send() [2/5]

void precice::m2n::M2N::send ( double itemToSend)

The primary rank sends a double to the other primary rank, for performance reasons, we neglect the gathering and checking step.

Definition at line 242 of file M2N.cpp.

Here is the call graph for this function:

◆ send() [3/5]

void precice::m2n::M2N::send ( int itemToSend)

The primary rank sends an int to the other primary rank, for performance reasons, we neglect the gathering and checking step.

Definition at line 258 of file M2N.cpp.

Here is the call graph for this function:

◆ send() [4/5]

void precice::m2n::M2N::send ( precice::span< double const > itemsToSend)

The primary rank sends a span of doubles to the other primary rank, for performance reasons, we neglect the gathering and checking step.

Definition at line 250 of file M2N.cpp.

Here is the call graph for this function:

◆ send() [5/5]

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

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

Definition at line 208 of file M2N.cpp.

Here is the call graph for this function:

◆ usesTwoLevelInitialization()

bool precice::m2n::M2N::usesTwoLevelInitialization ( )
inline

Definition at line 218 of file M2N.hpp.

Friends And Related Symbol Documentation

◆ WhiteboxAccessor

friend struct WhiteboxAccessor
friend

Definition at line 252 of file M2N.hpp.

Member Data Documentation

◆ _areSecondaryRanksConnected

bool precice::m2n::M2N::_areSecondaryRanksConnected = false
private

Definition at line 235 of file M2N.hpp.

◆ _distComs

std::map<int, DistributedCommunication::SharedPointer> precice::m2n::M2N::_distComs
private

mesh::getID() -> Pointer to distributed communication

Definition at line 227 of file M2N.hpp.

◆ _distrFactory

DistributedComFactory::SharedPointer precice::m2n::M2N::_distrFactory
private

Definition at line 231 of file M2N.hpp.

◆ _intraComm

com::PtrCommunication precice::m2n::M2N::_intraComm
private

Definition at line 229 of file M2N.hpp.

◆ _isPrimaryRankConnected

bool precice::m2n::M2N::_isPrimaryRankConnected = false
private

Definition at line 233 of file M2N.hpp.

◆ _log

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

Definition at line 224 of file M2N.hpp.

◆ _useOnlyPrimaryCom

bool precice::m2n::M2N::_useOnlyPrimaryCom = false
private

between two serial participants, only use the primary com and no secondary com

Definition at line 246 of file M2N.hpp.

◆ _useTwoLevelInit

bool precice::m2n::M2N::_useTwoLevelInit = false
private

use the two-level initialization concept

Definition at line 249 of file M2N.hpp.


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