preCICE v3.1.2
|
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>
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 |
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.
precice::m2n::M2N::M2N | ( | com::PtrCommunication | intraComm, |
DistributedComFactory::SharedPointer | distrFactory, | ||
bool | useOnlyPrimaryCom = false, | ||
bool | useTwoLevelInit = false ) |
precice::m2n::M2N::~M2N | ( | ) |
void precice::m2n::M2N::acceptPrimaryRankConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::acceptSecondaryRanksConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::acceptSecondaryRanksPreConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::broadcastReceiveAll | ( | std::vector< int > & | itemToReceive, |
mesh::Mesh & | mesh ) |
void precice::m2n::M2N::broadcastReceiveAllMesh | ( | mesh::Mesh & | mesh | ) |
void precice::m2n::M2N::broadcastSend | ( | int | itemToSend, |
mesh::Mesh & | mesh ) |
void precice::m2n::M2N::broadcastSendMesh | ( | mesh::Mesh & | mesh | ) |
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.
[in] | acceptorName | Name of calling participant. |
[in] | requesterName | Name of remote participant to connect to. |
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.
void precice::m2n::M2N::closeDistributedConnections | ( | ) |
Disconnects all connections of the DistributedCommunication.
void precice::m2n::M2N::closePrimaryRankConnection | ( | ) |
void precice::m2n::M2N::completeSecondaryRanksConnection | ( | ) |
void precice::m2n::M2N::createDistributedCommunication | ( | const mesh::PtrMesh & | mesh | ) |
void precice::m2n::M2N::gatherAllCommunicationMap | ( | std::map< int, std::vector< int > > & | localCommunicationMap, |
mesh::Mesh & | mesh ) |
com::PtrCommunication precice::m2n::M2N::getPrimaryRankCommunication | ( | ) |
bool precice::m2n::M2N::isConnected | ( | ) |
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.
[in] | acceptorName | Name of calling participant. |
[in] | requesterName | Name of remote participant to connect to. |
void precice::m2n::M2N::receive | ( | bool & | itemToReceive | ) |
void precice::m2n::M2N::receive | ( | double & | itemToReceive | ) |
void precice::m2n::M2N::receive | ( | int & | itemToReceive | ) |
void precice::m2n::M2N::receive | ( | precice::span< double > | itemsToReceive | ) |
void precice::m2n::M2N::receive | ( | precice::span< double > | itemsToReceive, |
int | meshID, | ||
int | valueDimension ) |
void precice::m2n::M2N::requestPrimaryRankConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::requestSecondaryRanksConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::requestSecondaryRanksPreConnection | ( | const std::string & | acceptorName, |
const std::string & | requesterName ) |
void precice::m2n::M2N::scatterAllCommunicationMap | ( | std::map< int, std::vector< int > > & | localCommunicationMap, |
mesh::Mesh & | mesh ) |
void precice::m2n::M2N::send | ( | bool | itemToSend | ) |
void precice::m2n::M2N::send | ( | double | itemToSend | ) |
void precice::m2n::M2N::send | ( | int | itemToSend | ) |
void precice::m2n::M2N::send | ( | precice::span< double const > | itemsToSend | ) |
void precice::m2n::M2N::send | ( | precice::span< double const > | itemsToSend, |
int | meshID, | ||
int | valueDimension ) |
|
inline |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |