1#include <boost/range/adaptor/map.hpp>
24 double timeWindowSize,
33 :
BiCouplingScheme(maxTime, maxTimeWindows, timeWindowSize, firstParticipant, secondParticipant, localParticipant,
std::move(m2n), minIterations, maxIterations, cplMode, dtMethod)
51 double timeWindowSize,
58 :
SerialCouplingScheme(maxTime, maxTimeWindows, timeWindowSize, firstParticipant, secondParticipant, localParticipant,
std::move(m2n), dtMethod, cplMode, UNDEFINED_MAX_ITERATIONS, UNDEFINED_MAX_ITERATIONS){};
83 PRECICE_CHECK(dt ==
getTimeWindowSize(),
"May only use a larger time window size in the first iteration of the window. Otherwise old time window size must equal new time window size.");
138 PRECICE_DEBUG(
"Perform acceleration (only second participant)...");
216 for (
auto cpldata :
getReceiveData() | boost::adaptors::map_values) {
217 idata.
add(cpldata->getDataID(), isSecond);
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
void initializeWithZeroInitialData(const DataMap &receiveData)
Initializes storage in receiveData as zero.
void setTimeWindowSize(double timeWindowSize)
Setter for _timeWindowSize.
void receiveDataForWindowEnd(const m2n::PtrM2N &m2n, const DataMap &receiveData)
Like receiveData, but temporarily sets window time to end of window.
void notifyDataHasBeenReceived()
Used to set flag after data has been received using receiveData().
bool isExplicitCouplingScheme() const
Function to determine whether coupling scheme is an explicit coupling scheme.
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 isCouplingOngoing() const override final
Returns true, when the coupled simulation is still ongoing.
double getTime() const override final
getter for _time
bool hasConverged() const override
Checks if the implicit cplscheme has converged.
double getTimeWindowSize() const override final
Returns the time window size, if one is given by the coupling scheme.
double getTimeWindowStart() const override final
void moveToNextWindow()
finalizes this window's data and initializes data for next window.
void doImplicitStep()
perform a coupling iteration
bool hasTimeWindowSize() const override final
Function to check whether time window size is defined by coupling scheme.
bool receivesInitializedData() const
Getter for _receivesInitializedData.
double getNextTimeWindowSize() const
Getter for _nextTimeWindowSize.
void receiveConvergence(const m2n::PtrM2N &m2n)
receives convergence from other participant via m2n
void setNextTimeWindowSize(double timeWindowSize)
Setter for _nextTimeWindowSize.
void receiveData(const m2n::PtrM2N &m2n, const DataMap &receiveData)
Receives data receiveDataIDs given in mapCouplingData with communication.
bool doesFirstStep() const
Getter for _doesFirstStep.
Abstract base class for coupling schemes with two participants.
DataMap & getSendData()
Returns all data to be sent.
DataMap & getReceiveData()
Returns all data to be received.
m2n::PtrM2N getM2N() const
static const double UNDEFINED_TIME_WINDOW_SIZE
To be used, when the time window size is determined dynamically during the coupling.
Coupling scheme for serial coupling, i.e. staggered execution of two coupled participants.
void exchangeSecondData() override final
Exchanges the second set of data.
void receiveAndSetTimeWindowSize()
Receives and sets the time window size, if this participant is the one to receive.
bool _participantSetsTimeWindowSize
Determines, if the time window size is set by the participant.
void sendTimeWindowSize()
Sends time window size, if this participant is the one to send.
void exchangeInitialData() override final
implements functionality for initialize in base class.
SerialCouplingScheme(double maxTime, int maxTimeWindows, double timeWindowSize, const std::string &firstParticipant, const std::string &secondParticipant, const std::string &localParticipant, m2n::PtrM2N m2n, constants::TimesteppingMethod dtMethod, CouplingMode cplMode, int minIterations, int maxIterations)
Constructor.
void exchangeFirstData() override final
Functions needed for advance()
ImplicitData implicitDataToReceive() const override final
Returns a vector of implicit data to receive in the next advance.
bool _participantReceivesTimeWindowSize
Determines, if the time window size is received by the participant.
DataMap & getAccelerationData() override final
interface to provide accelerated data, depending on coupling scheme being used
@ FIRST_PARTICIPANT_SETS_TIME_WINDOW_SIZE
contains implementations of coupling schemes for coupled simulations.
constexpr bool equals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares two Eigen::MatrixBase for equality up to tolerance.
void add(DataID did, bool toKeep)