preCICE v3.1.1
Loading...
Searching...
No Matches
CompositionalCouplingScheme.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <string>
5#include <vector>
6#include "Constants.hpp"
7#include "CouplingScheme.hpp"
8#include "SharedPointer.hpp"
10#include "logging/Logger.hpp"
11
12namespace precice {
13namespace cplscheme {
14
58public:
61
72 void addCouplingScheme(const PtrCouplingScheme &scheme);
73
80 void initialize(
81 double startTime,
82 int startTimeWindow) final override;
83
85 bool sendsInitializedData() const override final;
86
88 bool isInitialized() const final override;
89
91 bool addComputedTime(double timeToAdd) final override;
92
94 //void advance() final override;
95
96 ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override;
97
98 void firstExchange() override;
99
101
102 void secondExchange() override;
103
105 void finalize() final override;
106
108 std::vector<std::string> getCouplingPartners() const final override;
109
119 bool willDataBeExchanged(double lastSolverTimeStepSize) const final override;
120
125 bool hasDataBeenReceived() const final override;
126
132 double getTime() const final override;
133
134 double getTimeWindowStart() const override final;
135
141 int getTimeWindows() const final override;
142
147 bool hasTimeWindowSize() const final override;
148
156 double getTimeWindowSize() const final override;
157
166 double getNextTimeStepMaxSize() const final override;
167
173 bool isCouplingOngoing() const final override;
174
180 bool isTimeWindowComplete() const final override;
181
187 bool isActionRequired(Action action) const final override;
188
190 bool isActionFulfilled(Action action) const final override;
191
193 void markActionFulfilled(Action action) final override;
194
196 void requireAction(Action action) final override;
197
199 std::string printCouplingState() const final override;
200
202 bool isImplicitCouplingScheme() const final;
203
205 bool hasConverged() const final;
206
208 bool requiresSubsteps() const override final;
209
211 ImplicitData implicitDataToReceive() const override final;
212
213private:
214 mutable logging::Logger _log{"cplscheme::CompositionalCouplingScheme"};
215
217
220
223
232
236 void updateActiveSchemes();
237
240
243};
244
245} // namespace cplscheme
246} // namespace precice
Acts as one coupling scheme, but consists of several composed ones.
bool requiresSubsteps() const override final
Returns true if any send data of the scheme requires substeps.
PtrCouplingScheme _implicitScheme
The optional implicit scheme to be handled last.
void initialize(double startTime, int startTimeWindow) final override
Initializes the coupling scheme and establishes a communication connection to the coupling partner.
std::vector< CouplingScheme * > activeOrAllSchemes() const
Actions also work before initialize is called.
bool isTimeWindowComplete() const final override
Returns true, when the accessor can advance to the next time window.
bool hasConverged() const final
True if the implicit scheme has converged or no implicit scheme is defined.
std::vector< CouplingScheme * > allSchemes() const
Returns all schemes in execution order, explicit as well as implicit.
void finalize() final override
Finalizes the coupling and disconnects communication.
bool isImplicitCouplingScheme() const final
True if one cplscheme is an implicit scheme.
bool isCouplingOngoing() const final override
Returns true, when the coupled simulation is still ongoing.
double getTime() const final override
Returns the currently computed time of the coupling scheme.
std::vector< std::string > getCouplingPartners() const final override
Returns list of all coupling partners.
Schemes _explicitSchemes
Explicit coupling schemes to be executed.
double getTimeWindowSize() const final override
Returns the time window size, if one is given by the coupling scheme.
bool isActionRequired(Action action) const final override
Returns true, if the given action has to be performed by the accessor.
void markActionFulfilled(Action action) final override
Tells the coupling scheme that the accessor has performed the given action.
bool addComputedTime(double timeToAdd) final override
Adds newly computed time. Has to be called before every advance.
bool hasDataBeenReceived() const final override
checks all coupling schemes this coupling scheme is composed of.
int getTimeWindows() const final override
Returns the currently computed time windows of the coupling scheme.
void requireAction(Action action) final override
Sets an action required to be performed by the accessor.
bool isInitialized() const final override
Returns true, if initialize has been called.
double getNextTimeStepMaxSize() const final override
Returns the maximal size of the next time step to be computed.
bool hasTimeWindowSize() const final override
Returns true, if time window size is given by any of the coupling schemes in this compositional coupl...
void addCouplingScheme(const PtrCouplingScheme &scheme)
Adds another coupling scheme in parallel to this scheme.
ChangedMeshes firstSynchronization(const ChangedMeshes &changes) override
Exchanges data and updates the state of the coupling scheme.
bool willDataBeExchanged(double lastSolverTimeStepSize) const final override
Returns true, if data will be exchanged when calling advance().
std::string printCouplingState() const final override
Returns a string representation of the current coupling state.
bool sendsInitializedData() const override final
Returns true, if any of the composed coupling schemes sendsInitializedData for this participant.
ImplicitData implicitDataToReceive() const override final
Returns a vector of implicit data to receive in the next advance.
bool isActionFulfilled(Action action) const final override
Returns true, if the given action has been performed by the accessor.
Interface for all coupling schemes.
Action
Actions that are required by CouplingSchemes.
Main namespace of the precice library.
STL namespace.