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

Point-to-point communication implementation of DistributedCommunication. More...

#include <PointToPointCommunication.hpp>

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

Classes

struct  ConnectionData
 this data structure is used to store m2n communication information for the 1 step of bounding box initialization. It stores: More...
 
struct  Mapping
 Defines mapping between: More...
 

Public Member Functions

 PointToPointCommunication (com::PtrCommunicationFactory communicationFactory, mesh::PtrMesh mesh)
 
 ~PointToPointCommunication () override
 
bool isConnected () const override
 Returns true, if a connection to a remote participant has been established.
 
void acceptConnection (std::string const &acceptorName, std::string const &requesterName) override
 Accepts connection from participant, which has to call requestConnection().
 
void requestConnection (std::string const &acceptorName, std::string const &requesterName) override
 Requests connection from participant, which has to call acceptConnection().
 
void acceptPreConnection (std::string const &acceptorName, std::string const &requesterName) override
 Accepts connection from participant, which has to call requestPreConnection(). Only initial connection is created.
 
void requestPreConnection (std::string const &acceptorName, std::string const &requesterName) override
 Requests connection from participant, which has to call acceptConnection(). Only initial connection is created.
 
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=1) override
 Sends a subset of local double values corresponding to local indices deduced from the current and remote vertex distributions.
 
void receive (precice::span< double > itemsToReceive, int valueDimension=1) override
 Receives a subset of local double values corresponding to local indices deduced from the current and remote vertex distributions.
 
void broadcastSend (int itemToSend) override
 Broadcasts an int to connected ranks on remote participant.
 
void broadcastReceiveAll (std::vector< int > &itemToReceive) override
 Receives an int per connected rank on remote participant @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.
 
void broadcastReceiveAllMesh () override
 Receive mesh partitions per connected rank on remote participant.
 
void scatterAllCommunicationMap (CommunicationMap &localCommunicationMap) override
 Scatters a communication map over connected ranks on remote participant.
 
void gatherAllCommunicationMap (CommunicationMap &localCommunicationMap) override
 Gathers a communication maps from connected ranks on remote participant.
 
- Public Member Functions inherited from precice::m2n::DistributedCommunication
 DistributedCommunication (mesh::PtrMesh mesh)
 
virtual ~DistributedCommunication ()
 Destructor, empty.
 

Private Member Functions

void checkBufferedRequests (bool blocking)
 Checks all stored requests for completion and removes associated buffers.
 

Private Attributes

logging::Logger _log {"m2n::PointToPointCommunication"}
 
com::PtrCommunicationFactory _communicationFactory
 
com::PtrCommunication _communication
 Communication class used for this PointToPointCommunication.
 
std::vector< Mapping_mappings
 Local (for process rank in the current participant) vector of mappings (one to service each point-to-point connection).
 
std::vector< ConnectionData_connectionDataVector
 Local (for process rank in the current participant) vector of ConnectionData (one to service each point-to-point connection).
 
bool _isConnected = false
 
std::list< std::pair< std::shared_ptr< com::Request >, std::shared_ptr< std::vector< double > > > > bufferedRequests
 

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

Point-to-point communication implementation of DistributedCommunication.

Direct communication of local data subsets is performed between processes of coupled participants. The two supported implementations of direct communication are SocketCommunication and MPIPortsCommunication which can be supplied via their corresponding instantiation factories SocketCommunicationFactory and MPIPortsCommunicationFactory.

For the detailed implementation documentation refer to PointToPointCommunication.cpp.

Definition at line 32 of file PointToPointCommunication.hpp.

Constructor & Destructor Documentation

◆ PointToPointCommunication()

precice::m2n::PointToPointCommunication::PointToPointCommunication ( com::PtrCommunicationFactory communicationFactory,
mesh::PtrMesh mesh )

Definition at line 309 of file PointToPointCommunication.cpp.

◆ ~PointToPointCommunication()

precice::m2n::PointToPointCommunication::~PointToPointCommunication ( )
override

Definition at line 317 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ acceptConnection()

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

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

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

Implements precice::m2n::DistributedCommunication.

Definition at line 328 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ acceptPreConnection()

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

Accepts connection from participant, which has to call requestPreConnection(). Only initial connection is created.

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

Implements precice::m2n::DistributedCommunication.

Definition at line 424 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ broadcastReceiveAll()

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

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

Implements precice::m2n::DistributedCommunication.

Definition at line 665 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ broadcastReceiveAllMesh()

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

Receive mesh partitions per connected rank on remote participant.

Implements precice::m2n::DistributedCommunication.

Definition at line 682 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ broadcastSend()

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

Broadcasts an int to connected ranks on remote participant.

Implements precice::m2n::DistributedCommunication.

Definition at line 658 of file PointToPointCommunication.cpp.

◆ broadcastSendMesh()

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

Broadcasts a mesh to connected ranks on remote participant.

Implements precice::m2n::DistributedCommunication.

Definition at line 675 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ checkBufferedRequests()

void precice::m2n::PointToPointCommunication::checkBufferedRequests ( bool blocking)
private

Checks all stored requests for completion and removes associated buffers.

Parameters
[in]blockingFalse means that the function returns, even when there are requests left.

Definition at line 704 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ closeConnection()

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

Disconnects from communication space, i.e. participant.

This method is called on destruction.

Implements precice::m2n::DistributedCommunication.

Definition at line 596 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ completeSecondaryRanksConnection()

void precice::m2n::PointToPointCommunication::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 587 of file PointToPointCommunication.cpp.

◆ gatherAllCommunicationMap()

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

Gathers a communication maps from connected ranks on remote participant.

Implements precice::m2n::DistributedCommunication.

Definition at line 696 of file PointToPointCommunication.cpp.

◆ isConnected()

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

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

Implements precice::m2n::DistributedCommunication.

Definition at line 323 of file PointToPointCommunication.cpp.

◆ receive()

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

Receives a subset of local double values corresponding to local indices deduced from the current and remote vertex distributions.

Implements precice::m2n::DistributedCommunication.

Definition at line 632 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ requestConnection()

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

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

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

Implements precice::m2n::DistributedCommunication.

Definition at line 455 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ requestPreConnection()

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

Requests connection from participant, which has to call acceptConnection(). Only initial connection is created.

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

Implements precice::m2n::DistributedCommunication.

Definition at line 557 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

◆ scatterAllCommunicationMap()

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

Scatters a communication map over connected ranks on remote participant.

Implements precice::m2n::DistributedCommunication.

Definition at line 689 of file PointToPointCommunication.cpp.

◆ send()

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

Sends a subset of local double values corresponding to local indices deduced from the current and remote vertex distributions.

Implements precice::m2n::DistributedCommunication.

Definition at line 611 of file PointToPointCommunication.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _communication

com::PtrCommunication precice::m2n::PointToPointCommunication::_communication
private

Communication class used for this PointToPointCommunication.

A Communication object represents all connections to all ranks made by this P2P instance.

Definition at line 140 of file PointToPointCommunication.hpp.

◆ _communicationFactory

com::PtrCommunicationFactory precice::m2n::PointToPointCommunication::_communicationFactory
private

Definition at line 134 of file PointToPointCommunication.hpp.

◆ _connectionDataVector

std::vector<ConnectionData> precice::m2n::PointToPointCommunication::_connectionDataVector
private

Local (for process rank in the current participant) vector of ConnectionData (one to service each point-to-point connection).

Definition at line 180 of file PointToPointCommunication.hpp.

◆ _isConnected

bool precice::m2n::PointToPointCommunication::_isConnected = false
private

Definition at line 182 of file PointToPointCommunication.hpp.

◆ _log

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

Definition at line 126 of file PointToPointCommunication.hpp.

◆ _mappings

std::vector<Mapping> precice::m2n::PointToPointCommunication::_mappings
private

Local (for process rank in the current participant) vector of mappings (one to service each point-to-point connection).

Definition at line 162 of file PointToPointCommunication.hpp.

◆ bufferedRequests

std::list<std::pair<std::shared_ptr<com::Request>, std::shared_ptr<std::vector<double> > > > precice::m2n::PointToPointCommunication::bufferedRequests
private

Definition at line 186 of file PointToPointCommunication.hpp.


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