preCICE v3.1.2
Loading...
Searching...
No Matches
DummyCouplingScheme.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
6#include "logging/Logger.hpp"
7#include "utils/assertion.hpp"
8
9namespace precice {
10namespace cplscheme {
11namespace tests {
12
16class DummyCouplingScheme final : public CouplingScheme {
17public:
26 int numberIterations,
27 int maxTimeWindows);
28
32 //virtual ~DummyCouplingScheme() {}
33
37 void initialize(
38 double startTime,
39 int startTimeWindows) override final;
40
44 bool isInitialized() const override final
45 {
46 PRECICE_ASSERT(false);
47 return false;
48 }
49
53 bool sendsInitializedData() const override final
54 {
55 PRECICE_ASSERT(false);
56 return false;
57 }
58
59 bool addComputedTime(double timeToAdd) override final;
60
64 //void advance() override final;
65
66 ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override;
67
68 void firstExchange() override;
69
71
72 void secondExchange() final;
73
77 void finalize() override final;
78
79 /*
80 * @brief Not implemented.
81 */
82 std::vector<std::string> getCouplingPartners() const override final
83 {
84 PRECICE_ASSERT(false);
86 }
87
88 std::string localParticipant() const override final
89 {
90 PRECICE_ASSERT(false);
91 return "unknown";
92 }
93
97 bool willDataBeExchanged(double lastSolverTimeStepSize) const override final
98 {
99 PRECICE_ASSERT(false);
100 return false;
101 }
102
106 bool hasDataBeenReceived() const override final
107 {
108 PRECICE_ASSERT(false);
109 return false;
110 }
111
115 double getTime() const override final;
116
117 double getTimeWindowStart() const override final;
118
122 int getTimeWindows() const override final
123 {
124 return _timeWindows;
125 }
126
127 bool hasTimeWindowSize() const override final
128 {
129 return true;
130 }
131
135 double getTimeWindowSize() const override final
136 {
137 return 1.0;
138 }
139
143 double getNextTimeStepMaxSize() const override final
144 {
145 PRECICE_ASSERT(false);
146 return 0;
147 }
148
152 bool isCouplingOngoing() const override final;
153
157 bool isTimeWindowComplete() const override final
158 {
159 PRECICE_ASSERT(false);
160 return false;
161 }
162
166 bool isActionRequired(Action action) const override final;
167
168 bool isActionFulfilled(Action action) const override final
169 {
170 return true;
171 }
172
176 void markActionFulfilled(Action action) override final
177 {
178 PRECICE_ASSERT(false);
179 }
180
185 {
186 PRECICE_ASSERT(false);
187 return 0;
188 }
189
193 void requireAction(Action action) override final
194 {
195 PRECICE_ASSERT(false);
196 }
197
201 std::string printCouplingState() const override final
202 {
203 return std::string();
204 }
205
206 bool isImplicitCouplingScheme() const override
207 {
208 return _numberIterations > 1;
209 }
210
211 bool hasConverged() const override;
212
213 bool requiresSubsteps() const override final
214 {
215 return true;
216 }
217
218 ImplicitData implicitDataToReceive() const override final
219 {
220 return {};
221 }
222
223private:
224 mutable logging::Logger _log{"cplscheme::tests::DummyCouplingScheme"};
225
228
230 int _iterations = 0;
231
234
237
239 bool _isInitialized = false;
240
242 bool _isOngoing = false;
243
245 bool _hasConverged = false;
246};
247
248} // namespace tests
249} // namespace cplscheme
250} // namespace precice
#define PRECICE_ASSERT(...)
Definition assertion.hpp:87
Interface for all coupling schemes.
Action
Actions that are required by CouplingSchemes.
Used to test CompositionalCouplingScheme.
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 requiresSubsteps() const override final
Returns true if any send data of the scheme requires substeps.
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.
bool isTimeWindowComplete() const override final
Not implemented.
bool hasTimeWindowSize() const override final
Returns true, if time window size is prescribed by the cpl scheme.
void markActionFulfilled(Action action) override final
Not implemented.
DummyCouplingScheme(int numberIterations, int maxTimeWindows)
Constructor.
int _timeWindows
Performed number of time windows.
ImplicitData implicitDataToReceive() const override final
Returns a vector of implicit data to receive in the next advance.
double getNextTimeStepMaxSize() const override final
Not implemented.
double getTime() const override final
Not implemented.
std::vector< std::string > getCouplingPartners() const override final
Returns list of all coupling partners.
bool isActionFulfilled(Action action) const override final
Returns true, if the given action has already been performed by the accessor.
bool isImplicitCouplingScheme() const override
Returns true if the scheme or one subscheme is implicit.
bool isCouplingOngoing() const override final
Not implemented.
void requireAction(Action action) override final
Not implemented.
ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override
void initialize(double startTime, int startTimeWindows) override final
Destructor, empty.
bool willDataBeExchanged(double lastSolverTimeStepSize) const override final
Not implemented.
bool sendsInitializedData() const override final
Not implemented.
bool hasDataBeenReceived() const override final
Not implemented.
int _numberIterations
Number of iterations performed per time window. 1 --> explicit.
bool isInitialized() const override final
Not implemented.
void finalize() override final
Finalizes the coupling and disconnects communication.
int getTimeWindows() const override final
Not implemented.
double getTimeWindowSize() const override final
Not implemented.
std::string printCouplingState() const override final
Empty.
bool _isInitialized
True, if initialize has been called.
int _iterations
Performed iterations in the current time window.
std::string localParticipant() const override final
Returns the name of the local participant.
This class provides a lightweight logger.
Definition Logger.hpp:16
Main namespace of the precice library.
STL namespace.