preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
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 time::Sample ssample{1, Eigen::VectorXd::Zero(mesh->nVertices())};
95 time::Sample vsample{3, Eigen::VectorXd::Zero(mesh->nVertices() * 3)};
96
97 if (participantName == std::string("Participant0")) {
98 mesh->data("Data0")->setSampleAtTime(0, ssample);
99 cplScheme->initialize();
100 BOOST_TEST(not cplScheme->hasDataBeenReceived());
101 BOOST_TEST(not cplScheme->isTimeWindowComplete());
102 BOOST_TEST(cplScheme->isCouplingOngoing());
103 while (cplScheme->isCouplingOngoing()) {
104 BOOST_REQUIRE(computedTime < 1.1);
105 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
106 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
107 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
108 }
109 double stepSize = cplScheme->getNextTimeStepMaxSize();
110 mesh->data("Data0")->setSampleAtTime(computedTime + stepSize, ssample);
111 BOOST_TEST(cplScheme->getTime() == computedTime);
112 cplScheme->addComputedTime(stepSize);
113 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
114 cplScheme->firstSynchronization({});
115 cplScheme->firstExchange();
116 cplScheme->secondSynchronization();
117 cplScheme->secondExchange();
118 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
119 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
120 } else {
121 BOOST_TEST(cplScheme->isTimeWindowComplete());
122 computedTime += stepSize;
123 computedTimesteps++;
124 }
125 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
126 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
127 BOOST_TEST(cplScheme->hasDataBeenReceived());
128 }
129 cplScheme->finalize();
130 BOOST_TEST(computedTimesteps == 10);
131 BOOST_TEST(cplScheme->isTimeWindowComplete());
132 BOOST_TEST(not cplScheme->isCouplingOngoing());
133 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
134 } else if (participantName == std::string("Participant1")) {
135 mesh->data("Data1")->setSampleAtTime(0, vsample);
136 cplScheme->initialize();
137 BOOST_TEST(cplScheme->hasDataBeenReceived());
138 BOOST_TEST(not cplScheme->isTimeWindowComplete());
139 BOOST_TEST(cplScheme->isCouplingOngoing());
140 while (cplScheme->isCouplingOngoing()) {
141 BOOST_REQUIRE(computedTime < 1.1);
142 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
143 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
144 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
145 }
146 double stepSize = cplScheme->getNextTimeStepMaxSize();
147 mesh->data("Data1")->setSampleAtTime(computedTime + stepSize, vsample);
148 BOOST_TEST(cplScheme->getTime() == computedTime);
149 cplScheme->addComputedTime(stepSize);
150 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
151 cplScheme->firstSynchronization({});
152 cplScheme->firstExchange();
153 cplScheme->secondSynchronization();
154 cplScheme->secondExchange();
155 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
156 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
157 } else {
158 BOOST_TEST(cplScheme->isTimeWindowComplete());
159 computedTime += stepSize;
160 computedTimesteps++;
161 }
162 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
163 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
164 BOOST_TEST(cplScheme->hasDataBeenReceived());
165 }
166 cplScheme->finalize();
167 BOOST_TEST(computedTimesteps == 10);
168 BOOST_TEST(cplScheme->isTimeWindowComplete());
169 BOOST_TEST(not cplScheme->isCouplingOngoing());
170 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
171 } else {
172 BOOST_TEST(participantName == std::string("Participant2"), participantName);
173 mesh->data("Data2")->setSampleAtTime(0, vsample);
174 cplScheme->initialize();
175 BOOST_TEST(cplScheme->hasDataBeenReceived());
176 BOOST_TEST(not cplScheme->isTimeWindowComplete());
177 BOOST_TEST(cplScheme->isCouplingOngoing());
178 while (cplScheme->isCouplingOngoing()) {
179 BOOST_REQUIRE(computedTime < 1.1);
180 BOOST_TEST(testing::equals(0.1, cplScheme->getNextTimeStepMaxSize()));
181 if (cplScheme->isActionRequired(CouplingScheme::Action::WriteCheckpoint)) {
182 cplScheme->markActionFulfilled(CouplingScheme::Action::WriteCheckpoint);
183 }
184 double stepSize = cplScheme->getNextTimeStepMaxSize();
185 mesh->data("Data2")->setSampleAtTime(cplScheme->getNextTimeStepMaxSize(), vsample);
186 BOOST_TEST(cplScheme->getTime() == computedTime);
187 cplScheme->addComputedTime(stepSize);
188 BOOST_TEST(cplScheme->getTime() == computedTime + stepSize); // ensure that time is correctly updated, even if iterating. See https://github.com/precice/precice/pull/1792.
189 cplScheme->firstSynchronization({});
190 cplScheme->firstExchange();
191 cplScheme->secondSynchronization();
192 cplScheme->secondExchange();
193 if (cplScheme->isActionRequired(CouplingScheme::Action::ReadCheckpoint)) {
194 cplScheme->markActionFulfilled(CouplingScheme::Action::ReadCheckpoint);
195 } else {
196 BOOST_TEST(cplScheme->isTimeWindowComplete());
197 computedTime += stepSize;
198 computedTimesteps++;
199 }
200 BOOST_TEST(testing::equals(computedTime, cplScheme->getTime()));
201 BOOST_TEST(computedTimesteps == cplScheme->getTimeWindows() - 1);
202 if (cplScheme->isCouplingOngoing())
203 BOOST_TEST(cplScheme->hasDataBeenReceived());
204 }
205 cplScheme->finalize();
206 BOOST_TEST(computedTimesteps == 10);
207 BOOST_TEST(cplScheme->isTimeWindowComplete());
208 BOOST_TEST(not cplScheme->isCouplingOngoing());
209 BOOST_TEST(cplScheme->getNextTimeStepMaxSize() == 0.0);
210 }
211 }
212
213 void connect(const std::string &participant0,
214 const std::string &participant1,
215 const std::string &localParticipant,
216 m2n::PtrM2N communication) const
217 {
218 BOOST_TEST(communication);
219 BOOST_TEST(not communication->isConnected());
220 useOnlyPrimaryCom(communication) = true;
221 if (participant0 == localParticipant) {
222 communication->requestPrimaryRankConnection(participant1, participant0, "");
223 } else {
224 BOOST_TEST(participant1 == localParticipant);
225 communication->acceptPrimaryRankConnection(participant1, participant0, "");
226 }
227 }
228};
229
230BOOST_AUTO_TEST_SUITE(DummySchemeCompositionTests)
231
232// Test two explicit dummy coupling schemes
233PRECICE_TEST_SETUP(1_rank, Require::Events)
234BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit2)
235{
236 PRECICE_TEST();
237 int numberIterations = 1;
238 int maxTimeWindows = 10;
239 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
240 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
241 CompositionalCouplingScheme composition;
242 composition.addCouplingScheme(scheme1);
243 composition.addCouplingScheme(scheme2);
244 composition.initialize();
245 int advances = 0;
246 while (composition.isCouplingOngoing()) {
247 composition.addComputedTime(1.0);
248 composition.firstSynchronization({});
249 composition.firstExchange();
250 composition.secondSynchronization();
251 composition.secondExchange();
252 advances++;
253 }
254 composition.finalize();
255 BOOST_TEST(advances == 10);
256 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
257 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
258}
259
260// Test three explicit dummy coupling schemes
261PRECICE_TEST_SETUP(1_rank, Require::Events)
262BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit3)
263{
264 PRECICE_TEST();
265 int numberIterations = 1;
266 int maxTimeWindows = 10;
267 PtrCouplingScheme scheme1(
268 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
269 PtrCouplingScheme scheme2(
270 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
271 PtrCouplingScheme scheme3(
272 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
273 CompositionalCouplingScheme composition;
274 composition.addCouplingScheme(scheme1);
275 composition.addCouplingScheme(scheme2);
276 composition.addCouplingScheme(scheme3);
277 composition.initialize();
278 int advances = 0;
279 while (composition.isCouplingOngoing()) {
280 composition.addComputedTime(1.0);
281 composition.firstSynchronization({});
282 composition.firstExchange();
283 composition.secondSynchronization();
284 composition.secondExchange();
285 advances++;
286 }
287 composition.finalize();
288 BOOST_TEST(advances == 10);
289 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
290 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
291 BOOST_TEST(scheme3->getTimeWindows() - 1 == 10);
292}
293
294// Test E, I(2)
295PRECICE_TEST_SETUP(1_rank, Require::Events)
296BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit1Implicit2)
297{
298 PRECICE_TEST();
299 int numberIterations = 1;
300 int maxTimeWindows = 10;
301 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
302 numberIterations = 2;
303 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
304 CompositionalCouplingScheme composition;
305 composition.addCouplingScheme(scheme1);
306 composition.addCouplingScheme(scheme2);
307 composition.initialize();
308 int advances = 0;
309 BOOST_TEST_MESSAGE("Init Expl " << scheme1->getTimeWindows());
310 BOOST_TEST_MESSAGE("Init Impl " << scheme2->getTimeWindows());
311 while (composition.isCouplingOngoing()) {
312 composition.addComputedTime(1.0);
313 composition.firstSynchronization({});
314 composition.firstExchange();
315 composition.secondSynchronization();
316 composition.secondExchange();
317 advances++;
318 // a 1, e 2, i 2
319 BOOST_TEST_CONTEXT("Advance Nr " << advances)
320 {
321 BOOST_TEST_MESSAGE("Expl " << scheme1->getTimeWindows());
322 BOOST_TEST_MESSAGE("Impl " << scheme2->getTimeWindows());
323 if (advances % 2 == 0) {
324 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
325 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 2);
326 } else {
327 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
328 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances + 1) / 2);
329 }
330 }
331 }
332 composition.finalize();
333 BOOST_TEST(advances == 20);
334 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
335 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
336}
337
338// Test I(2), E
339PRECICE_TEST_SETUP(1_rank, Require::Events)
340BOOST_AUTO_TEST_CASE(testDummySchemeCompositionImplicit2Explicit1)
341{
342 PRECICE_TEST();
343 int numberIterations = 2;
344 int maxTimeWindows = 10;
345 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
346 numberIterations = 1;
347 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
348 CompositionalCouplingScheme composition;
349 composition.addCouplingScheme(scheme1);
350 composition.addCouplingScheme(scheme2);
351 composition.initialize();
352 int advances = 0;
353 while (composition.isCouplingOngoing()) {
354 composition.addComputedTime(1.0);
355 composition.firstSynchronization({});
356 composition.firstExchange();
357 composition.secondSynchronization();
358 composition.secondExchange();
359 advances++;
360 if (advances % 2 == 0) {
361 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
362 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 2);
363 } else {
364 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
365 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances - 1) / 2);
366 }
367 }
368 composition.finalize();
369 BOOST_TEST(advances == 20);
370 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
371 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
372}
373
374// Test E, I(3)
375PRECICE_TEST_SETUP(1_rank, Require::Events)
376BOOST_AUTO_TEST_CASE(testDummySchemeCompositionExplicit1Implicit3)
377{
378 PRECICE_TEST();
379 int numberIterations = 1;
380 int maxTimeWindows = 10;
381 PtrCouplingScheme scheme1(
382 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
383 numberIterations = 3;
384 PtrCouplingScheme scheme2(
385 new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
386 CompositionalCouplingScheme composition;
387 composition.addCouplingScheme(scheme1);
388 composition.addCouplingScheme(scheme2);
389 composition.initialize();
390 int advances = 0;
391 while (composition.isCouplingOngoing()) {
392 composition.addComputedTime(1.0);
393 composition.firstSynchronization({});
394 composition.firstExchange();
395 composition.secondSynchronization();
396 composition.secondExchange();
397 advances++;
398 if (advances % 3 == 0) {
399 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
400 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 3);
401 } else {
402 BOOST_TEST(scheme2->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
403 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances + (3 - advances % 3)) / 3);
404 }
405 }
406 composition.finalize();
407 BOOST_TEST(advances == 30);
408 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
409 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
410}
411
412// Test I(3), E
413PRECICE_TEST_SETUP(1_rank, Require::Events)
414BOOST_AUTO_TEST_CASE(testDummySchemeCompositionImplicit3Explicit1)
415{
416 PRECICE_TEST();
417 int numberIterations = 3;
418 int maxTimeWindows = 10;
419 PtrCouplingScheme scheme1(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
420 numberIterations = 1;
421 PtrCouplingScheme scheme2(new tests::DummyCouplingScheme(numberIterations, maxTimeWindows));
422 CompositionalCouplingScheme composition;
423 composition.addCouplingScheme(scheme1);
424 composition.addCouplingScheme(scheme2);
425 composition.initialize();
426 int advances = 0;
427 while (composition.isCouplingOngoing()) {
428 composition.addComputedTime(1.0);
429 composition.firstSynchronization({});
430 composition.firstExchange();
431 composition.secondSynchronization();
432 composition.secondExchange();
433 advances++;
434 if (advances % 3 == 0) {
435 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::WriteCheckpoint));
436 BOOST_TEST(scheme1->getTimeWindows() - 1 == advances / 3);
437 } else {
438 BOOST_TEST(scheme1->isActionRequired(CouplingScheme::Action::ReadCheckpoint));
439 BOOST_TEST(scheme1->getTimeWindows() - 1 == (advances - (advances % 3)) / 3);
440 }
441 }
442 composition.finalize();
443 BOOST_TEST(advances == 30);
444 BOOST_TEST(scheme1->getTimeWindows() - 1 == 10);
445 BOOST_TEST(scheme2->getTimeWindows() - 1 == 10);
446}
447
449
450BOOST_FIXTURE_TEST_SUITE(CompositionalCouplingSchemeTests, CompositionalCouplingSchemeFixture)
451
453PRECICE_TEST_SETUP("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events)
454BOOST_AUTO_TEST_CASE(testExplicitSchemeComposition1)
455{
456 PRECICE_TEST();
457
458 std::string configPath(_pathToTests + "multi-solver-coupling-1.xml");
459 setupAndRunThreeSolverCoupling(configPath, context);
460}
461
463PRECICE_TEST_SETUP("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events)
464BOOST_AUTO_TEST_CASE(testImplicitExplicitSchemeComposition)
465{
466 PRECICE_TEST();
467
468 std::string configPath(_pathToTests + "multi-solver-coupling-3.xml");
469 setupAndRunThreeSolverCoupling(configPath, context);
470}
471
473PRECICE_TEST_SETUP("Participant0"_on(1_rank), "Participant1"_on(1_rank), "Participant2"_on(1_rank), Require::Events)
474BOOST_AUTO_TEST_CASE(testExplicitImplicitSchemeComposition)
475{
476 PRECICE_TEST();
477
478 std::string configPath(_pathToTests + "multi-solver-coupling-4.xml");
479 setupAndRunThreeSolverCoupling(configPath, context);
480}
481
484
485#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:39
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
Definition Testing.hpp:29
Performs XML configuration of a participant.
Acts as one coupling scheme, but consists of several composed ones.
void finalize() final override
Finalizes the coupling and disconnects communication.
bool isCouplingOngoing() const final override
Returns true, when the coupled simulation is still ongoing.
void initialize() final override
Initializes the coupling scheme and establishes a communication connection to the coupling partner.
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 void initialize()=0
Initializes the coupling scheme and establishes a communication connection to the coupling partner....
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 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:28
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:93
std::string getPathToSources()
Returns the base path to the sources.
Definition Testing.cpp:33
XMLTag getRootTag()
Returns an empty root tag with name "configuration".
Definition XMLTag.cpp:278
std::string configure(XMLTag &tag, const precice::xml::ConfigurationContext &context, std::string_view configurationFilename)
Configures the given configuration from file configurationFilename.
Definition XMLTag.cpp:284
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)
struct giving access to the impl of a befriended class or struct
Definition Testing.hpp:48
Tightly coupled to the parameters of Participant()
Definition XMLTag.hpp:21