preCICE v3.2.0
Loading...
Searching...
No Matches
CouplingScheme.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <string>
5#include <vector>
6
10
11namespace precice::cplscheme {
12
42public:
44 static const double UNDEFINED_MAX_TIME;
45
47 static const int UNDEFINED_TIME_WINDOWS;
48
50 static const double UNDEFINED_TIME_WINDOW_SIZE;
51
53 static const int UNDEFINED_MAX_ITERATIONS;
54
56 static const int UNDEFINED_MIN_ITERATIONS;
57
59 static const int INFINITE_MAX_ITERATIONS;
60
67
69
71
72 virtual ~CouplingScheme() = default;
73
78 virtual void initialize() = 0;
79
83 virtual void reinitialize() = 0;
84
90 virtual bool sendsInitializedData() const = 0;
91
93 virtual bool isInitialized() const = 0;
94
100
107 virtual bool addComputedTime(double timeToAdd) = 0;
108
110
121
126 virtual void firstExchange() = 0;
127
143
150 virtual void secondExchange() = 0;
151
153
155 virtual void finalize() = 0;
156
159
161 virtual std::string localParticipant() const = 0;
162
172 virtual bool willDataBeExchanged(double lastSolverTimeStepSize) const = 0;
173
175 virtual bool hasDataBeenReceived() const = 0;
176
179 virtual double getTimeWindowStart() const = 0;
180
182 virtual double getTime() const = 0;
183
185 virtual int getTimeWindows() const = 0;
186
188 virtual bool hasTimeWindowSize() const = 0;
189
196 virtual double getTimeWindowSize() const = 0;
197
204 virtual double getNextTimeStepMaxSize() const = 0;
205
207 virtual bool isCouplingOngoing() const = 0;
208
210 virtual bool isTimeWindowComplete() const = 0;
211
213 virtual bool isActionRequired(Action action) const = 0;
214
216 virtual bool isActionFulfilled(Action action) const = 0;
217
220
222 virtual void requireAction(Action action) = 0;
223
225 virtual std::string printCouplingState() const = 0;
226
228 virtual bool isImplicitCouplingScheme() const = 0;
229
231 virtual bool hasConverged() const = 0;
232
234 virtual bool requiresSubsteps() const = 0;
235
238};
239
240} // namespace precice::cplscheme
Interface for all coupling schemes.
virtual void initialize()=0
Initializes the coupling scheme and establishes a communication connection to the coupling partner....
virtual bool willDataBeExchanged(double lastSolverTimeStepSize) const =0
Returns true, if data will be exchanged when calling advance().
static const int INFINITE_MAX_ITERATIONS
To be used, when the number of max iterations is infinite (for implicit coupling).
CouplingScheme & operator=(CouplingScheme &&)=delete
Action
Actions that are required by CouplingSchemes.
@ WriteCheckpoint
Is the participant required to write a checkpoint?
@ ReadCheckpoint
Is the participant required to read a previously written checkpoint?
@ InitializeData
Is the initialization of coupling data required?
static const double UNDEFINED_MAX_TIME
Does not define a time limit for the coupled simulation.
static const int UNDEFINED_MIN_ITERATIONS
To be used, when the number of min iterations is not defined (for explicit coupling).
static const int UNDEFINED_MAX_ITERATIONS
To be used, when the number of max iterations is not defined (for explicit coupling).
virtual ChangedMeshes firstSynchronization(const ChangedMeshes &changes)=0
virtual void requireAction(Action action)=0
Sets an action required to be performed by the accessor.
virtual bool addComputedTime(double timeToAdd)=0
Adds newly computed time. Has to be called before every advance.
virtual double getTime() const =0
Returns the currently computed time of the coupling scheme.
static std::string toString(Action action)
virtual std::vector< std::string > getCouplingPartners() const =0
Returns list of all coupling partners.
virtual double getTimeWindowStart() const =0
virtual ChangedMeshes secondSynchronization()=0
virtual bool requiresSubsteps() const =0
Returns true if any send data of the scheme requires substeps.
virtual void markActionFulfilled(Action action)=0
Tells the coupling scheme that the accessor has performed the given action.
virtual bool isImplicitCouplingScheme() const =0
Returns true if the scheme or one subscheme is implicit.
virtual std::string printCouplingState() const =0
Returns a string representation of the current coupling state.
virtual bool isActionFulfilled(Action action) const =0
Returns true, if the given action has already been performed by the accessor.
virtual bool isInitialized() const =0
Returns true, if initialize has been called.
virtual double getNextTimeStepMaxSize() const =0
Returns the maximal size of the next time step to be computed.
virtual ImplicitData implicitDataToReceive() const =0
Returns a vector of implicit data to receive in the next advance.
virtual bool isTimeWindowComplete() const =0
Returns true, when the accessor can advance to the next time window.
static const double UNDEFINED_TIME_WINDOW_SIZE
To be used, when the time window size is determined dynamically during the coupling.
virtual double getTimeWindowSize() const =0
Returns the time window size, if one is given by the coupling scheme.
virtual bool sendsInitializedData() const =0
Returns whether this participant of the coupling scheme sends initialized data.
virtual void finalize()=0
Finalizes the coupling and disconnects communication.
virtual bool isCouplingOngoing() const =0
Returns true, when the coupled simulation is still ongoing.
virtual int getTimeWindows() const =0
Returns the currently computed time windows of the coupling scheme.
virtual void reinitialize()=0
Reinitializes the coupling scheme, coupling data, and acceleration schemes.
virtual bool hasConverged() const =0
Returns false if the scheme is implicit and hasn't converged.
virtual bool isActionRequired(Action action) const =0
Returns true, if the given action has to be performed by the accessor.
virtual bool hasTimeWindowSize() const =0
Returns true, if time window size is prescribed by the cpl scheme.
virtual bool hasDataBeenReceived() const =0
Returns true, if data has been exchanged in last call of advance().
static const int UNDEFINED_TIME_WINDOWS
Does not define limit on time windows for the coupled simulation.
virtual std::string localParticipant() const =0
Returns the name of the local participant.
contains actions to modify exchanged data.
Definition Action.hpp:6
contains implementations of coupling schemes for coupled simulations.