34#include "precice/impl/versions.hpp"
58 BOOST_TEST(pSolidzMesh);
59 BOOST_TEST(pSolidzMesh->getDimensions() == dimensions);
60 Eigen::VectorXd position(dimensions);
63 Vertex &v1 = pSolidzMesh->createVertex(position);
65 position << 0.0, 1.95;
66 Vertex &v2 = pSolidzMesh->createVertex(position);
69 Vertex &v3 = pSolidzMesh->createVertex(position);
72 Vertex &v4 = pSolidzMesh->createVertex(position);
74 position << 0.0, 5.95;
75 Vertex &v5 = pSolidzMesh->createVertex(position);
78 Vertex &v6 = pSolidzMesh->createVertex(position);
80 pSolidzMesh->createEdge(v1, v2);
81 pSolidzMesh->createEdge(v2, v3);
82 pSolidzMesh->createEdge(v3, v4);
83 pSolidzMesh->createEdge(v4, v5);
84 pSolidzMesh->createEdge(v5, v6);
85 pSolidzMesh->computeBoundingBox();
91 BOOST_TEST(pSolidzMesh);
93 Eigen::VectorXd position(dimensions);
109 BOOST_TEST(pNastinMesh);
113 Eigen::VectorXd position(dimensions);
114 position << 0.0, 0.0;
116 position << 0.0, 2.0;
118 }
else if (rank == 1) {
120 }
else if (rank == 2) {
121 Eigen::VectorXd position(dimensions);
122 position << 0.0, 4.0;
124 position << 0.0, 6.0;
137 Eigen::VectorXd position(dimensions);
138 position << 0.10, 0.10;
140 position << 0.90, 0.90;
142 }
else if (rank == 1) {
144 }
else if (rank == 2) {
146 Eigen::VectorXd position(dimensions);
147 position << 2.1, 2.1;
149 position << 2.9, 2.9;
158 Eigen::VectorXd position(dimensions);
159 BOOST_TEST(pSolidzMesh);
162 position << 0.0, 0.0, -0.1;
165 position << -1.0, 0.0, 0.0;
168 position << 1.0, 0.0, 0.0;
171 position << 0.0, -1.0, 0.0;
174 position << 0.0, 1.0, 0.0;
191 BOOST_TEST(pNastinMesh);
195 Eigen::VectorXd position(dimensions);
196 position << -1.0, -1.0, 0.0;
198 position << -0.75, -0.75, 0.5;
200 }
else if (rank == 1) {
202 }
else if (rank == 2) {
203 Eigen::VectorXd position(dimensions);
204 position << 0.0, 0.0, -1.0;
206 position << 0.5, 0.5, 0.0;
219 Eigen::VectorXd position(dimensions);
220 position << 0.10, 0.10, 0.1;
222 position << 0.90, 0.90, 0.9;
224 }
else if (rank == 1) {
226 }
else if (rank == 2) {
228 Eigen::VectorXd position(dimensions);
229 position << 2.1, 2.1, 2.1;
231 position << 2.9, 2.9, 2.1;
242 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
245 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
247 if (context.isNamed(
"Solid")) {
250 BOOST_TEST(pSolidzMesh->
nVertices() == 6);
255 BOOST_TEST(context.isNamed(
"Fluid"));
263 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
264 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
268 double safetyFactor = 0.1;
277 BOOST_TEST_CONTEXT(*pSolidzMesh)
280 if (context.isPrimary()) {
281 BOOST_TEST(pSolidzMesh->
nVertices() == 2);
282 BOOST_TEST(pSolidzMesh->
edges().
size() == 1);
283 }
else if (context.isRank(1)) {
284 BOOST_TEST(pSolidzMesh->
nVertices() == 0);
285 BOOST_TEST(pSolidzMesh->
edges().
size() == 0);
286 }
else if (context.isRank(2)) {
287 BOOST_TEST(pSolidzMesh->
nVertices() == 2);
288 BOOST_TEST(pSolidzMesh->
edges().
size() == 1);
299 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
302 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
304 if (context.isNamed(
"Solid")) {
311 BOOST_TEST(context.isNamed(
"Fluid"));
319 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
320 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
324 double safetyFactor = 0.5;
328 part.addFromMapping(boundingFromMapping);
329 part.addToMapping(boundingToMapping);
334 if (context.isPrimary()) {
335 BOOST_TEST(pSolidzMesh->nVertices() == 2);
336 BOOST_TEST(pSolidzMesh->edges().size() == 1);
337 }
else if (context.isRank(1)) {
338 BOOST_TEST(pSolidzMesh->nVertices() == 0);
339 BOOST_TEST(pSolidzMesh->edges().size() == 0);
340 }
else if (context.isRank(2)) {
341 BOOST_TEST(pSolidzMesh->nVertices() == 2);
342 BOOST_TEST(pSolidzMesh->edges().size() == 1);
352 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
356 if (context.isNamed(
"Solid")) {
363 BOOST_TEST(context.isNamed(
"Fluid"));
371 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
372 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
376 double safetyFactor = 0.1;
379 part.addFromMapping(boundingFromMapping);
380 part.addToMapping(boundingToMapping);
384 BOOST_TEST_CONTEXT(*pSolidzMesh)
387 if (context.isPrimary()) {
388 BOOST_TEST(pSolidzMesh->nVertices() == 3);
389 BOOST_TEST(pSolidzMesh->edges().size() == 2);
390 }
else if (context.isRank(1)) {
391 BOOST_TEST(pSolidzMesh->nVertices() == 0);
392 BOOST_TEST(pSolidzMesh->edges().size() == 0);
393 }
else if (context.isRank(2)) {
394 BOOST_TEST(pSolidzMesh->nVertices() == 3);
395 BOOST_TEST(pSolidzMesh->edges().size() == 2);
401#ifndef PRECICE_NO_PETSC
407 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
411 if (context.isNamed(
"Solid")) {
418 BOOST_TEST(context.isNamed(
"Fluid"));
427 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
428 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
432 double safetyFactor = 20.0;
440 BOOST_TEST_CONTEXT(*pSolidzMesh)
449 if (context.isPrimary()) {
450 BOOST_TEST(pSolidzMesh->
nVertices() == 6);
451 BOOST_TEST(pSolidzMesh->
edges().
size() == 5);
464 }
else if (context.isRank(1)) {
465 BOOST_TEST(pSolidzMesh->
nVertices() == 0);
466 BOOST_TEST(pSolidzMesh->
edges().
size() == 0);
467 }
else if (context.isRank(2)) {
468 BOOST_TEST(pSolidzMesh->
nVertices() == 6);
469 BOOST_TEST(pSolidzMesh->
edges().
size() == 5);
492 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
496 if (context.isNamed(
"Solid")) {
503 BOOST_TEST(context.isNamed(
"Fluid"));
507 double supportRadius = 0.25;
514 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
515 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
519 double safetyFactor = 20.0;
522 part.addFromMapping(boundingFromMapping);
523 part.addToMapping(boundingToMapping);
527 BOOST_TEST_CONTEXT(*pSolidzMesh)
529 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
530 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 3);
531 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 3);
532 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 6);
533 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
536 if (context.isPrimary()) {
537 BOOST_TEST(pSolidzMesh->nVertices() == 3);
538 BOOST_TEST(pSolidzMesh->edges().size() == 2);
539 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
540 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
541 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
542 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
543 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
544 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
545 }
else if (context.isRank(1)) {
546 BOOST_TEST(pSolidzMesh->nVertices() == 0);
547 BOOST_TEST(pSolidzMesh->edges().size() == 0);
548 }
else if (context.isRank(2)) {
549 BOOST_TEST(pSolidzMesh->nVertices() == 3);
550 BOOST_TEST(pSolidzMesh->edges().size() == 2);
551 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
552 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
553 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
554 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 3);
555 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 4);
556 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 5);
567 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
571 if (context.isNamed(
"Solid")) {
578 BOOST_TEST(context.isNamed(
"Fluid"));
582 double supportRadius = 2.45;
589 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
590 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
594 double safetyFactor = 20.0;
597 part.addFromMapping(boundingFromMapping);
598 part.addToMapping(boundingToMapping);
602 BOOST_TEST_CONTEXT(*pSolidzMesh)
604 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
605 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 4);
606 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 4);
607 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 9);
608 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
611 if (context.isPrimary()) {
612 BOOST_TEST(pSolidzMesh->nVertices() == 4);
613 BOOST_TEST(pSolidzMesh->edges().size() == 3);
614 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
615 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
616 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
617 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
false);
618 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
619 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
620 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
621 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
622 }
else if (context.isRank(1)) {
623 BOOST_TEST(pSolidzMesh->nVertices() == 0);
624 BOOST_TEST(pSolidzMesh->edges().size() == 0);
625 }
else if (context.isRank(2)) {
626 BOOST_TEST(pSolidzMesh->nVertices() == 5);
627 BOOST_TEST(pSolidzMesh->edges().size() == 4);
628 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
false);
629 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
false);
630 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
631 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
632 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
633 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 1);
634 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 2);
635 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 3);
636 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 4);
637 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 5);
648 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
652 if (context.isNamed(
"Solid")) {
659 BOOST_TEST(context.isNamed(
"Fluid"));
663 double supportRadius1 = 1.2;
664 double supportRadius2 = 0.2;
672 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
673 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
677 double safetyFactor = 20.0;
680 part.addFromMapping(boundingFromMapping);
681 part.addToMapping(boundingToMapping);
685 BOOST_TEST_CONTEXT(*pSolidzMesh)
687 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
688 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 5);
689 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 5);
690 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 10);
691 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 5);
694 if (context.isPrimary()) {
695 BOOST_TEST(pSolidzMesh->nVertices() == 5);
696 BOOST_TEST(pSolidzMesh->edges().size() == 6);
697 BOOST_TEST(pSolidzMesh->triangles().size() == 2);
698 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
699 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
700 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
false);
701 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
false);
702 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
false);
703 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
704 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
705 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
706 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
707 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
708 }
else if (context.isRank(1)) {
709 BOOST_TEST(pSolidzMesh->nVertices() == 0);
710 BOOST_TEST(pSolidzMesh->edges().size() == 0);
711 BOOST_TEST(pSolidzMesh->triangles().size() == 0);
712 }
else if (context.isRank(2)) {
713 BOOST_TEST(pSolidzMesh->nVertices() == 5);
714 BOOST_TEST(pSolidzMesh->edges().size() == 6);
715 BOOST_TEST(pSolidzMesh->triangles().size() == 2);
716 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
false);
717 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
false);
718 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
719 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
720 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
721 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
722 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
723 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
724 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
725 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
738 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
742 if (context.isNamed(
"Solid")) {
749 BOOST_TEST(context.isNamed(
"Fluid"));
757 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
758 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
762 double safetyFactor = 20.0;
771 if (context.isPrimary()) {
772 BOOST_TEST(pSolidzMesh->
nVertices() == 2);
773 BOOST_TEST(pSolidzMesh->
edges().
size() == 1);
775 }
else if (context.isRank(1)) {
776 BOOST_TEST(pSolidzMesh->
nVertices() == 0);
777 BOOST_TEST(pSolidzMesh->
edges().
size() == 0);
779 }
else if (context.isRank(2)) {
780 BOOST_TEST(pSolidzMesh->
nVertices() == 3);
781 BOOST_TEST(pSolidzMesh->
edges().
size() == 3);
792 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
796 if (context.isNamed(
"Solid")) {
799 Eigen::VectorXd position(dimensions);
800 position << 0.0, 0.0;
801 pMesh->createVertex(position);
802 position << 1.0, 0.0;
803 pMesh->createVertex(position);
804 position << 2.0, 0.0;
805 pMesh->createVertex(position);
807 pMesh->computeBoundingBox();
814 BOOST_TEST(context.isNamed(
"Fluid"));
820 boundingFromMapping->setMeshes(pMesh, pOtherMesh);
822 if (context.isPrimary()) {
823 Eigen::VectorXd position(dimensions);
824 position << 0.0, 0.0;
825 pOtherMesh->createVertex(position);
826 position << 0.8, 0.0;
827 pOtherMesh->createVertex(position);
828 }
else if (context.isRank(1)) {
829 Eigen::VectorXd position(dimensions);
830 position << 1.0, 0.0;
831 pOtherMesh->createVertex(position);
832 position << 1.2, 0.0;
833 pOtherMesh->createVertex(position);
834 }
else if (context.isRank(2)) {
838 pOtherMesh->computeBoundingBox();
840 double safetyFactor = 20.0;
843 part.addFromMapping(boundingFromMapping);
847 BOOST_TEST(pMesh->getVertexOffsets().size() == 3);
848 BOOST_TEST(pMesh->getVertexOffsets().at(0) == 2);
849 BOOST_TEST(pMesh->getVertexOffsets().at(1) == 3);
850 BOOST_TEST(pMesh->getVertexOffsets().at(2) == 3);
852 if (context.isPrimary()) {
853 BOOST_TEST(pMesh->getVertexDistribution().at(0).size() == 2);
854 BOOST_TEST(pMesh->getVertexDistribution().at(1).size() == 1);
855 BOOST_TEST(pMesh->getVertexDistribution().at(2).size() == 0);
856 BOOST_TEST(pMesh->getVertexDistribution().at(0).at(0) == 0);
857 BOOST_TEST(pMesh->getVertexDistribution().at(0).at(1) == 1);
858 BOOST_TEST(pMesh->getVertexDistribution().at(1).at(0) == 1);
859 BOOST_TEST(pMesh->nVertices() == 2);
860 BOOST_TEST(pMesh->vertex(0).getGlobalIndex() == 0);
861 BOOST_TEST(pMesh->vertex(1).getGlobalIndex() == 1);
862 BOOST_TEST(pMesh->vertex(0).isOwner() ==
true);
863 BOOST_TEST(pMesh->vertex(1).isOwner() ==
false);
864 }
else if (context.isRank(1)) {
865 BOOST_TEST(pMesh->nVertices() == 1);
866 BOOST_TEST(pMesh->vertex(0).getGlobalIndex() == 1);
867 BOOST_TEST(pMesh->vertex(0).isOwner() ==
true);
868 }
else if (context.isRank(2)) {
869 BOOST_TEST(pMesh->nVertices() == 0);
879 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
883 if (context.isNamed(
"Solid")) {
892 BOOST_TEST(pSolidzMesh->
nVertices() == 6);
893 BOOST_TEST(pSolidzMesh->
edges().
size() == 5);
909 BOOST_TEST(context.isNamed(
"Fluid"));
915 boundingFromMapping->setMeshes(pSolidzMesh, pOtherMesh);
917 double safetyFactor = 0.1;
925 BOOST_TEST(pSolidzMesh->
nVertices() == 6);
926 BOOST_TEST(pSolidzMesh->
edges().
size() == 5);
953 auto m2n = context.connectPrimaryRanks(
"SOLIDZ",
"NASTIN", options);
959 for (
int remoteRank = 0; remoteRank < 3; remoteRank++) {
961 for (
int i = 0; i < dimensions; i++) {
968 if (context.isNamed(
"SOLIDZ")) {
969 int connectionMapSize = 0;
972 m2n->getPrimaryRankCommunication()->send(3, 0);
975 connectionMapSize = connectedRanksList.
size();
976 BOOST_TEST_REQUIRE(connectionMapSize == 2);
980 for (
auto &rank : connectedRanksList) {
981 receivedConnectionMap[rank] = connectedRanks;
987 BOOST_TEST(receivedConnectionMap.
at(0).at(0) == 2);
988 BOOST_TEST(receivedConnectionMap.
at(2).at(0) == 0);
999 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
1000 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
1004 double safetyFactor = 0.0;
1023 auto m2n = context.connectPrimaryRanks(
"SOLIDZ",
"NASTIN", options);
1029 for (
int remoteRank = 0; remoteRank < 3; remoteRank++) {
1031 for (
int i = 0; i < dimensions; i++) {
1038 if (context.isNamed(
"SOLIDZ")) {
1039 int connectionMapSize = 0;
1042 m2n->getPrimaryRankCommunication()->send(3, 0);
1045 connectionMapSize = connectedRanksList.
size();
1046 BOOST_TEST(connectionMapSize == 2);
1050 for (
auto &rank : connectedRanksList) {
1051 receivedConnectionMap[rank] = connectedRanks;
1057 BOOST_TEST(receivedConnectionMap.
at(0).at(0) == 2);
1058 BOOST_TEST(receivedConnectionMap.
at(2).at(0) == 0);
1069 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
1070 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
1074 double safetyFactor = 0.0;
1078 part.addFromMapping(boundingFromMapping);
1079 part.addToMapping(boundingToMapping);
1080 part.compareBoundingBoxes();
1087 double safetyFactor = 0;
1101 boundingFromMapping->setMeshes(
mesh,
mesh);
1102 boundingToMapping->setMeshes(
mesh,
mesh);
1110 mesh->computeBoundingBox();
1113 Access::prepareBoundingBox(part);
1114 Access::tagMeshFirstRound(part);
1115 Access::createOwnerInformation(part);
1133 if (context.isRank(0)) {
1134 Eigen::VectorXd position(dimensions);
1135 position << 0.0, 0.0;
1136 mesh->createVertex(position);
1137 position << 1.0, 0.0;
1138 mesh->createVertex(position);
1139 position << 2.0, 0.0;
1140 mesh->createVertex(position);
1141 position << 0.0, 1.0;
1142 mesh->createVertex(position);
1143 position << 1.0, 1.0;
1144 mesh->createVertex(position);
1145 position << 2.0, 1.0;
1146 mesh->createVertex(position);
1148 }
else if (context.isRank(1)) {
1149 Eigen::VectorXd position(dimensions);
1150 position << 0.0, 0.0;
1151 mesh->createVertex(position);
1152 position << -1.0, 0.0;
1153 mesh->createVertex(position);
1154 position << -2.0, 0.0;
1155 mesh->createVertex(position);
1156 position << -0.5, 1.0;
1157 mesh->createVertex(position);
1158 position << -1.0, 1.0;
1159 mesh->createVertex(position);
1160 position << -2.0, 1.0;
1161 mesh->createVertex(position);
1162 }
else if (context.isRank(2)) {
1163 Eigen::VectorXd position(dimensions);
1164 position << 0.0, 0.0;
1165 mesh->createVertex(position);
1166 position << -1.0, -0.5;
1167 mesh->createVertex(position);
1169 Eigen::VectorXd position(dimensions);
1170 position << 0.0, 0.0;
1171 mesh->createVertex(position);
1172 position << 1.0, -0.5;
1173 mesh->createVertex(position);
1174 position << 2.0, -0.5;
1175 mesh->createVertex(position);
1176 position << 0.5, -1.0;
1177 mesh->createVertex(position);
1178 position << 1.0, -1.0;
1179 mesh->createVertex(position);
1180 position << 2.0, -1.0;
1181 mesh->createVertex(position);
1184 mesh->computeBoundingBox();
1185 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1198 bool includeVertex =
false;
1202 includeVertex =
true;
1203 if (context.isRank(2)) {
1209 BOOST_TEST(includeVertex ==
true);
1228 if (context.isRank(0)) {
1229 Eigen::VectorXd position(dimensions);
1230 position << 0.0, 0.0, 0.0;
1231 mesh->createVertex(position);
1232 position << 1.0, 0.0, 0.0;
1233 mesh->createVertex(position);
1234 position << 2.0, 0.0, 0.0;
1235 mesh->createVertex(position);
1236 position << 0.0, 1.0, 0.0;
1237 mesh->createVertex(position);
1238 position << 1.0, 1.0, 0.0;
1239 mesh->createVertex(position);
1240 position << 2.0, 1.0, 0.0;
1241 mesh->createVertex(position);
1242 position << 0.0, 0.0, 1.0;
1243 mesh->createVertex(position);
1244 position << 1.0, 0.0, 1.0;
1245 mesh->createVertex(position);
1246 position << 2.0, 0.0, 1.0;
1247 mesh->createVertex(position);
1248 position << 0.0, 1.0, 1.0;
1249 mesh->createVertex(position);
1250 position << 1.0, 1.0, 1.0;
1251 mesh->createVertex(position);
1252 position << 2.0, 1.0, 1.0;
1253 mesh->createVertex(position);
1255 }
else if (context.isRank(1)) {
1256 Eigen::VectorXd position(dimensions);
1257 position << 0.0, 0.0, 0.0;
1258 mesh->createVertex(position);
1259 position << -1.0, 0.0, 0.0;
1260 mesh->createVertex(position);
1261 position << -2.0, 0.0, 0.0;
1262 mesh->createVertex(position);
1263 position << -0.1, 1.0, 0.0;
1264 mesh->createVertex(position);
1265 position << -1.0, 1.0, 0.0;
1266 mesh->createVertex(position);
1267 position << -2.0, 1.0, 0.0;
1268 mesh->createVertex(position);
1269 position << 0.0, 0.0, 1.0;
1270 mesh->createVertex(position);
1271 position << -1.0, 0.0, 1.0;
1272 mesh->createVertex(position);
1273 position << -2.0, 0.0, 1.0;
1274 mesh->createVertex(position);
1275 position << -0.1, 1.0, 1.0;
1276 mesh->createVertex(position);
1277 position << -1.0, 1.0, 1.0;
1278 mesh->createVertex(position);
1279 position << -2.0, 1.0, 1.0;
1280 mesh->createVertex(position);
1281 }
else if (context.isRank(2)) {
1282 Eigen::VectorXd position(dimensions);
1283 position << 0.0, 0.0, 0.0;
1284 mesh->createVertex(position);
1285 position << -1.0, -0.1, 0.0;
1286 mesh->createVertex(position);
1287 position << -2.0, -0.1, 0.0;
1288 mesh->createVertex(position);
1289 position << 0.0, -1.0, 0.0;
1290 mesh->createVertex(position);
1291 position << -1.0, -1.0, 0.0;
1292 mesh->createVertex(position);
1293 position << -2.0, -1.0, 0.0;
1294 mesh->createVertex(position);
1295 position << 0.0, 0.0, 1.0;
1296 mesh->createVertex(position);
1297 position << -1.0, -0.1, 1.0;
1298 mesh->createVertex(position);
1299 position << -2.0, -0.1, 1.0;
1300 mesh->createVertex(position);
1301 position << 0.0, -1.0, 1.0;
1302 mesh->createVertex(position);
1303 position << -1.0, -1.0, 1.0;
1304 mesh->createVertex(position);
1305 position << -2.0, -1.0, 1.0;
1306 mesh->createVertex(position);
1308 Eigen::VectorXd position(dimensions);
1309 position << 0.0, 0.0, 0.0;
1310 mesh->createVertex(position);
1311 position << 1.0, -0.1, 0.0;
1312 mesh->createVertex(position);
1313 position << 2.0, -0.1, 0.0;
1314 mesh->createVertex(position);
1315 position << 0.0, -1.0, 0.0;
1316 mesh->createVertex(position);
1317 position << 1.0, -1.0, 0.0;
1318 mesh->createVertex(position);
1319 position << 2.0, -1.0, 0.0;
1320 mesh->createVertex(position);
1321 position << 0.0, 0.0, 1.0;
1322 mesh->createVertex(position);
1323 position << 1.0, -0.1, 1.0;
1324 mesh->createVertex(position);
1325 position << 2.0, -0.1, 1.0;
1326 mesh->createVertex(position);
1327 position << 0.0, -1.0, 1.0;
1328 mesh->createVertex(position);
1329 position << 1.0, -1.0, 1.0;
1330 mesh->createVertex(position);
1331 position << 2.0, -1.0, 1.0;
1332 mesh->createVertex(position);
1335 mesh->computeBoundingBox();
1336 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1353 bool includeVertex =
false;
1357 includeVertex =
true;
1358 if (context.isRank(0)) {
1364 BOOST_TEST(includeVertex ==
true);
1383 if (context.isRank(0)) {
1384 Eigen::VectorXd position(dimensions);
1385 position << 0.0, 0.0, 0.0;
1386 mesh->createVertex(position);
1387 position << 1.0, 0.0, 0.0;
1388 mesh->createVertex(position);
1389 position << 2.0, 0.0, 0.0;
1390 mesh->createVertex(position);
1391 position << 0.0, 1.0, 0.0;
1392 mesh->createVertex(position);
1393 position << 1.0, 1.0, 0.0;
1394 mesh->createVertex(position);
1395 position << 2.0, 1.0, 0.0;
1396 mesh->createVertex(position);
1397 position << 0.0, 0.0, 1.0;
1398 mesh->createVertex(position);
1399 position << 1.0, 0.0, 1.0;
1400 mesh->createVertex(position);
1401 position << 2.0, 0.0, 1.0;
1402 mesh->createVertex(position);
1403 position << 0.0, 1.0, 1.0;
1404 mesh->createVertex(position);
1405 position << 1.0, 1.0, 1.0;
1406 mesh->createVertex(position);
1407 position << 2.0, 1.0, 1.0;
1408 mesh->createVertex(position);
1410 }
else if (context.isRank(1)) {
1411 Eigen::VectorXd position(dimensions);
1412 position << 0.0, 0.0, 0.0;
1413 mesh->createVertex(position);
1414 position << -1.0, 0.0, 0.0;
1415 mesh->createVertex(position);
1416 position << -2.0, 0.0, 0.0;
1417 mesh->createVertex(position);
1418 position << -0.1, 1.0, 0.0;
1419 mesh->createVertex(position);
1420 position << -1.0, 1.0, 0.0;
1421 mesh->createVertex(position);
1422 position << -2.0, 1.0, 0.0;
1423 mesh->createVertex(position);
1424 position << 0.0, 0.0, 1.0;
1425 mesh->createVertex(position);
1426 position << -1.0, 0.0, 1.0;
1427 mesh->createVertex(position);
1428 position << -2.0, 0.0, 1.0;
1429 mesh->createVertex(position);
1430 position << -0.1, 1.0, 1.0;
1431 mesh->createVertex(position);
1432 position << -1.0, 1.0, 1.0;
1433 mesh->createVertex(position);
1434 position << -2.0, 1.0, 1.0;
1435 mesh->createVertex(position);
1436 }
else if (context.isRank(2)) {
1438 Eigen::VectorXd position(dimensions);
1439 position << 0.0, 0.0, 0.0;
1440 mesh->createVertex(position);
1441 position << 1.0, -0.1, 0.0;
1442 mesh->createVertex(position);
1443 position << 2.0, -0.1, 0.0;
1444 mesh->createVertex(position);
1445 position << 0.0, -1.0, 0.0;
1446 mesh->createVertex(position);
1447 position << 1.0, -1.0, 0.0;
1448 mesh->createVertex(position);
1449 position << 2.0, -1.0, 0.0;
1450 mesh->createVertex(position);
1451 position << 0.0, 0.0, 1.0;
1452 mesh->createVertex(position);
1453 position << 1.0, -0.1, 1.0;
1454 mesh->createVertex(position);
1455 position << 2.0, -0.1, 1.0;
1456 mesh->createVertex(position);
1457 position << 0.0, -1.0, 1.0;
1458 mesh->createVertex(position);
1459 position << 1.0, -1.0, 1.0;
1460 mesh->createVertex(position);
1461 position << 2.0, -1.0, 1.0;
1462 mesh->createVertex(position);
1465 mesh->computeBoundingBox();
1466 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1483 bool includeVertex =
false;
1487 includeVertex =
true;
1488 if (context.isRank(0)) {
1494 BOOST_TEST(includeVertex ==
true);
1504 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
1507 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
1509 if (context.isNamed(
"Solid")) {
1512 BOOST_TEST(pSolidzMesh->nVertices() == 6);
1517 BOOST_TEST(context.isNamed(
"Fluid"));
1531 boundingFromMapping1->setMeshes(pSolidzMesh, pNastinMesh1);
1532 boundingToMapping1->setMeshes(pNastinMesh1, pSolidzMesh);
1533 boundingFromMapping2->setMeshes(pSolidzMesh, pNastinMesh2);
1534 boundingToMapping2->setMeshes(pNastinMesh3, pSolidzMesh);
1536 if (context.rank == 0) {
1537 Eigen::VectorXd position(dimensions);
1538 position << 0.0, 0.0;
1539 pNastinMesh1->createVertex(position);
1540 position << 0.0, 2.0;
1541 pNastinMesh2->createVertex(position);
1542 }
else if (context.rank == 1) {
1544 }
else if (context.rank == 2) {
1545 Eigen::VectorXd position(dimensions);
1546 position << 0.0, 4.0;
1547 pNastinMesh2->createVertex(position);
1548 position << 0.0, 6.0;
1549 pNastinMesh3->createVertex(position);
1551 pNastinMesh1->computeBoundingBox();
1552 pNastinMesh2->computeBoundingBox();
1553 pNastinMesh3->computeBoundingBox();
1555 double safetyFactor = 0.1;
1559 part.addFromMapping(boundingFromMapping1);
1560 part.addToMapping(boundingToMapping1);
1561 part.addFromMapping(boundingFromMapping2);
1562 part.addToMapping(boundingToMapping2);
1566 BOOST_TEST_CONTEXT(*pSolidzMesh)
1569 if (context.isPrimary()) {
1570 BOOST_TEST(pSolidzMesh->nVertices() == 2);
1571 BOOST_TEST(pSolidzMesh->edges().size() == 1);
1572 }
else if (context.isRank(1)) {
1573 BOOST_TEST(pSolidzMesh->nVertices() == 0);
1574 BOOST_TEST(pSolidzMesh->edges().size() == 0);
1575 }
else if (context.isRank(2)) {
1576 BOOST_TEST(pSolidzMesh->nVertices() == 2);
1577 BOOST_TEST(pSolidzMesh->edges().size() == 1);
BOOST_AUTO_TEST_CASE(testIQNIMVJPPWithSubsteps)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
void createNastinMesh2D(PtrMesh pNastinMesh, Rank rank)
void createNastinMesh2D2(PtrMesh pNastinMesh, Rank rank)
void createSolidzMesh3D(PtrMesh pSolidzMesh)
void createSolidzMesh2DSmall(PtrMesh pSolidzMesh)
void createNastinMesh3D(PtrMesh pNastinMesh, Rank rank)
void createSolidzMesh2D(PtrMesh pSolidzMesh)
void testParallelSetOwnerInformation(PtrMesh mesh, int dimensions)
void createNastinMesh3D2(PtrMesh pNastinMesh, Rank rank)
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
#define PRECICE_ASSERT(...)
@ ON_PRIMARY_RANK
Filter at primary rank and communicate only filtered mesh.
@ ON_SECONDARY_RANKS
Filter after communication on all secondary ranks.
@ NO_FILTER
No geometric filter used (e.g. for RBF mappings)
Implements Communication by using sockets.
std::shared_ptr< DistributedComFactory > SharedPointer
Radial basis function with compact support.
Mapping using nearest neighboring vertices.
Mapping using orthogonal projection to nearest triangle/edge/vertex and linear interpolation from pro...
Mapping with radial basis functions using the Petsc library to solve the resulting system.
Radial basis function with global support.
An axis-aligned bounding box around a (partition of a) mesh.
Linear edge of a mesh, defined by two Vertex objects.
Vertex & vertex(int i)
Returns the edge's vertex with index 0 or 1.
Container and creator for meshes.
Triangle & createTriangle(Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree)
Creates and initializes a Triangle object.
int getGlobalNumberOfVertices() const
int getDimensions() const
std::size_t nVertices() const
Returns the number of vertices.
Vertex & vertex(VertexID id)
Mutable access to a vertex by VertexID.
std::map< int, BoundingBox > BoundingBoxMap
const VertexOffsets & getVertexOffsets() const
void computeBoundingBox()
Computes the boundingBox for the vertices.
TriangleContainer & triangles()
Returns modifiable container holding all triangles.
Edge & createEdge(Vertex &vertexOne, Vertex &vertexTwo)
Creates and initializes an Edge object.
Vertex & createVertex(const Eigen::Ref< const Eigen::VectorXd > &coords)
Creates and initializes a Vertex object.
EdgeContainer & edges()
Returns modifiable container holding all edges.
double coord(int index) const
Returns a coordinate of a vertex.
VertexID getID() const
Returns the unique (among vertices of one mesh on one processor) ID of the vertex.
void setGlobalIndex(int globalIndex)
int getGlobalIndex() const
Globally unique index.
void addFromMapping(mapping::PtrMapping fromMapping)
void addM2N(m2n::PtrM2N m2n)
void addToMapping(mapping::PtrMapping toMapping)
A partition that is provided by the participant.
void compute() override
All distribution data structures are set up.
void communicate() override
The mesh is gathered and sent to another participant (if required)
A partition that is computed from a mesh received from another participant.
void compute() override
The partition is computed, i.e. the mesh re-partitioned if required and all data structures are set u...
void compareBoundingBoxes() override
Intersections between bounding boxes around each rank are computed.
void communicate() override
The mesh is communicated between both primary ranks (if required)
static Rank getRank()
Current rank.
constexpr auto asVector
Allows to use Communication::AsVectorTag in a less verbose way.
void receiveConnectionMap(Communication &communication, int rankSender, mesh::Mesh::ConnectionMap &cm)
void sendBoundingBoxMap(Communication &communication, int rankReceiver, const mesh::Mesh::BoundingBoxMap &bbm)
std::shared_ptr< Communication > PtrCommunication
contains the logic of the parallel communication between participants.
std::shared_ptr< Mapping > PtrMapping
provides Mesh, Data and primitives.
std::shared_ptr< Mesh > PtrMesh
@ PETSc
Require to initialize PETSc. This implies the initialization of Events.
@ Events
Require to initialize Event.
Main namespace of the precice library.