preCICE v3.1.2
Loading...
Searching...
No Matches
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 {
23namespace cplscheme {
24class CompositionalCouplingScheme;
25class BiCouplingScheme;
26} // namespace cplscheme
27} // namespace precice
28
29// Forward declaration to friend the boost test struct
30namespace CplSchemeTests {
31namespace ParallelImplicitCouplingSchemeTests {
32struct testParseConfigurationWithRelaxation;
33}
34namespace SerialImplicitCouplingSchemeTests {
35struct testParseConfigurationWithRelaxation;
36}
37} // namespace CplSchemeTests
38
39// ----------------------------------------------------------- CLASS DEFINITION
40namespace precice {
41namespace cplscheme {
42class MultiCouplingScheme;
43
46public:
56 xml::XMLTag & parent,
59 config::PtrParticipantConfiguration participantConfig);
60
61 void setExperimental(bool experimental);
62
65
67 bool hasCouplingScheme(const std::string &participantName) const;
68
70 const PtrCouplingScheme &getCouplingScheme(const std::string &participantName) const;
71
74
76 virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag);
77
79 virtual void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag);
80
82 void addCouplingScheme(const PtrCouplingScheme &cplScheme, const std::string &participantName);
83
84private:
85 mutable logging::Logger _log{"cplscheme::CouplingSchemeConfiguration"};
86
100
120
128
129 static const int DEFAULT_MIN_ITERATIONS;
130 static const int DEFAULT_MAX_ITERATIONS;
131
140
172
174
176
178
180
183
186
187 void addTypespecifcSubtags(const std::string &type, xml::XMLTag &tag);
188
189 void addTransientLimitTags(const std::string &type, xml::XMLTag &tag);
190
192
194
195 void addTagExchange(xml::XMLTag &tag);
196
198
200
202
204
206
208
210
212
214 const std::string &dataName,
215 const std::string &meshName,
216 double limit,
217 bool suffices,
218 bool strict);
219
221 const std::string &dataName,
222 const std::string &meshName,
223 double absLimit,
224 double relLimit,
225 bool suffices,
226 bool strict);
227
229 const std::string &dataName,
230 const std::string &meshName,
231 double limit,
232 bool suffices,
233 bool strict);
234
236 const std::string &dataName,
237 const std::string &meshName,
238 double limit,
239 bool suffices,
240 bool strict);
241
243 const std::string &dataName,
244 const std::string &meshName) const;
245
247 int ID) const;
248
250 const std::string &accessor) const;
251
253 const std::string &accessor) const;
254
256 const std::string &accessor) const;
257
259 const std::string &accessor) const;
260
262 const std::string &accessor) const;
263
265 const std::string &method) const;
266
269 BiCouplingScheme & scheme,
270 const std::string &accessor) const;
271
277 MultiCouplingScheme &scheme,
278 const std::string & accessor) const;
279
281 DataID dataID) const;
282
284 DataID dataID, const std::string &first, const std::string &second) const;
285
287 BaseCouplingScheme * scheme,
288 const std::string & participant,
289 const std::vector<ConvergenceMeasureDefintion> &convergenceMeasureDefinitions) const;
290
292 BaseCouplingScheme *scheme,
293 const std::string & first,
294 const std::string & second) const;
295
297 BaseCouplingScheme *scheme,
298 const std::string & participant) const;
299
300 friend struct CplSchemeTests::ParallelImplicitCouplingSchemeTests::testParseConfigurationWithRelaxation; // For whitebox tests
301 friend struct CplSchemeTests::SerialImplicitCouplingSchemeTests::testParseConfigurationWithRelaxation; // For whitebox tests
302
314 void checkSubstepExchangeWaveformDegree(const Config::Exchange &exchange) const;
315
318
322 void checkIterationLimits() const;
323};
324} // namespace cplscheme
325} // namespace precice
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
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.
virtual void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback method required when using xml::XMLTag.
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.
virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback method required when using xml::XMLTag.
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:16
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:31
vector< double > getData()
Definition mainA.cpp:19
Main namespace of the precice library.
int DataID
Definition Types.hpp:25
std::vector< ConvergenceMeasureDefintion > convergenceMeasureDefinitions
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:24
Callback interface for configuration classes using XMLTag.
Definition XMLTag.hpp:43