21 PRECICE_TEST(
"Part1"_on(1_rank),
"Part2"_on(3_ranks).setupIntraComm(), Require::Events);
22 auto m2n = context.connectPrimaryRanks(
"Part1",
"Part2");
25 int numberOfVertices = 6;
26 int valueDimension = 1;
27 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
29 if (context.isNamed(
"Part1")) {
31 m2n->createDistributedCommunication(pMesh);
33 pMesh->setGlobalNumberOfVertices(numberOfVertices);
34 pMesh->setVertexDistribution({{0, {0, 1, 2, 3, 4, 5}}});
36 m2n->acceptSecondaryRanksConnection(
"Part1",
"Part2");
37 Eigen::VectorXd values = Eigen::VectorXd::Zero(numberOfVertices);
38 values << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0;
39 m2n->send(values, pMesh->getID(), valueDimension);
40 m2n->receive(values, pMesh->getID(), valueDimension);
41 BOOST_TEST(values(0) == 2.0);
42 BOOST_TEST(values(1) == 4.0);
43 BOOST_TEST(values(2) == 6.0);
44 BOOST_TEST(values(3) == 16.0);
45 BOOST_TEST(values(4) == 10.0);
46 BOOST_TEST(values(5) == 12.0);
49 BOOST_TEST(context.isNamed(
"Part2"));
51 m2n->createDistributedCommunication(pMesh);
52 m2n->requestSecondaryRanksConnection(
"Part1",
"Part2");
54 if (context.isPrimary()) {
55 pMesh->setGlobalNumberOfVertices(numberOfVertices);
56 pMesh->setVertexDistribution({{0, {0, 1, 3}}, {2, {2, 3, 4, 5}}});
58 Eigen::Vector3d values(0.0, 0.0, 0.0);
59 m2n->receive(values, pMesh->getID(), valueDimension);
60 BOOST_TEST(values(0) == 1.0);
61 BOOST_TEST(values(1) == 2.0);
62 BOOST_TEST(values(2) == 4.0);
64 m2n->send(values, pMesh->getID(), valueDimension);
65 }
else if (context.isRank(1)) {
66 Eigen::VectorXd values;
67 m2n->receive({}, pMesh->getID(), valueDimension);
68 m2n->send(values, pMesh->getID(), valueDimension);
70 BOOST_TEST(context.isRank(2));
71 Eigen::Vector4d values(0.0, 0.0, 0.0, 0.0);
72 m2n->receive(values, pMesh->getID(), valueDimension);
73 BOOST_TEST(values(0) == 3.0);
74 BOOST_TEST(values(1) == 4.0);
75 BOOST_TEST(values(2) == 5.0);
76 BOOST_TEST(values(3) == 6.0);
78 m2n->send(values, pMesh->getID(), valueDimension);