preCICE v3.1.2
|
Abstract base class for coupling schemes with two participants. More...
#include <BiCouplingScheme.hpp>
Public Member Functions | |
BiCouplingScheme (double maxTime, int maxTimeWindows, double timeWindowSize, std::string firstParticipant, std::string secondParticipant, const std::string &localParticipant, m2n::PtrM2N m2n, int minIterations, int maxIterations, CouplingMode cplMode, constants::TimesteppingMethod dtMethod) | |
void | addDataToSend (const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps) |
Adds data to be sent on data exchange and possibly be modified during coupling iterations. | |
void | addDataToReceive (const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps) |
Adds data to be received on data exchange. | |
void | determineInitialDataExchange () override |
Determines which data is initialized and therefore has to be exchanged during initialize. | |
std::vector< std::string > | getCouplingPartners () const override final |
returns list of all coupling partners | |
bool | hasAnySendData () override final |
bool | hasSendData (DataID dataID) |
Public Member Functions inherited from precice::cplscheme::BaseCouplingScheme | |
BaseCouplingScheme (double maxTime, int maxTimeWindows, double timeWindowSize, std::string localParticipant, int minIterations, int maxIterations, CouplingMode cplMode, constants::TimesteppingMethod dtMethod) | |
bool | sendsInitializedData () const override final |
Getter for _sendsInitializedData. | |
bool | isInitialized () const override final |
getter for _isInitialized | |
bool | addComputedTime (double timeToAdd) override final |
Adds newly computed time. Has to be called before every advance. | |
bool | willDataBeExchanged (double lastSolverTimeStepSize) const override final |
Returns true, if data will be exchanged when calling advance(). | |
bool | hasDataBeenReceived () const override final |
getter for _hasDataBeenReceived | |
double | getTime () const override final |
getter for _time | |
double | getTimeWindowStart () const override final |
int | getTimeWindows () const override final |
getter for _timeWindows | |
bool | hasTimeWindowSize () const override final |
Function to check whether time window size is defined by coupling scheme. | |
double | getTimeWindowSize () const override final |
Returns the time window size, if one is given by the coupling scheme. | |
double | getNextTimeStepMaxSize () const override final |
Returns the maximal size of the next time step to be computed. | |
bool | isCouplingOngoing () const override final |
Returns true, when the coupled simulation is still ongoing. | |
bool | isTimeWindowComplete () const override final |
Returns true, when the accessor can advance to the next time window. | |
bool | isActionRequired (Action action) const override final |
Returns true, if the given action has to be performed by the accessor. | |
bool | isActionFulfilled (Action action) const override final |
Returns true, if the given action has to be performed by the accessor. | |
void | markActionFulfilled (Action action) override final |
Tells the coupling scheme that the accessor has performed the given action. | |
void | requireAction (Action action) override final |
Sets an action required to be performed by the accessor. | |
std::string | printCouplingState () const override |
Returns coupling state information. | |
void | finalize () override final |
Finalizes the coupling scheme. | |
void | initialize (double startTime, int startTimeWindow) override final |
Initializes the coupling scheme. | |
ChangedMeshes | firstSynchronization (const ChangedMeshes &changes) override final |
void | firstExchange () override final |
ChangedMeshes | secondSynchronization () override final |
void | secondExchange () override final |
void | addConvergenceMeasure (int dataID, bool suffices, bool strict, impl::PtrConvergenceMeasure measure, bool doesLogging) |
Adds a measure to determine the convergence of coupling iterations. | |
void | setAcceleration (const acceleration::PtrAcceleration &acceleration) |
Set an acceleration technique. | |
bool | doesFirstStep () const |
Getter for _doesFirstStep. | |
bool | isImplicitCouplingScheme () const override |
Function to determine whether coupling scheme is an implicit coupling scheme. | |
bool | hasConverged () const override |
Checks if the implicit cplscheme has converged. | |
Public Member Functions inherited from precice::cplscheme::CouplingScheme | |
CouplingScheme & | operator= (CouplingScheme &&)=delete |
virtual | ~CouplingScheme () |
Protected Member Functions | |
DataMap & | getSendData () |
Returns all data to be sent. | |
DataMap & | getReceiveData () |
Returns all data to be received. | |
const DataMap & | getReceiveData () const |
Returns all data to be received. | |
CouplingData * | getSendData (DataID dataID) |
Sets the values. | |
CouplingData * | getReceiveData (DataID dataID) |
Returns all data to be received with data ID as given. | |
m2n::PtrM2N | getM2N () const |
void | initializeReceiveDataStorage () override final |
Functions needed for initialize() | |
Protected Member Functions inherited from precice::cplscheme::BaseCouplingScheme | |
void | sendNumberOfTimeSteps (const m2n::PtrM2N &m2n, const int numberOfTimeSteps) |
void | sendTimes (const m2n::PtrM2N &m2n, const Eigen::VectorXd ×) |
void | sendData (const m2n::PtrM2N &m2n, const DataMap &sendData) |
Sends data sendDataIDs given in mapCouplingData with communication. | |
int | receiveNumberOfTimeSteps (const m2n::PtrM2N &m2n) |
Eigen::VectorXd | receiveTimes (const m2n::PtrM2N &m2n, int nTimeSteps) |
void | receiveData (const m2n::PtrM2N &m2n, const DataMap &receiveData) |
Receives data receiveDataIDs given in mapCouplingData with communication. | |
void | receiveDataForWindowEnd (const m2n::PtrM2N &m2n, const DataMap &receiveData) |
Like receiveData, but temporarily sets window time to end of window. | |
void | initializeWithZeroInitialData (const DataMap &receiveData) |
Initializes storage in receiveData as zero. | |
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 CouplingData. | |
bool | isExplicitCouplingScheme () const |
Function to determine whether coupling scheme is an explicit coupling scheme. | |
void | setTimeWindowSize (double timeWindowSize) |
Setter for _timeWindowSize. | |
double | getNextTimeWindowSize () const |
Getter for _nextTimeWindowSize. | |
void | setNextTimeWindowSize (double timeWindowSize) |
Setter for _nextTimeWindowSize. | |
void | setDoesFirstStep (bool doesFirstStep) |
Setter for _doesFirstStep. | |
void | notifyDataHasBeenReceived () |
Used to set flag after data has been received using receiveData(). | |
bool | receivesInitializedData () const |
Getter for _receivesInitializedData. | |
void | setTimeWindows (int timeWindows) |
Setter for _timeWindows. | |
void | sendConvergence (const m2n::PtrM2N &m2n) |
sends convergence to other participant via m2n | |
void | receiveConvergence (const m2n::PtrM2N &m2n) |
receives convergence from other participant via m2n | |
void | doImplicitStep () |
perform a coupling iteration | |
void | moveToNextWindow () |
finalizes this window's data and initializes data for next window. | |
void | storeIteration () |
used for storing all Data at end of doImplicitStep for later reference. | |
void | determineInitialSend (DataMap &sendData) |
Sets _sendsInitializedData, if sendData requires initialization. | |
void | determineInitialReceive (DataMap &receiveData) |
Sets _receivesInitializedData, if receiveData requires initialization. | |
bool | reachedEndOfTimeWindow () const |
Function to check whether end of time window is reached. Does not check for convergence. | |
bool | requiresSubsteps () const override final |
Returns true if any send data of the scheme requires substeps. | |
ImplicitData | implicitDataToReceive () const override |
Returns a vector of implicit data to receive in the next advance. | |
std::string | localParticipant () const override final |
Returns the name of the local participant. | |
Private Attributes | |
logging::Logger | _log {"cplscheme::BiCouplingScheme"} |
m2n::PtrM2N | _m2n |
Communication to the other coupling participant. | |
DataMap | _sendData |
All send data as a map "data ID -> data". | |
DataMap | _receiveData |
All receive data as a map "data ID -> data". | |
std::string | _firstParticipant = "unknown" |
First participant name. | |
std::string | _secondParticipant = "unknown" |
Second participant name. | |
Additional Inherited Members | |
Public Types inherited from precice::cplscheme::BaseCouplingScheme | |
enum | CouplingMode { Explicit , Implicit , Undefined } |
Public Types inherited from precice::cplscheme::CouplingScheme | |
enum struct | Action { InitializeData , ReadCheckpoint , WriteCheckpoint } |
Actions that are required by CouplingSchemes. More... | |
using | ChangedMeshes = std::vector<MeshID> |
Static Public Member Functions inherited from precice::cplscheme::CouplingScheme | |
static std::string | toString (Action action) |
Static Public Attributes inherited from precice::cplscheme::CouplingScheme | |
static const double | UNDEFINED_MAX_TIME = -1.0 |
Does not define a time limit for the coupled simulation. | |
static const int | UNDEFINED_TIME_WINDOWS = -1 |
Does not define limit on time windows for the coupled simulation. | |
static const double | UNDEFINED_TIME_WINDOW_SIZE = -1.0 |
To be used, when the time window size is determined dynamically during the coupling. | |
static const int | UNDEFINED_MAX_ITERATIONS = -1 |
To be used, when the number of max iterations is not defined (for explicit coupling). | |
static const int | UNDEFINED_MIN_ITERATIONS = -1 |
To be used, when the number of min iterations is not defined (for explicit coupling). | |
static const int | INFINITE_MAX_ITERATIONS = -2 |
To be used, when the number of max iterations is infinite (for implicit coupling). | |
Protected Attributes inherited from precice::cplscheme::BaseCouplingScheme | |
DataMap | _allData |
All send and receive data as a map "data ID -> data". | |
acceleration::PtrAcceleration | _acceleration |
Acceleration method to speedup iteration convergence. | |
Abstract base class for coupling schemes with two participants.
! General description A BiCouplingScheme couples two participants. It is a specialization of BaseCouplingScheme.
Definition at line 27 of file BiCouplingScheme.hpp.
precice::cplscheme::BiCouplingScheme::BiCouplingScheme | ( | double | maxTime, |
int | maxTimeWindows, | ||
double | timeWindowSize, | ||
std::string | firstParticipant, | ||
std::string | secondParticipant, | ||
const std::string & | localParticipant, | ||
m2n::PtrM2N | m2n, | ||
int | minIterations, | ||
int | maxIterations, | ||
CouplingMode | cplMode, | ||
constants::TimesteppingMethod | dtMethod ) |
void precice::cplscheme::BiCouplingScheme::addDataToReceive | ( | const mesh::PtrData & | data, |
mesh::PtrMesh | mesh, | ||
bool | requiresInitialization, | ||
bool | exchangeSubsteps ) |
Adds data to be received on data exchange.
Definition at line 67 of file BiCouplingScheme.cpp.
void precice::cplscheme::BiCouplingScheme::addDataToSend | ( | const mesh::PtrData & | data, |
mesh::PtrMesh | mesh, | ||
bool | requiresInitialization, | ||
bool | exchangeSubsteps ) |
Adds data to be sent on data exchange and possibly be modified during coupling iterations.
Definition at line 50 of file BiCouplingScheme.cpp.
|
overridevirtual |
Determines which data is initialized and therefore has to be exchanged during initialize.
Calls determineInitialSend and determineInitialReceive for all send and receive data of this coupling scheme.
Implements precice::cplscheme::BaseCouplingScheme.
Definition at line 84 of file BiCouplingScheme.cpp.
|
finaloverridevirtual |
returns list of all coupling partners
Implements precice::cplscheme::CouplingScheme.
Definition at line 90 of file BiCouplingScheme.cpp.
|
protected |
Definition at line 139 of file BiCouplingScheme.cpp.
|
protected |
Returns all data to be received.
Definition at line 107 of file BiCouplingScheme.cpp.
|
protected |
Returns all data to be received.
Definition at line 112 of file BiCouplingScheme.cpp.
|
protected |
Returns all data to be received with data ID as given.
Definition at line 128 of file BiCouplingScheme.cpp.
|
protected |
Returns all data to be sent.
Definition at line 102 of file BiCouplingScheme.cpp.
|
protected |
Sets the values.
Definition at line 117 of file BiCouplingScheme.cpp.
|
finaloverridevirtual |
Implements precice::cplscheme::BaseCouplingScheme.
Definition at line 151 of file BiCouplingScheme.cpp.
bool precice::cplscheme::BiCouplingScheme::hasSendData | ( | DataID | dataID | ) |
Definition at line 156 of file BiCouplingScheme.cpp.
|
finaloverrideprotectedvirtual |
Functions needed for initialize()
Need to initialize receive data
Implements precice::cplscheme::BaseCouplingScheme.
Definition at line 145 of file BiCouplingScheme.cpp.
|
private |
First participant name.
Definition at line 107 of file BiCouplingScheme.hpp.
|
mutableprivate |
Definition at line 95 of file BiCouplingScheme.hpp.
|
private |
Communication to the other coupling participant.
Definition at line 98 of file BiCouplingScheme.hpp.
|
private |
All receive data as a map "data ID -> data".
Definition at line 104 of file BiCouplingScheme.hpp.
|
private |
Second participant name.
Definition at line 110 of file BiCouplingScheme.hpp.
|
private |
All send data as a map "data ID -> data".
Definition at line 101 of file BiCouplingScheme.hpp.