preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
24
26{
27 return _timeWindows;
28}
29
31{
32 return _timeWindows;
33}
34
39{
42
43 // Explicit schemes already advance time here, needed by compositional
46 }
47
48 return true;
49}
50
58
64
71
73{
75
76 // explicit schemes advance in addComputedTime
78 // -1 as we already went a step ahead in addComputeTime
79 if (_timeWindows - 1 == _maxTimeWindows) {
80 _isOngoing = false;
81 }
82 PRECICE_DEBUG("advanced to {} (ongoing {})", _timeWindows, _isOngoing);
83 return;
84 }
85
88
89 // Imagine we compute the convergence measure here
91
92 if (_hasConverged) {
94 _isOngoing = false;
95 }
97 _iterations = 1;
98 } else {
100 }
101 PRECICE_DEBUG("advanced to {}-{}/{} (ongoing {})", _timeWindows, _iterations, _numberIterations, _isOngoing);
102}
103
109
111{
114 return true;
115 return false;
116}
117
119 Action action) const
120{
122 PRECICE_DEBUG("return false (explicit)");
123 return false;
124 }
126 if (_iterations == 1) {
127 PRECICE_DEBUG("return true");
128 return true;
129 }
130 }
132 if (_iterations != 1) {
133 PRECICE_DEBUG("return true");
134 return true;
135 }
136 }
137 PRECICE_DEBUG("return false");
138 return false;
139}
140
142{
143 return _hasConverged;
144}
145
146} // namespace precice::cplscheme::tests
#define PRECICE_DEBUG(...)
Definition LogMacros.hpp:61
#define PRECICE_ASSERT(...)
Definition assertion.hpp:85
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 _hasConverged
False, if iterations are left to be performed.
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.
double getTime() const final override
Not implemented.
int _timeWindows
Performed number of time windows.
bool isImplicitCouplingScheme() const override
Returns true if the scheme or one subscheme is implicit.
ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override
bool isActionRequired(Action action) const final override
Not implemented.
void finalize() final override
Finalizes the coupling and disconnects communication.
bool addComputedTime(double timeToAdd) final override
Always assumes we reached the end of a time window.
int _numberIterations
Number of iterations performed per time window. 1 --> explicit.
bool isCouplingOngoing() const final override
Not implemented.
bool _isInitialized
True, if initialize has been called.
int _iterations
Performed iterations in the current time window.
void initialize() final override
Destructor, empty.
T empty(T... args)