preCICE v3.2.0
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
10
14class DummyCouplingScheme final : public CouplingScheme {
15public:
24 int numberIterations,
25 int maxTimeWindows);
26
30 // virtual ~DummyCouplingScheme() {}
31
35 void initialize() final override;
36
37 void reinitialize() final override {};
38
42 bool isInitialized() const final override
43 {
44 PRECICE_ASSERT(false);
45 return false;
46 }
47
51 bool sendsInitializedData() const final override
52 {
53 PRECICE_ASSERT(false);
54 return false;
55 }
56
57 bool addComputedTime(double timeToAdd) final override;
58
62 // void advance() override final override;
63
64 ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override;
65
66 void firstExchange() override;
67
69
70 void secondExchange() final override;
71
75 void finalize() final override;
76
77 /*
78 * @brief Not implemented.
79 */
80 std::vector<std::string> getCouplingPartners() const final override
81 {
82 PRECICE_ASSERT(false);
84 }
85
86 std::string localParticipant() const final override
87 {
88 PRECICE_ASSERT(false);
89 return "unknown";
90 }
91
95 bool willDataBeExchanged(double lastSolverTimeStepSize) const final override
96 {
97 PRECICE_ASSERT(false);
98 return false;
99 }
100
104 bool hasDataBeenReceived() const final override
105 {
106 PRECICE_ASSERT(false);
107 return false;
108 }
109
113 double getTime() const final override;
114
115 double getTimeWindowStart() const final override;
116
120 int getTimeWindows() const final override
121 {
122 return _timeWindows;
123 }
124
125 bool hasTimeWindowSize() const final override
126 {
127 return true;
128 }
129
133 double getTimeWindowSize() const final override
134 {
135 return 1.0;
136 }
137
141 double getNextTimeStepMaxSize() const final override
142 {
143 PRECICE_ASSERT(false);
144 return 0;
145 }
146
150 bool isCouplingOngoing() const final override;
151
155 bool isTimeWindowComplete() const final override
156 {
157 PRECICE_ASSERT(false);
158 return false;
159 }
160
164 bool isActionRequired(Action action) const final override;
165
166 bool isActionFulfilled(Action action) const final override
167 {
168 return true;
169 }
170
174 void markActionFulfilled(Action action) final override
175 {
176 PRECICE_ASSERT(false);
177 }
178
183 {
184 PRECICE_ASSERT(false);
185 return 0;
186 }
187
191 void requireAction(Action action) final override
192 {
193 PRECICE_ASSERT(false);
194 }
195
199 std::string printCouplingState() const final override
200 {
201 return std::string();
202 }
203
204 bool isImplicitCouplingScheme() const override
205 {
206 return _numberIterations > 1;
207 }
208
209 bool hasConverged() const override;
210
211 bool requiresSubsteps() const final override
212 {
213 return true;
214 }
215
216 ImplicitData implicitDataToReceive() const final override
217 {
218 return {};
219 }
220
221private:
222 mutable logging::Logger _log{"cplscheme::tests::DummyCouplingScheme"};
223
226
228 int _iterations = 0;
229
232
235
237 bool _isInitialized = false;
238
240 bool _isOngoing = false;
241
243 bool _hasConverged = false;
244};
245
246} // namespace precice::cplscheme::tests
#define PRECICE_ASSERT(...)
Definition assertion.hpp:85
Interface for all coupling schemes.
Action
Actions that are required by CouplingSchemes.
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.
int getTimeWindows() const final override
Not implemented.
bool sendsInitializedData() const final override
Not implemented.
std::vector< std::string > getCouplingPartners() const final override
Returns list of all coupling partners.
void requireAction(Action action) final override
Not implemented.
bool willDataBeExchanged(double lastSolverTimeStepSize) const final override
Not implemented.
std::string printCouplingState() const final override
Empty.
DummyCouplingScheme(int numberIterations, int maxTimeWindows)
Constructor.
double getTime() const final override
Not implemented.
int _timeWindows
Performed number of time windows.
bool requiresSubsteps() const final override
Returns true if any send data of the scheme requires substeps.
ImplicitData implicitDataToReceive() const final override
Returns a vector of implicit data to receive in the next advance.
bool isImplicitCouplingScheme() const override
Returns true if the scheme or one subscheme is implicit.
void markActionFulfilled(Action action) final override
Not implemented.
ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override
bool hasDataBeenReceived() const final override
Not implemented.
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.
bool isTimeWindowComplete() const final override
Not implemented.
bool isInitialized() const final override
Not implemented.
bool isActionFulfilled(Action action) const final override
Returns true, if the given action has already been performed by the accessor.
std::string localParticipant() const final override
Returns the name of the local participant.
int _numberIterations
Number of iterations performed per time window. 1 --> explicit.
bool hasTimeWindowSize() const final override
Returns true, if time window size is prescribed by the cpl scheme.
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 reinitialize() final override
Reinitializes the coupling scheme, coupling data, and acceleration schemes.
double getTimeWindowSize() const final override
Not implemented.
void initialize() final override
Destructor, empty.
double getNextTimeStepMaxSize() const final override
Not implemented.
This class provides a lightweight logger.
Definition Logger.hpp:17
STL class.
contains actions to modify exchanged data.
Definition Action.hpp:6
STL namespace.