preCICE v3.1.1
Loading...
Searching...
No Matches
DistributedCommunication.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <vector>
5#include "mesh/Mesh.hpp"
7#include "precice/span.hpp"
8
9namespace precice {
10namespace m2n {
11
34public:
36
38 : _mesh(mesh)
39 {
40 }
41
44
46 virtual bool isConnected() const = 0;
47
54 virtual void acceptConnection(
55 const std::string &acceptorName,
56 const std::string &requesterName) = 0;
57
64 virtual void requestConnection(
65 const std::string &acceptorName,
66 const std::string &requesterName) = 0;
67
76 virtual void acceptPreConnection(
77 std::string const &acceptorName,
78 std::string const &requesterName) = 0;
79
89 std::string const &acceptorName,
90 std::string const &requesterName) = 0;
91
92 /* @brief Completes the secondary connections for both acceptor and requester by updating
93 * the vertex list in _mappings.
94 *
95 * @pre acceptPreConnection or requestPreConnection has been called.
96 * @pre accept/requestConnection has not been called
97 * @post the m2n connection is ready to use
98 */
100
106 virtual void closeConnection() = 0;
107
109 virtual void send(precice::span<double const> itemsToSend, int valueDimension) = 0;
110
112 virtual void receive(precice::span<double> itemsToReceive, int valueDimension) = 0;
113
114 /*
115 * A mapping from remote local ranks to the IDs that must be communicated
116 */
118
120 virtual void broadcastSend(int itemToSend) = 0;
121
126 virtual void broadcastReceiveAll(std::vector<int> &itemToReceive) = 0;
127
129 virtual void broadcastSendMesh() = 0;
130
132 virtual void broadcastReceiveAllMesh() = 0;
133
135 virtual void scatterAllCommunicationMap(CommunicationMap &localCommunicationMap) = 0;
136
138 virtual void gatherAllCommunicationMap(CommunicationMap &localCommunicationMap) = 0;
139
140protected:
147};
148
149} // namespace m2n
150} // namespace precice
Interface for all distributed solver to solver communication classes.
virtual void requestConnection(const std::string &acceptorName, const std::string &requesterName)=0
Connects to another participant, which has to call acceptConnection().
virtual void scatterAllCommunicationMap(CommunicationMap &localCommunicationMap)=0
Scatters a communication map over connected ranks on remote participant.
virtual void broadcastSendMesh()=0
Broadcasts a mesh to connected ranks on remote participant.
virtual bool isConnected() const =0
Returns true, if a connection to a remote participant has been setup.
virtual void broadcastSend(int itemToSend)=0
Broadcasts an int to connected ranks on remote participant.
virtual void broadcastReceiveAllMesh()=0
Receive mesh partitions per connected rank on remote participant.
virtual void completeSecondaryRanksConnection()=0
mesh::PtrMesh _mesh
mesh that dictates the distribution of this mapping
virtual void closeConnection()=0
Disconnects from communication space, i.e. participant.
virtual void broadcastReceiveAll(std::vector< int > &itemToReceive)=0
Receives an int per connected rank on remote participant @para[out] itemToReceive received ints from ...
virtual void acceptConnection(const std::string &acceptorName, const std::string &requesterName)=0
Connects to another participant, which has to call requestConnection().
virtual void receive(precice::span< double > itemsToReceive, int valueDimension)=0
All ranks receive an array of doubles (different for each rank).
virtual ~DistributedCommunication()
Destructor, empty.
virtual void requestPreConnection(std::string const &acceptorName, std::string const &requesterName)=0
Connects to another participant, which has to call acceptPreConnection(). Exchanged vertex list is no...
virtual void acceptPreConnection(std::string const &acceptorName, std::string const &requesterName)=0
Connects to another participant, which has to call requestPreConnection(). Exchanged vertex list is n...
virtual void send(precice::span< double const > itemsToSend, int valueDimension)=0
Sends an array of double values from all ranks (different for each rank).
virtual void gatherAllCommunicationMap(CommunicationMap &localCommunicationMap)=0
Gathers a communication maps from connected ranks on remote participant.
A C++ 11 implementation of the non-owning C++20 std::span type.
Definition span.hpp:284
Main namespace of the precice library.