preCICE v3.1.2
Loading...
Searching...
No Matches
PointToPointCommunication.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <list>
5#include <memory>
6#include <string>
7#include <utility>
8#include <vector>
10#include "com/SharedPointer.hpp"
11#include "logging/Logger.hpp"
12#include "mesh/Mesh.hpp"
14
15namespace precice {
16namespace com {
17class Request;
18} // namespace com
19
20namespace m2n {
33public:
35 mesh::PtrMesh mesh);
36
38
40 bool isConnected() const override;
41
49 void acceptConnection(std::string const &acceptorName,
50 std::string const &requesterName) override;
51
58 void requestConnection(std::string const &acceptorName,
59 std::string const &requesterName) override;
60
69 void acceptPreConnection(std::string const &acceptorName,
70 std::string const &requesterName) override;
71
79 void requestPreConnection(std::string const &acceptorName,
80 std::string const &requesterName) override;
81
84
90 void closeConnection() override;
91
96 void send(precice::span<double const> itemsToSend, int valueDimension = 1) override;
97
102 void receive(precice::span<double> itemsToReceive, int valueDimension = 1) override;
103
105 void broadcastSend(int itemToSend) override;
106
111 void broadcastReceiveAll(std::vector<int> &itemToReceive) override;
112
114 void broadcastSendMesh() override;
115
117 void broadcastReceiveAllMesh() override;
118
120 void scatterAllCommunicationMap(CommunicationMap &localCommunicationMap) override;
121
123 void gatherAllCommunicationMap(CommunicationMap &localCommunicationMap) override;
124
125private:
126 logging::Logger _log{"m2n::PointToPointCommunication"};
127
129
132 void checkBufferedRequests(bool blocking);
133
135
137
141
157
163
175
181
182 bool _isConnected = false;
183
187};
188} // namespace m2n
189} // namespace precice
This class provides a lightweight logger.
Definition Logger.hpp:16
Interface for all distributed solver to solver communication classes.
Point-to-point communication implementation of DistributedCommunication.
void scatterAllCommunicationMap(CommunicationMap &localCommunicationMap) override
Scatters a communication map over connected ranks on remote participant.
PointToPointCommunication(com::PtrCommunicationFactory communicationFactory, mesh::PtrMesh mesh)
void broadcastSendMesh() override
Broadcasts a mesh to connected ranks on remote participant.
void gatherAllCommunicationMap(CommunicationMap &localCommunicationMap) override
Gathers a communication maps from connected ranks on remote participant.
void broadcastSend(int itemToSend) override
Broadcasts an int to connected ranks on remote participant.
bool isConnected() const override
Returns true, if a connection to a remote participant has been established.
std::vector< Mapping > _mappings
Local (for process rank in the current participant) vector of mappings (one to service each point-to-...
std::vector< ConnectionData > _connectionDataVector
Local (for process rank in the current participant) vector of ConnectionData (one to service each poi...
void acceptPreConnection(std::string const &acceptorName, std::string const &requesterName) override
Accepts connection from participant, which has to call requestPreConnection(). Only initial connectio...
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 ...
std::list< std::pair< std::shared_ptr< com::Request >, std::shared_ptr< std::vector< double > > > > bufferedRequests
void broadcastReceiveAll(std::vector< int > &itemToReceive) override
Receives an int per connected rank on remote participant @para[out] itemToReceive received ints from ...
void requestPreConnection(std::string const &acceptorName, std::string const &requesterName) override
Requests connection from participant, which has to call acceptConnection(). Only initial connection i...
void completeSecondaryRanksConnection() override
Completes the secondary connections for both acceptor and requester by updating the vertex list in _m...
void checkBufferedRequests(bool blocking)
Checks all stored requests for completion and removes associated buffers.
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().
com::PtrCommunication _communication
Communication class used for this PointToPointCommunication.
void closeConnection() override
Disconnects from communication space, i.e. participant.
void broadcastReceiveAllMesh() override
Receive mesh partitions per connected rank on remote 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 rem...
A C++ 11 implementation of the non-owning C++20 std::span type.
Definition span.hpp:284
Main namespace of the precice library.
this data structure is used to store m2n communication information for the 1 step of bounding box ini...