41 for (
auto &elem : data) {
59 mesh->setGlobalNumberOfVertices(10);
61 mesh->setVertexDistribution({{0, {0, 1, 3, 5, 7}}, {1, {1, 2, 4, 5, 6}}});
63 data = {10, 20, 40, 60, 80};
64 expectedData = {10 + 2, 4 * 20 + 3, 40 + 2, 4 * 60 + 3, 80 + 2};
66 data = {20, 30, 50, 60, 70};
67 expectedData = {4 * 20 + 3, 30 + 1, 50 + 2, 4 * 60 + 3, 70 + 1};
70 BOOST_TEST(context.
isNamed(
"B"));
72 mesh->setGlobalNumberOfVertices(10);
74 mesh->setVertexDistribution({{0, {1, 2, 5, 6}}, {1, {0, 1, 3, 4, 5, 7}}});
77 expectedData = {2 * 20, 30, 2 * 60, 70};
81 expectedData = {10, 2 * 20, 40, 50, 2 * 60, 80};
105 BOOST_TEST(context.
hasSize(2));
115 mesh->setGlobalNumberOfVertices(10);
117 mesh->setVertexDistribution({{0, {0, 1, 3, 5, 7}}, {1, {1, 2, 4, 5, 6}}});
119 data = {10, 20, 40, 60, 80};
120 expectedData = {10 + 2, 4 * 20 + 3, 2 * 40 + 3, 4 * 60 + 3, 80 + 2};
122 data = {20, 30, 50, 60, 70};
123 expectedData = {4 * 20 + 3, 0, 50 + 2, 4 * 60 + 3, 70 + 1};
126 BOOST_TEST(context.
isNamed(
"B"));
128 mesh->setGlobalNumberOfVertices(10);
130 mesh->setVertexDistribution({{0, {1, 3, 5, 6}}, {1, {0, 1, 3, 4, 5, 7}}});
133 expectedData = {2 * 20, 40, 2 * 60, 70};
137 expectedData = {10, 2 * 20, 40, 50, 2 * 60, 80};
160 BOOST_TEST(context.
hasSize(2));
168 mesh->setConnectedRanks({0});
171 mesh->setConnectedRanks({1});
174 BOOST_TEST(context.
isNamed(
"B"));
177 mesh->setConnectedRanks({0});
180 mesh->setConnectedRanks({1});
206 BOOST_TEST(receiveData.
at(0) == 5);
208 BOOST_TEST(receiveData.
at(0) == 10);
216 BOOST_TEST(context.
hasSize(2));
224 mesh->setConnectedRanks({1});
227 mesh->setConnectedRanks({0});
230 BOOST_TEST(context.
isNamed(
"B"));
233 mesh->setConnectedRanks({1});
236 mesh->setConnectedRanks({0});
262 BOOST_TEST(receiveData.
at(0) == 10);
264 BOOST_TEST(receiveData.
at(0) == 5);
271 BOOST_TEST(context.
hasSize(2));
279 mesh->setConnectedRanks({0});
284 BOOST_TEST(context.
isNamed(
"B"));
286 mesh->setConnectedRanks({0});
305 BOOST_TEST(receiveData.
at(0) == 5);
308 BOOST_TEST(receiveData.
size() == 0);
315 BOOST_TEST(context.
hasSize(2));
322 Eigen::VectorXd position(dimensions);
323 position << 5.5, 0.0;
325 position << 1.0, 2.0;
327 mesh->createEdge(v1, v2);
329 mesh->setConnectedRanks({0});
332 Eigen::VectorXd position(dimensions);
333 position << 1.5, 0.0;
335 position << 1.5, 2.0;
337 mesh->createEdge(v1, v2);
339 mesh->setConnectedRanks({1});
342 BOOST_TEST(context.
isNamed(
"B"));
344 mesh->setConnectedRanks({0});
347 mesh->setConnectedRanks({1});
364 BOOST_TEST(mesh->nVertices() == 2);
365 BOOST_TEST(mesh->vertex(0).coord(0) == 5.50);
366 BOOST_TEST(mesh->vertex(0).coord(1) == 0.0);
367 BOOST_TEST(mesh->vertex(1).coord(0) == 1.0);
368 BOOST_TEST(mesh->vertex(1).coord(1) == 2.0);
371 BOOST_TEST(mesh->nVertices() == 2);
372 BOOST_TEST(mesh->vertex(0).coord(0) == 1.50);
373 BOOST_TEST(mesh->vertex(0).coord(1) == 0.0);
374 BOOST_TEST(mesh->vertex(1).coord(0) == 1.50);
375 BOOST_TEST(mesh->vertex(1).coord(1) == 2.0);
382 BOOST_TEST(context.
hasSize(2));
386 const auto expectedId = mesh->getID();
394 mesh->setConnectedRanks({0});
395 localCommunicationMap[0].push_back(102);
396 localCommunicationMap[0].push_back(1022);
397 localCommunicationMap[0].push_back(10222);
398 localCommunicationMap[1].push_back(103);
399 localCommunicationMap[1].push_back(1033);
400 localCommunicationMap[1].push_back(10333);
406 mesh->setConnectedRanks({1});
407 localCommunicationMap[0].push_back(112);
408 localCommunicationMap[0].push_back(1122);
409 localCommunicationMap[0].push_back(11222);
410 localCommunicationMap[1].push_back(113);
411 localCommunicationMap[1].push_back(1133);
412 localCommunicationMap[1].push_back(11333);
415 BOOST_TEST(context.
isNamed(
"B"));
418 mesh->setConnectedRanks({0});
422 mesh->setConnectedRanks({1});
432 BOOST_TEST(mesh->getID() == expectedId);
437 BOOST_TEST(mesh->getID() == expectedId);
444 BOOST_TEST(localCommunicationMap.
size() == 1);
445 BOOST_TEST(localCommunicationMap.
at(0).size() == 3);
446 BOOST_TEST(localCommunicationMap.
at(0).at(0) == 102);
447 BOOST_TEST(localCommunicationMap.
at(0).at(1) == 1022);
448 BOOST_TEST(localCommunicationMap.
at(0).at(2) == 10222);
453 BOOST_TEST(localCommunicationMap.
size() == 1);
454 BOOST_TEST(localCommunicationMap.
at(1).size() == 3);
455 BOOST_TEST(localCommunicationMap.
at(1).at(0) == 113);
456 BOOST_TEST(localCommunicationMap.
at(1).at(1) == 1133);
457 BOOST_TEST(localCommunicationMap.
at(1).at(2) == 11333);
466 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
473 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
480 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
487 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
494 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
501 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
508 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
519 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
526 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
533 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
540 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
547 PRECICE_TEST(
"A"_on(2_ranks).setupIntraComm(),
"B"_on(2_ranks).setupIntraComm(), Require::Events);
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
void runSameConnectionTest(const TestContext &context, com::PtrCommunicationFactory cf)
void runP2PComTest2(const TestContext &context, com::PtrCommunicationFactory cf)
a very similar test, but with a vertex that has been completely filtered out
void runCrossConnectionTest(const TestContext &context, com::PtrCommunicationFactory cf)
void process(vector< double > &data)
void runP2PComLocalCommunicationMapTest(const TestContext &context, com::PtrCommunicationFactory cf)
void runEmptyConnectionTest(const TestContext &context, com::PtrCommunicationFactory cf)
void runP2PMeshBroadcastTest(const TestContext &context, com::PtrCommunicationFactory cf)
void runP2PComTest1(const TestContext &context, com::PtrCommunicationFactory cf)
BOOST_AUTO_TEST_CASE(P2PComTest1)
#define PRECICE_TEST(...)
Point-to-point communication implementation of DistributedCommunication.
void scatterAllCommunicationMap(CommunicationMap &localCommunicationMap) override
Scatters a communication map over connected ranks on remote participant.
void broadcastSendMesh() override
Broadcasts a mesh to connected ranks on remote participant.
void gatherAllCommunicationMap(CommunicationMap &localCommunicationMap) override
Gathers a communication maps from connected ranks on remote participant.
void broadcastSend(int itemToSend) override
Broadcasts an int to connected ranks on remote participant.
void acceptPreConnection(std::string const &acceptorName, std::string const &requesterName) override
Accepts connection from participant, which has to call requestPreConnection(). Only initial connectio...
void receive(precice::span< double > itemsToReceive, int valueDimension=1) override
Receives a subset of local double values corresponding to local indices deduced from the current and ...
void broadcastReceiveAll(std::vector< int > &itemToReceive) override
Receives an int per connected rank on remote participant @para[out] itemToReceive received ints from ...
void requestPreConnection(std::string const &acceptorName, std::string const &requesterName) override
Requests connection from participant, which has to call acceptConnection(). Only initial connection i...
void acceptConnection(std::string const &acceptorName, std::string const &requesterName) override
Accepts connection from participant, which has to call requestConnection().
void requestConnection(std::string const &acceptorName, std::string const &requesterName) override
Requests connection from participant, which has to call acceptConnection().
void broadcastReceiveAllMesh() override
Receive mesh partitions per connected rank on remote participant.
void send(precice::span< double const > itemsToSend, int valueDimension=1) override
Sends a subset of local double values corresponding to local indices deduced from the current and rem...
Container and creator for meshes.
bool isNamed(const std::string &name) const
Check whether this context has a given name.
bool hasSize(int size) const
Check whether this context has a given size.
Utility class for managing intra-participant communication operations.
static Rank getRank()
Current rank.
Utility class for managing MPI operations.
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...
Main namespace of the precice library.