preCICE v3.1.1
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
62 bool addComputedTime(double timeToAdd) override final
63 {
64 PRECICE_ASSERT(false);
65 return true;
66 }
67
71 //void advance() override final;
72
73 ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override;
74
75 void firstExchange() override;
76
78
79 void secondExchange() final;
80
84 void finalize() override final;
85
86 /*
87 * @brief Not implemented.
88 */
89 std::vector<std::string> getCouplingPartners() const override final
90 {
91 PRECICE_ASSERT(false);
93 }
94
98 bool willDataBeExchanged(double lastSolverTimeStepSize) const override final
99 {
100 PRECICE_ASSERT(false);
101 return false;
102 }
103
107 bool hasDataBeenReceived() const override final
108 {
109 PRECICE_ASSERT(false);
110 return false;
111 }
112
116 double getTime() const override final;
117
118 double getTimeWindowStart() const override final;
119
123 int getTimeWindows() const override final
124 {
125 return _timeWindows;
126 }
127
131 bool hasTimeWindowSize() const override final
132 {
133 PRECICE_ASSERT(false);
134 return false;
135 }
136
140 double getTimeWindowSize() const override final
141 {
142 PRECICE_ASSERT(false);
143 return 0;
144 }
145
149 double getNextTimeStepMaxSize() const override final
150 {
151 PRECICE_ASSERT(false);
152 return 0;
153 }
154
158 bool isCouplingOngoing() const override final;
159
163 bool isTimeWindowComplete() const override final
164 {
165 PRECICE_ASSERT(false);
166 return false;
167 }
168
172 bool isActionRequired(Action action) const override final;
173
174 bool isActionFulfilled(Action action) const override final
175 {
176 return true;
177 }
178
182 void markActionFulfilled(Action action) override final
183 {
184 PRECICE_ASSERT(false);
185 }
186
191 {
192 PRECICE_ASSERT(false);
193 return 0;
194 }
195
199 void requireAction(Action action) override final
200 {
201 PRECICE_ASSERT(false);
202 }
203
207 std::string printCouplingState() const override final
208 {
209 return std::string();
210 }
211
212 bool isImplicitCouplingScheme() const override
213 {
214 return _numberIterations > 1;
215 }
216
217 bool hasConverged() const override;
218
219 bool requiresSubsteps() const override final
220 {
221 return true;
222 }
223
224 ImplicitData implicitDataToReceive() const override final
225 {
226 return {};
227 }
228
229private:
230 mutable logging::Logger _log{"cplscheme::tests::DummyCouplingScheme"};
231
234
236 int _iterations = 0;
237
240
243
245 bool _isInitialized = false;
246
248 bool _isOngoing = false;
249
251 bool _hasConverged = false;
252};
253
254} // namespace tests
255} // namespace cplscheme
256} // 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
Not implemented.
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
Not implemented.
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.
This class provides a lightweight logger.
Definition Logger.hpp:16
Main namespace of the precice library.
STL namespace.