preCICE v3.1.2
Loading...
Searching...
No Matches
CompositionalCouplingSchemeTest.cpp
Go to the documentation of this file.
1#include <Eigen/Core>
2#include <algorithm>
3#include <cmath>
4#include <memory>
5#include <string>
6#include <vector>
8#include "../Constants.hpp"
13#include "m2n/M2N.hpp"
14#include "m2n/SharedPointer.hpp"
16#include "mesh/Data.hpp"
17#include "mesh/Mesh.hpp"
23#include "testing/Testing.hpp"
24#include "xml/XMLTag.hpp"
25
26using namespace precice;
27using namespace precice::cplscheme;
28
29#ifndef PRECICE_NO_MPI
30
31BOOST_AUTO_TEST_SUITE(CplSchemeTests)
32
33struct CompositionalCouplingSchemeFixture : m2n::WhiteboxAccessor {
35
37 {
38 _pathToTests = testing::getPathToSources() + "/cplscheme/tests/";
39 }
40
42 {
43 using namespace mesh;
44
45 std::string nameParticipant0("Participant0");
46 std::string nameParticipant1("Participant1");
47 std::string nameParticipant2("Participant2");
48
50 PtrDataConfiguration dataConfig(new DataConfiguration(root));
51 PtrMeshConfiguration meshConfig(new MeshConfiguration(root, dataConfig));
54 CouplingSchemeConfiguration cplSchemeConfig(root, meshConfig, m2nConfig, participantConfig);
55
56 const xml::ConfigurationContext ccontext{context.name, 0, 1};
57 xml::configure(root, ccontext, configFilename);
58
59 // some dummy mesh
60 meshConfig->meshes().at(0)->createVertex(Eigen::Vector3d(1.0, 1.0, 1.0));
61 meshConfig->meshes().at(0)->createVertex(Eigen::Vector3d(2.0, 1.0, -1.0));
62 meshConfig->meshes().at(0)->createVertex(Eigen::Vector3d(3.0, 1.0, 1.0));
63 meshConfig->meshes().at(0)->createVertex(Eigen::Vector3d(4.0, 1.0, -1.0));
64
65 m2n::PtrM2N m2n0 = m2nConfig->getM2N(nameParticipant0, nameParticipant1);
66 m2n::PtrM2N m2n1 = m2nConfig->getM2N(nameParticipant1, nameParticipant2);
67
68 if (context.isNamed(nameParticipant0)) {
69 connect(nameParticipant0, nameParticipant1, context.name, m2n0);
70 } else if (context.isNamed(nameParticipant1)) {
71 connect(nameParticipant0, nameParticipant1, context.name, m2n0);
72 connect(nameParticipant1, nameParticipant2, context.name, m2n1);
73 } else {
74 connect(nameParticipant1, nameParticipant2, context.name, m2n1);
75 }
76
77 runThreeSolverCoupling(cplSchemeConfig.getCouplingScheme(context.name),
78 context.name, meshConfig);
79 }
80
82 PtrCouplingScheme cplScheme,
83 const std::string & participantName,
85 {
86 BOOST_TEST(meshConfig->meshes().size() == 1);
87 mesh::PtrMesh mesh = meshConfig->meshes().at(0);
88 BOOST_TEST(mesh->data().size() == 3);
89 BOOST_TEST(mesh->nVertices() > 0);
90
91 double computedTime = 0.0;
92 int computedTimesteps = 0;
93
94 if (participantName == std::string("Participant0")) {
95 mesh->data(0)->setSampleAtTime(0, time::Sample{1, mesh->data(0)->values()});
96 cplScheme->initialize(0.0, 1);
97 BOOST_TEST(not cplScheme->hasDataBeenReceived());
98 BOOST_TEST(not cplScheme->isTimeWindowComplete());
99 BOOST_TEST(cplScheme->isCouplingOngoing());
100 while (cplScheme->isCouplingOngoing()) {
101 BOOST_REQUIRE(computedTime < 1.1);
102 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
103 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
104 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
105 }
106 double stepSize = cplScheme->getNextTimeStepMaxSize();
107 mesh->data(0)->setSampleAtTime(computedTime + stepSize, time::Sample{1, mesh->data(0)->values()});
108 BOOST_TEST(cplScheme->getTime() == computedTime);
109 cplScheme->addComputedTime(stepSize);
110 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
111 cplScheme->firstSynchronization({});
112 cplScheme->firstExchange();
113 cplScheme->secondSynchronization();
114 cplScheme->secondExchange();
115 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
116 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
117 } else {
118 BOOST_TEST(cplScheme->isTimeWindowComplete());
119 computedTime += stepSize;
120 computedTimesteps++;
121 }
122 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
123 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
124 BOOST_TEST(cplScheme->hasDataBeenReceived());
125 }
126 cplScheme->finalize();
127 BOOST_TEST(computedTimesteps == 10);
128 BOOST_TEST(cplScheme->isTimeWindowComplete());
129 BOOST_TEST(not cplScheme->isCouplingOngoing());
130 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
131 } else if (participantName == std::string("Participant1")) {
132 auto ddims = mesh->data(1)->getDimensions();
133 mesh->data(1)->setSampleAtTime(0, time::Sample{ddims, mesh->data(1)->values()});
134 cplScheme->initialize(0.0, 1);
135 BOOST_TEST(cplScheme->hasDataBeenReceived());
136 BOOST_TEST(not cplScheme->isTimeWindowComplete());
137 BOOST_TEST(cplScheme->isCouplingOngoing());
138 while (cplScheme->isCouplingOngoing()) {
139 BOOST_REQUIRE(computedTime < 1.1);
140 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
141 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
142 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
143 }
144 double stepSize = cplScheme->getNextTimeStepMaxSize();
145 mesh->data(1)->setSampleAtTime(computedTime + stepSize, time::Sample{ddims, mesh->data(1)->values()});
146 BOOST_TEST(cplScheme->getTime() == computedTime);
147 cplScheme->addComputedTime(stepSize);
148 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
149 cplScheme->firstSynchronization({});
150 cplScheme->firstExchange();
151 cplScheme->secondSynchronization();
152 cplScheme->secondExchange();
153 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
154 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
155 } else {
156 BOOST_TEST(cplScheme->isTimeWindowComplete());
157 computedTime += stepSize;
158 computedTimesteps++;
159 }
160 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
161 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
162 BOOST_TEST(cplScheme->hasDataBeenReceived());
163 }
164 cplScheme->finalize();
165 BOOST_TEST(computedTimesteps == 10);
166 BOOST_TEST(cplScheme->isTimeWindowComplete());
167 BOOST_TEST(not cplScheme->isCouplingOngoing());
168 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
169 } else {
170 auto ddims = mesh->data(2)->getDimensions();
171 BOOST_TEST(participantName == std::string("Participant2"), participantName);
172 mesh->data(2)->setSampleAtTime(0, time::Sample{ddims, mesh->data(2)->values()});
173 cplScheme->initialize(0.0, 1);
174 BOOST_TEST(cplScheme->hasDataBeenReceived());
175 BOOST_TEST(not cplScheme->isTimeWindowComplete());
176 BOOST_TEST(cplScheme->isCouplingOngoing());
177 while (cplScheme->isCouplingOngoing()) {
178 BOOST_REQUIRE(computedTime < 1.1);
179 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
180 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
181 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
182 }
183 double stepSize = cplScheme->getNextTimeStepMaxSize();
184 mesh->data(2)->setSampleAtTime(cplScheme->getNextTimeStepMaxSize(), time::Sample{ddims, mesh->data(2)->values()});
185 BOOST_TEST(cplScheme->getTime() == computedTime);
186 cplScheme->addComputedTime(stepSize);
187 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
188 cplScheme->firstSynchronization({});
189 cplScheme->firstExchange();
190 cplScheme->secondSynchronization();
191 cplScheme->secondExchange();
192 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
193 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
194 } else {
195 BOOST_TEST(cplScheme->isTimeWindowComplete());
196 computedTime += stepSize;
197 computedTimesteps++;
198 }
199 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
200 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
201 if (cplScheme->isCouplingOngoing())
202 BOOST_TEST(cplScheme->hasDataBeenReceived());
203 }
204 cplScheme->finalize();
205 BOOST_TEST(computedTimesteps == 10);
206 BOOST_TEST(cplScheme->isTimeWindowComplete());
207 BOOST_TEST(not cplScheme->isCouplingOngoing());
208 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
209 }
210 }
211
212 void connect(const std::string &participant0,
213 const std::string &participant1,
214 const std::string &localParticipant,
215 m2n::PtrM2N communication) const
216 {
217 BOOST_TEST(communication);
218 BOOST_TEST(not communication->isConnected());
219 useOnlyPrimaryCom(communication) = true;
220 if (participant0 == localParticipant) {
221 communication->requestPrimaryRankConnection(participant1, participant0);
222 } else {
223 BOOST_TEST(participant1 == localParticipant);
224 communication->acceptPrimaryRankConnection(participant1, participant0);
225 }
226 }
227};
228
229BOOST_AUTO_TEST_SUITE(DummySchemeCompositionTests)
230
231// Test two explicit dummy coupling schemes
232BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit2)
233{
234 PRECICE_TEST(1_rank, Require::Events);
235 int numberIterations = 1;
236 int maxTimeWindows = 10;
237 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
238 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
239 CompositionalCouplingScheme composition;
240 composition.addCouplingScheme(scheme1);
241 composition.addCouplingScheme(scheme2);
242 composition.initialize(0.0, 1);
243 int advances = 0;
244 while (composition.isCouplingOngoing()) {
245 composition.addComputedTime(1.0);
246 composition.firstSynchronization({});
247 composition.firstExchange();
248 composition.secondSynchronization();
249 composition.secondExchange();
250 advances++;
251 }
252 composition.finalize();
253 BOOST_TEST(advances == 10);
254 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
255 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
256}
257
258// Test three explicit dummy coupling schemes
259BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit3)
260{
261 PRECICE_TEST(1_rank, Require::Events);
262 int numberIterations = 1;
263 int maxTimeWindows = 10;
264 PtrCouplingScheme scheme1(
265 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
266 PtrCouplingScheme scheme2(
267 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
268 PtrCouplingScheme scheme3(
269 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
270 CompositionalCouplingScheme composition;
271 composition.addCouplingScheme(scheme1);
272 composition.addCouplingScheme(scheme2);
273 composition.addCouplingScheme(scheme3);
274 composition.initialize(0.0, 1);
275 int advances = 0;
276 while (composition.isCouplingOngoing()) {
277 composition.addComputedTime(1.0);
278 composition.firstSynchronization({});
279 composition.firstExchange();
280 composition.secondSynchronization();
281 composition.secondExchange();
282 advances++;
283 }
284 composition.finalize();
285 BOOST_TEST(advances == 10);
286 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
287 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
288 BOOST_TEST(scheme3->getTimeWindows() - 1 == 10);
289}
290
291// Test E, I(2)
292BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit1Implicit2)
293{
294 PRECICE_TEST(1_rank, Require::Events);
295 int numberIterations = 1;
296 int maxTimeWindows = 10;
297 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
298 numberIterations = 2;
299 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
300 CompositionalCouplingScheme composition;
301 composition.addCouplingScheme(scheme1);
302 composition.addCouplingScheme(scheme2);
303 composition.initialize(0.0, 1);
304 int advances = 0;
305 BOOST_TEST_MESSAGE("Init Expl " << scheme1->getTimeWindows());
306 BOOST_TEST_MESSAGE("Init Impl " << scheme2->getTimeWindows());
307 while (composition.isCouplingOngoing()) {
308 composition.addComputedTime(1.0);
309 composition.firstSynchronization({});
310 composition.firstExchange();
311 composition.secondSynchronization();
312 composition.secondExchange();
313 advances++;
314 // a 1, e 2, i 2
315 BOOST_TEST_CONTEXT("Advance Nr " << advances)
316 {
317 BOOST_TEST_MESSAGE("Expl " << scheme1->getTimeWindows());
318 BOOST_TEST_MESSAGE("Impl " << scheme2->getTimeWindows());
319 if (advances % 2 == 0) {
320 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
321 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 2);
322 } else {
323 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
324 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances + 1) / 2);
325 }
326 }
327 }
328 composition.finalize();
329 BOOST_TEST(advances == 20);
330 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
331 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
332}
333
334// Test I(2), E
335BOOST_AUTO_TEST_CASE(testDummySchemeCompositionImplicit2Explicit1)
336{
337 PRECICE_TEST(1_rank, Require::Events);
338 int numberIterations = 2;
339 int maxTimeWindows = 10;
340 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
341 numberIterations = 1;
342 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
343 CompositionalCouplingScheme composition;
344 composition.addCouplingScheme(scheme1);
345 composition.addCouplingScheme(scheme2);
346 composition.initialize(0.0, 1);
347 int advances = 0;
348 while (composition.isCouplingOngoing()) {
349 composition.addComputedTime(1.0);
350 composition.firstSynchronization({});
351 composition.firstExchange();
352 composition.secondSynchronization();
353 composition.secondExchange();
354 advances++;
355 if (advances % 2 == 0) {
356 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
357 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 2);
358 } else {
359 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
360 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances - 1) / 2);
361 }
362 }
363 composition.finalize();
364 BOOST_TEST(advances == 20);
365 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
366 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
367}
368
369// Test E, I(3)
370BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit1Implicit3)
371{
372 PRECICE_TEST(1_rank, Require::Events);
373 int numberIterations = 1;
374 int maxTimeWindows = 10;
375 PtrCouplingScheme scheme1(
376 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
377 numberIterations = 3;
378 PtrCouplingScheme scheme2(
379 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
380 CompositionalCouplingScheme composition;
381 composition.addCouplingScheme(scheme1);
382 composition.addCouplingScheme(scheme2);
383 composition.initialize(0.0, 1);
384 int advances = 0;
385 while (composition.isCouplingOngoing()) {
386 composition.addComputedTime(1.0);
387 composition.firstSynchronization({});
388 composition.firstExchange();
389 composition.secondSynchronization();
390 composition.secondExchange();
391 advances++;
392 if (advances % 3 == 0) {
393 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
394 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 3);
395 } else {
396 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
397 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances + (3 - advances % 3)) / 3);
398 }
399 }
400 composition.finalize();
401 BOOST_TEST(advances == 30);
402 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
403 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
404}
405
406// Test I(3), E
407BOOST_AUTO_TEST_CASE(testDummySchemeCompositionImplicit3Explicit1)
408{
409 PRECICE_TEST(1_rank, Require::Events);
410 int numberIterations = 3;
411 int maxTimeWindows = 10;
412 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
413 numberIterations = 1;
414 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
415 CompositionalCouplingScheme composition;
416 composition.addCouplingScheme(scheme1);
417 composition.addCouplingScheme(scheme2);
418 composition.initialize(0.0, 1);
419 int advances = 0;
420 while (composition.isCouplingOngoing()) {
421 composition.addComputedTime(1.0);
422 composition.firstSynchronization({});
423 composition.firstExchange();
424 composition.secondSynchronization();
425 composition.secondExchange();
426 advances++;
427 if (advances % 3 == 0) {
428 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
429 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 3);
430 } else {
431 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
432 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances - (advances % 3)) / 3);
433 }
434 }
435 composition.finalize();
436 BOOST_TEST(advances == 30);
437 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
438 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
439}
440
442
443BOOST_FIXTURE_TEST_SUITE(CompositionalCouplingSchemeTests, CompositionalCouplingSchemeFixture)
444
446BOOST_AUTO_TEST_CASE(testExplicitSchemeComposition1)
447{
448 PRECICE_TEST("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events);
449
450 std::string configPath(_pathToTests + "multi-solver-coupling-1.xml");
451 setupAndRunThreeSolverCoupling(configPath, context);
452}
453
455BOOST_AUTO_TEST_CASE(testImplicitExplicitSchemeComposition)
456{
457 PRECICE_TEST("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events);
458
459 std::string configPath(_pathToTests + "multi-solver-coupling-3.xml");
460 setupAndRunThreeSolverCoupling(configPath, context);
461}
462
464BOOST_AUTO_TEST_CASE(testExplicitImplicitSchemeComposition)
465{
466 PRECICE_TEST("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events);
467
468 std::string configPath(_pathToTests + "multi-solver-coupling-4.xml");
469 setupAndRunThreeSolverCoupling(configPath, context);
470}
471
474
475#endif // not PRECICE_NO_MPI
BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit2)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
#define PRECICE_TEST(...)
Definition Testing.hpp:27
Performs XML configuration of a participant.
Acts as one coupling scheme, but consists of several composed ones.
void initialize(double startTime, int startTimeWindow) final override
Initializes the coupling scheme and establishes a communication connection to the coupling partner.
void finalize() final override
Finalizes the coupling and disconnects communication.
bool isCouplingOngoing() const final override
Returns true, when the coupled simulation is still ongoing.
bool addComputedTime(double timeToAdd) final override
Adds newly computed time. Has to be called before every advance.
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.
const PtrCouplingScheme & getCouplingScheme(const std::string &participantName) const
Returns the configured coupling scheme.
virtual ChangedMeshes firstSynchronization(const ChangedMeshes &changes)=0
virtual bool addComputedTime(double timeToAdd)=0
Adds newly computed time. Has to be called before every advance.
virtual double getTime() const =0
Returns the currently computed time of the coupling scheme.
virtual void initialize(double startTime, int startTimeWindow)=0
Initializes the coupling scheme and establishes a communication connection to the coupling partner....
virtual ChangedMeshes secondSynchronization()=0
virtual void markActionFulfilled(Action action)=0
Tells the coupling scheme that the accessor has performed the given action.
virtual double getNextTimeStepMaxSize() const =0
Returns the maximal size of the next time step to be computed.
virtual bool isTimeWindowComplete() const =0
Returns true, when the accessor can advance to the next time window.
virtual void finalize()=0
Finalizes the coupling and disconnects communication.
virtual bool isCouplingOngoing() const =0
Returns true, when the coupled simulation is still ongoing.
virtual int getTimeWindows() const =0
Returns the currently computed time windows of the coupling scheme.
virtual bool isActionRequired(Action action) const =0
Returns true, if the given action has to be performed by the accessor.
virtual bool hasDataBeenReceived() const =0
Returns true, if data has been exchanged in last call of advance().
Used to test CompositionalCouplingScheme.
Configuration for communication channels between solvers.
bool isNamed(const std::string &name) const
Check whether this context has a given name.
std::string name
the name of the current participant
Represents an XML tag to be configured automatically.
Definition XMLTag.hpp:31
contains implementations of coupling schemes for coupled simulations.
boost::test_tools::predicate_result equals(const std::vector< float > &VectorA, const std::vector< float > &VectorB, float tolerance)
equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands o...
Definition Testing.cpp:65
std::string getPathToSources()
Returns the base path to the sources.
Definition Testing.cpp:31
XMLTag getRootTag()
Returns an XMLTag::Listener that does nothing on callbacks.
Definition XMLTag.cpp:389
void configure(XMLTag &tag, const precice::xml::ConfigurationContext &context, std::string_view configurationFilename)
Configures the given configuration from file configurationFilename.
Definition XMLTag.cpp:395
Main namespace of the precice library.
void runThreeSolverCoupling(PtrCouplingScheme cplScheme, const std::string &participantName, mesh::PtrMeshConfiguration meshConfig)
void connect(const std::string &participant0, const std::string &participant1, const std::string &localParticipant, m2n::PtrM2N communication) const
void setupAndRunThreeSolverCoupling(const std::string &configFilename, const precice::testing::TestContext &context)
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:24