preCICE v3.1.2
Loading...
Searching...
No Matches
DummyCouplingScheme.cpp
Go to the documentation of this file.
2#include "../Constants.hpp"
5
7
9 int numberIterations,
10 int maxTimeWindows)
11 : _numberIterations(numberIterations),
12 _maxTimeWindows(maxTimeWindows)
13{
14}
15
17 double startTime,
18 int startTimeWindows)
19{
21 _isInitialized = true;
22 _isOngoing = true;
23 _timeWindows = startTimeWindows;
24 _iterations = 1;
25}
26
28{
29 return _timeWindows;
30}
31
33{
34 return _timeWindows;
35}
36
41{
44
45 // Explicit schemes already advance time here, needed by compositional
48 }
49
50 return true;
51}
52
60
66
73
75{
77
78 // explicit schemes advance in addComputedTime
80 // -1 as we already went a step ahead in addComputeTime
81 if (_timeWindows - 1 == _maxTimeWindows) {
82 _isOngoing = false;
83 }
84 PRECICE_DEBUG("advanced to {} (ongoing {})", _timeWindows, _isOngoing);
85 return;
86 }
87
90
91 // Imagine we compute the convergence measure here
93
94 if (_hasConverged) {
96 _isOngoing = false;
97 }
99 _iterations = 1;
100 } else {
101 _iterations++;
102 }
103 PRECICE_DEBUG("advanced to {}-{}/{} (ongoing {})", _timeWindows, _iterations, _numberIterations, _isOngoing);
104}
105
111
113{
116 return true;
117 return false;
118}
119
121 Action action) const
122{
124 PRECICE_DEBUG("return false (explicit)");
125 return false;
126 }
128 if (_iterations == 1) {
129 PRECICE_DEBUG("return true");
130 return true;
131 }
132 }
134 if (_iterations != 1) {
135 PRECICE_DEBUG("return true");
136 return true;
137 }
138 }
139 PRECICE_DEBUG("return false");
140 return false;
141}
142
144{
145 return _hasConverged;
146}
147
148} // namespace precice::cplscheme::tests
#define PRECICE_DEBUG(...)
Definition LogMacros.hpp:64
#define PRECICE_ASSERT(...)
Definition assertion.hpp:87
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?
bool isActionRequired(Action action) const override final
Not implemented.
bool _hasConverged
False, if iterations are left to be performed.
bool addComputedTime(double timeToAdd) override final
Always assumes we reached the end of a time window.
bool hasConverged() const override
Returns false if the scheme is implicit and hasn't converged.
bool _isOngoing
True, if timesteps are left to be performed.
int _maxTimeWindows
Maximal number of time windows to be performed.
DummyCouplingScheme(int numberIterations, int maxTimeWindows)
Constructor.
int _timeWindows
Performed number of time windows.
double getTime() const override final
Not implemented.
bool isImplicitCouplingScheme() const override
Returns true if the scheme or one subscheme is implicit.
bool isCouplingOngoing() const override final
Not implemented.
ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override
void initialize(double startTime, int startTimeWindows) override final
Destructor, empty.
int _numberIterations
Number of iterations performed per time window. 1 --> explicit.
void finalize() override final
Finalizes the coupling and disconnects communication.
bool _isInitialized
True, if initialize has been called.
int _iterations
Performed iterations in the current time window.
T empty(T... args)