preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouplingSchemeConfiguration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <string>
5#include <tuple>
6#include <vector>
7
14#include "logging/Logger.hpp"
20#include "xml/XMLTag.hpp"
21
22namespace precice::cplscheme {
23class CompositionalCouplingScheme;
24class BiCouplingScheme;
25} // namespace precice::cplscheme
26
27// Forward declaration to friend the boost test struct
28namespace CplSchemeTests {
29namespace ParallelImplicitCouplingSchemeTests {
30struct testParseConfigurationWithRelaxation;
31}
32namespace SerialImplicitCouplingSchemeTests {
33struct testParseConfigurationWithRelaxation;
34}
35} // namespace CplSchemeTests
36
37// ----------------------------------------------------------- CLASS DEFINITION
38
39namespace precice::cplscheme {
40class MultiCouplingScheme;
41
44public:
54 xml::XMLTag &parent,
57 config::PtrParticipantConfiguration participantConfig);
58
59 void setRemeshing(bool allowed);
60
62 ~CouplingSchemeConfiguration() override = default;
63
65 bool hasCouplingScheme(const std::string &participantName) const;
66
68 const PtrCouplingScheme &getCouplingScheme(const std::string &participantName) const;
69
72
74 void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override;
75
77 void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override;
78
80 void addCouplingScheme(const PtrCouplingScheme &cplScheme, const std::string &participantName);
81
82private:
83 bool _allowRemeshing = false;
84 mutable logging::Logger _log{"cplscheme::CouplingSchemeConfiguration"};
85
99
119
127
128 static const int DEFAULT_MIN_ITERATIONS;
129 static const int DEFAULT_MAX_ITERATIONS;
130
138
170
172
174
176
178
181
184
185 void addTypespecifcSubtags(const std::string &type, xml::XMLTag &tag);
186
187 void addTransientLimitTags(const std::string &type, xml::XMLTag &tag);
188
190
192
193 void addTagExchange(xml::XMLTag &tag, bool substepsDefault);
194
196
198
200
202
204
206
208
210
212 const std::string &dataName,
213 const std::string &meshName,
214 double limit,
215 bool suffices,
216 bool strict);
217
219 const std::string &dataName,
220 const std::string &meshName,
221 double absLimit,
222 double relLimit,
223 bool suffices,
224 bool strict);
225
227 const std::string &dataName,
228 const std::string &meshName,
229 double limit,
230 bool suffices,
231 bool strict);
232
234 const std::string &dataName,
235 const std::string &meshName,
236 double limit,
237 bool suffices,
238 bool strict);
239
241 const std::string &dataName,
242 const std::string &meshName) const;
243
245 int ID) const;
246
248 const std::string &accessor) const;
249
251 const std::string &accessor) const;
252
254 const std::string &accessor) const;
255
257 const std::string &accessor) const;
258
260 const std::string &accessor) const;
261
263 const std::string &method) const;
264
267 BiCouplingScheme &scheme,
268 const std::string &accessor) const;
269
275 MultiCouplingScheme &scheme,
276 const std::string &accessor) const;
277
279 DataID dataID) const;
280
282 DataID dataID, const std::string &first, const std::string &second) const;
283
285 BaseCouplingScheme *scheme,
286 const std::string &participant,
287 const std::vector<ConvergenceMeasureDefintion> &convergenceMeasureDefinitions) const;
288
290 BaseCouplingScheme *scheme,
291 const std::string &first,
292 const std::string &second) const;
293
295 BaseCouplingScheme *scheme,
296 const std::string &participant) const;
297
298 friend struct CplSchemeTests::ParallelImplicitCouplingSchemeTests::testParseConfigurationWithRelaxation; // For whitebox tests
299 friend struct CplSchemeTests::SerialImplicitCouplingSchemeTests::testParseConfigurationWithRelaxation; // For whitebox tests
300
312 void checkSubstepExchangeWaveformDegree(const Config::Exchange &exchange) const;
313
316
320 void checkIterationLimits() const;
321};
322} // namespace precice::cplscheme
unsigned int index
T any_of(T... args)
Abstract base class for standard coupling schemes.
Abstract base class for coupling schemes with two participants.
PtrCouplingScheme createSerialExplicitCouplingScheme(const std::string &accessor) const
void checkIterationLimits() const
Helper function to check iteration limits in conjunction with convergence measures.
const PtrCouplingScheme & getCouplingScheme(const std::string &participantName) const
Returns the configured coupling scheme.
precice::config::PtrParticipantConfiguration _participantConfig
void addMultiDataToBeExchanged(MultiCouplingScheme &scheme, const std::string &accessor) const
Adds configured exchange data to be sent or received to scheme. Only used specifically for MultiCoupl...
PtrCouplingScheme createSerialImplicitCouplingScheme(const std::string &accessor) const
~CouplingSchemeConfiguration() override=default
Destructor, empty.
void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback method required when using xml::XMLTag.
void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback method required when using xml::XMLTag.
void setSerialAcceleration(BaseCouplingScheme *scheme, const std::string &first, const std::string &second) const
void addResidualRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
void addAbsoluteConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
void addDataToBeExchanged(BiCouplingScheme &scheme, const std::string &accessor) const
Adds configured exchange data to be sent or received to scheme.
struct precice::cplscheme::CouplingSchemeConfiguration::Config _config
void checkSubstepExchangeWaveformDegree(const Config::Exchange &exchange) const
Helper function to check that waveform-degree and substep exchange are compatible.
constants::TimesteppingMethod getTimesteppingMethod(const std::string &method) const
void checkSerialImplicitAccelerationData(DataID dataID, const std::string &first, const std::string &second) const
acceleration::PtrAccelerationConfiguration _accelerationConfig
std::map< std::string, PtrCouplingScheme > _couplingSchemes
Map from participant name to coupling scheme (composition).
CouplingSchemeConfiguration(xml::XMLTag &parent, mesh::PtrMeshConfiguration meshConfig, m2n::M2NConfiguration::SharedPointer m2nConfig, config::PtrParticipantConfiguration participantConfig)
Constructor.
void addTagExchange(xml::XMLTag &tag, bool substepsDefault)
void addTypespecifcSubtags(const std::string &type, xml::XMLTag &tag)
PtrCouplingScheme createMultiCouplingScheme(const std::string &accessor) const
void addCouplingScheme(const PtrCouplingScheme &cplScheme, const std::string &participantName)
Adds a manually configured coupling scheme for a participant.
bool hasCouplingScheme(const std::string &participantName) const
Check, if a coupling scheme is configured for a participant.
void updateConfigForImplicitCoupling()
Helper to update some configs which may have a different meaning in implicit coupling.
void addAbsoluteOrRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double absLimit, double relLimit, bool suffices, bool strict)
PtrCouplingScheme createParallelImplicitCouplingScheme(const std::string &accessor) const
PtrCouplingScheme createParallelExplicitCouplingScheme(const std::string &accessor) const
void addTransientLimitTags(const std::string &type, xml::XMLTag &tag)
const std::string & getDataToExchange(int index) const
Returns the name of one dataset exchanged in the coupling scheme.
void addRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
std::map< std::string, CompositionalCouplingScheme * > _couplingSchemeCompositions
If a participant has more than one coupling scheme, a composition is created.
void addConvergenceMeasures(BaseCouplingScheme *scheme, const std::string &participant, const std::vector< ConvergenceMeasureDefintion > &convergenceMeasureDefinitions) const
void setParallelAcceleration(BaseCouplingScheme *scheme, const std::string &participant) const
static const double UNDEFINED_MAX_TIME
Does not define a time limit for the coupled simulation.
static const double UNDEFINED_TIME_WINDOW_SIZE
To be used, when the time window size is determined dynamically during the coupling.
static const int UNDEFINED_TIME_WINDOWS
Does not define limit on time windows for the coupled simulation.
A coupling scheme with multiple participants.
This class provides a lightweight logger.
Definition Logger.hpp:17
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:28
vector< double > getData()
Definition mainA.cpp:19
contains implementations of coupling schemes for coupled simulations.
int DataID
Definition Types.hpp:25
std::vector< ConvergenceMeasureDefintion > convergenceMeasureDefinitions
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:21
Callback interface for configuration classes using XMLTag.
Definition XMLTag.hpp:46