3#include <boost/range/adaptor/map.hpp>
25 double timeWindowSize,
32 :
BaseCouplingScheme(maxTime, maxTimeWindows, timeWindowSize, localParticipant, minIterations, maxIterations, Implicit, dtMethod),
33 _m2ns(
std::move(m2ns)), _controller(controller), _isController(controller == localParticipant)
43 for (
auto &sendExchange :
_sendDataVector | boost::adaptors::map_values) {
55 for (
const auto &m2nPair :
_m2ns) {
118 PRECICE_DEBUG(
"Initial data is exchanged in MultiCouplingScheme");
153 for (
const auto &m2n :
_m2ns | boost::adaptors::map_values) {
171 bool requiresInitialization,
172 bool exchangeSubsteps,
183 bool requiresInitialization,
184 bool exchangeSubsteps,
#define PRECICE_DEBUG(...)
#define PRECICE_ASSERT(...)
Abstract base class for standard coupling schemes.
void initializeWithZeroInitialData(const DataMap &receiveData)
Initializes storage in receiveData as zero.
void determineInitialReceive(DataMap &receiveData)
Sets _receivesInitializedData, if receiveData requires initialization.
void determineInitialSend(DataMap &sendData)
Sets _sendsInitializedData, if sendData requires initialization.
void notifyDataHasBeenReceived()
Used to set flag after data has been received using receiveData().
void sendData(const m2n::PtrM2N &m2n, const DataMap &sendData)
Sends data sendDataIDs given in mapCouplingData with communication.
void storeIteration()
used for storing all Data at end of doImplicitStep for later reference.
bool sendsInitializedData() const override final
Getter for _sendsInitializedData.
bool isImplicitCouplingScheme() const override
Function to determine whether coupling scheme is an implicit coupling scheme.
void sendConvergence(const m2n::PtrM2N &m2n)
sends convergence to other participant via m2n
bool hasConverged() const override
Checks if the implicit cplscheme has converged.
void moveToNextWindow()
finalizes this window's data and initializes data for next window.
void doImplicitStep()
perform a coupling iteration
bool receivesInitializedData() const
Getter for _receivesInitializedData.
PtrCouplingData addCouplingData(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps, CouplingData::Direction direction)
Adds CouplingData with given properties to this BaseCouplingScheme and returns a pointer to the Coupl...
DataMap _allData
All send and receive data as a map "data ID -> data".
std::string localParticipant() const override final
Returns the name of the local participant.
void receiveConvergence(const m2n::PtrM2N &m2n)
receives convergence from other participant via m2n
void setDoesFirstStep(bool doesFirstStep)
Setter for _doesFirstStep.
void receiveData(const m2n::PtrM2N &m2n, const DataMap &receiveData)
Receives data receiveDataIDs given in mapCouplingData with communication.
std::string _controller
name of the controller participant
std::map< std::string, m2n::PtrM2N > _m2ns
A vector of m2ns. A m2n is a communication device to the other coupling participant.
void addDataToSend(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps, const std::string &to)
Adds data to be sent on data exchange and possibly be modified during coupling iterations.
void determineInitialDataExchange() override
Determines which data is initialized and therefore has to be exchanged during initialize.
void initializeReceiveDataStorage() override final
Functions needed for initialize()
void exchangeInitialData() override final
implements functionality for initialize in base class.
bool hasAnySendData() override final
void exchangeFirstData() override final
Functions needed for advance()
MultiCouplingScheme(double maxTime, int maxTimeWindows, double timeWindowSize, const std::string &localParticipant, std::map< std::string, m2n::PtrM2N > m2ns, constants::TimesteppingMethod dtMethod, const std::string &controller, int minIterations, int maxIterations)
Constructor.
void exchangeSecondData() override final
Exchanges the second set of data.
std::map< std::string, DataMap > _sendDataVector
A vector of all data to be sent.
bool _isController
if this is the controller or not
std::vector< std::string > getCouplingPartners() const override final
Returns list of all coupling partners.
void addDataToReceive(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps, const std::string &from)
Adds data to be received on data exchange.
DataMap & getAccelerationData() override final
interface to provide accelerated data, depending on coupling scheme being used
std::map< std::string, DataMap > _receiveDataVector
A vector of all data to be received.
T emplace_back(T... args)
contains implementations of coupling schemes for coupled simulations.