preCICE v3.1.2
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 {
12namespace cplscheme {
13
43public:
45 static const double UNDEFINED_MAX_TIME;
46
48 static const int UNDEFINED_TIME_WINDOWS;
49
51 static const double UNDEFINED_TIME_WINDOW_SIZE;
52
54 static const int UNDEFINED_MAX_ITERATIONS;
55
57 static const int UNDEFINED_MIN_ITERATIONS;
58
60 static const int INFINITE_MAX_ITERATIONS;
61
63 enum struct Action {
67 };
68
69 static std::string toString(Action action);
70
72
73 virtual ~CouplingScheme() {}
74
82 virtual void initialize(
83 double startTime,
84 int startTimeWindow) = 0;
85
91 virtual bool sendsInitializedData() const = 0;
92
94 virtual bool isInitialized() const = 0;
95
108 virtual bool addComputedTime(double timeToAdd) = 0;
109
111
122
127 virtual void firstExchange() = 0;
128
144
151 virtual void secondExchange() = 0;
152
154
156 virtual void finalize() = 0;
157
160
162 virtual std::string localParticipant() const = 0;
163
173 virtual bool willDataBeExchanged(double lastSolverTimeStepSize) const = 0;
174
176 virtual bool hasDataBeenReceived() const = 0;
177
180 virtual double getTimeWindowStart() const = 0;
181
183 virtual double getTime() const = 0;
184
186 virtual int getTimeWindows() const = 0;
187
189 virtual bool hasTimeWindowSize() const = 0;
190
197 virtual double getTimeWindowSize() const = 0;
198
205 virtual double getNextTimeStepMaxSize() const = 0;
206
208 virtual bool isCouplingOngoing() const = 0;
209
211 virtual bool isTimeWindowComplete() const = 0;
212
214 virtual bool isActionRequired(Action action) const = 0;
215
217 virtual bool isActionFulfilled(Action action) const = 0;
218
220 virtual void markActionFulfilled(Action action) = 0;
221
223 virtual void requireAction(Action action) = 0;
224
226 virtual std::string printCouplingState() const = 0;
227
229 virtual bool isImplicitCouplingScheme() const = 0;
230
232 virtual bool hasConverged() const = 0;
233
235 virtual bool requiresSubsteps() const = 0;
236
239};
240
241} // namespace cplscheme
242} // namespace precice
Interface for all coupling schemes.
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 void initialize(double startTime, int startTimeWindow)=0
Initializes the coupling scheme and establishes a communication connection to the coupling partner....
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 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.
Main namespace of the precice library.