34#include "precice/impl/versions.hpp"
53 BOOST_TEST(pSolidzMesh);
54 BOOST_TEST(pSolidzMesh->getDimensions() == dimensions);
55 Eigen::VectorXd position(dimensions);
60 position << 0.0, 1.95;
69 position << 0.0, 5.95;
75 pSolidzMesh->createEdge(v1, v2);
76 pSolidzMesh->createEdge(v2, v3);
77 pSolidzMesh->createEdge(v3, v4);
78 pSolidzMesh->createEdge(v4, v5);
79 pSolidzMesh->createEdge(v5, v6);
80 pSolidzMesh->computeBoundingBox();
86 BOOST_TEST(pSolidzMesh);
87 BOOST_TEST(pSolidzMesh->getDimensions() == dimensions);
88 Eigen::VectorXd position(dimensions);
96 pSolidzMesh->createEdge(v1, v2);
97 pSolidzMesh->createEdge(v2, v3);
98 pSolidzMesh->computeBoundingBox();
104 BOOST_TEST(pNastinMesh);
105 BOOST_TEST(pNastinMesh->getDimensions() == dimensions);
108 Eigen::VectorXd position(dimensions);
109 position << 0.0, 0.0;
110 pNastinMesh->createVertex(position);
111 position << 0.0, 2.0;
112 pNastinMesh->createVertex(position);
113 }
else if (rank == 1) {
115 }
else if (rank == 2) {
116 Eigen::VectorXd position(dimensions);
117 position << 0.0, 4.0;
118 pNastinMesh->createVertex(position);
119 position << 0.0, 6.0;
120 pNastinMesh->createVertex(position);
122 pNastinMesh->computeBoundingBox();
132 Eigen::VectorXd position(dimensions);
133 position << 0.10, 0.10;
134 pNastinMesh->createVertex(position);
135 position << 0.90, 0.90;
136 pNastinMesh->createVertex(position);
137 }
else if (rank == 1) {
139 }
else if (rank == 2) {
141 Eigen::VectorXd position(dimensions);
142 position << 2.1, 2.1;
143 pNastinMesh->createVertex(position);
144 position << 2.9, 2.9;
145 pNastinMesh->createVertex(position);
147 pNastinMesh->computeBoundingBox();
153 Eigen::VectorXd position(dimensions);
154 BOOST_TEST(pSolidzMesh);
155 BOOST_TEST(pSolidzMesh->getDimensions() == dimensions);
157 position << 0.0, 0.0, -0.1;
160 position << -1.0, 0.0, 0.0;
163 position << 1.0, 0.0, 0.0;
166 position << 0.0, -1.0, 0.0;
169 position << 0.0, 1.0, 0.0;
172 mesh::Edge &e1 = pSolidzMesh->createEdge(v1, v2);
173 mesh::Edge &e2 = pSolidzMesh->createEdge(v2, v4);
174 mesh::Edge &e3 = pSolidzMesh->createEdge(v4, v1);
175 mesh::Edge &e4 = pSolidzMesh->createEdge(v1, v3);
176 mesh::Edge &e5 = pSolidzMesh->createEdge(v3, v5);
177 mesh::Edge &e6 = pSolidzMesh->createEdge(v5, v1);
178 pSolidzMesh->createTriangle(e1, e2, e3);
179 pSolidzMesh->createTriangle(e4, e5, e6);
180 pSolidzMesh->computeBoundingBox();
186 BOOST_TEST(pNastinMesh);
187 BOOST_TEST(pNastinMesh->getDimensions() == dimensions);
190 Eigen::VectorXd position(dimensions);
191 position << -1.0, -1.0, 0.0;
192 pNastinMesh->createVertex(position);
193 position << -0.75, -0.75, 0.5;
194 pNastinMesh->createVertex(position);
195 }
else if (rank == 1) {
197 }
else if (rank == 2) {
198 Eigen::VectorXd position(dimensions);
199 position << 0.0, 0.0, -1.0;
200 pNastinMesh->createVertex(position);
201 position << 0.5, 0.5, 0.0;
202 pNastinMesh->createVertex(position);
204 pNastinMesh->computeBoundingBox();
214 Eigen::VectorXd position(dimensions);
215 position << 0.10, 0.10, 0.1;
216 pNastinMesh->createVertex(position);
217 position << 0.90, 0.90, 0.9;
218 pNastinMesh->createVertex(position);
219 }
else if (rank == 1) {
221 }
else if (rank == 2) {
223 Eigen::VectorXd position(dimensions);
224 position << 2.1, 2.1, 2.1;
225 pNastinMesh->createVertex(position);
226 position << 2.9, 2.9, 2.1;
227 pNastinMesh->createVertex(position);
229 pNastinMesh->computeBoundingBox();
236 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
239 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
241 if (context.isNamed(
"Solid")) {
244 BOOST_TEST(pSolidzMesh->nVertices() == 6);
249 BOOST_TEST(context.isNamed(
"Fluid"));
257 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
258 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
262 double safetyFactor = 0.1;
271 BOOST_TEST_CONTEXT(*pSolidzMesh)
274 if (context.isPrimary()) {
275 BOOST_TEST(pSolidzMesh->nVertices() == 2);
276 BOOST_TEST(pSolidzMesh->edges().size() == 1);
277 }
else if (context.isRank(1)) {
278 BOOST_TEST(pSolidzMesh->nVertices() == 0);
279 BOOST_TEST(pSolidzMesh->edges().size() == 0);
280 }
else if (context.isRank(2)) {
281 BOOST_TEST(pSolidzMesh->nVertices() == 2);
282 BOOST_TEST(pSolidzMesh->edges().size() == 1);
292 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
295 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
297 if (context.isNamed(
"Solid")) {
304 BOOST_TEST(context.isNamed(
"Fluid"));
312 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
313 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
317 double safetyFactor = 0.5;
321 part.addFromMapping(boundingFromMapping);
322 part.addToMapping(boundingToMapping);
327 if (context.isPrimary()) {
328 BOOST_TEST(pSolidzMesh->nVertices() == 2);
329 BOOST_TEST(pSolidzMesh->edges().size() == 1);
330 }
else if (context.isRank(1)) {
331 BOOST_TEST(pSolidzMesh->nVertices() == 0);
332 BOOST_TEST(pSolidzMesh->edges().size() == 0);
333 }
else if (context.isRank(2)) {
334 BOOST_TEST(pSolidzMesh->nVertices() == 2);
335 BOOST_TEST(pSolidzMesh->edges().size() == 1);
344 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
348 if (context.isNamed(
"Solid")) {
355 BOOST_TEST(context.isNamed(
"Fluid"));
363 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
364 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
368 double safetyFactor = 0.1;
371 part.addFromMapping(boundingFromMapping);
372 part.addToMapping(boundingToMapping);
376 BOOST_TEST_CONTEXT(*pSolidzMesh)
379 if (context.isPrimary()) {
380 BOOST_TEST(pSolidzMesh->nVertices() == 3);
381 BOOST_TEST(pSolidzMesh->edges().size() == 2);
382 }
else if (context.isRank(1)) {
383 BOOST_TEST(pSolidzMesh->nVertices() == 0);
384 BOOST_TEST(pSolidzMesh->edges().size() == 0);
385 }
else if (context.isRank(2)) {
386 BOOST_TEST(pSolidzMesh->nVertices() == 3);
387 BOOST_TEST(pSolidzMesh->edges().size() == 2);
393#ifndef PRECICE_NO_PETSC
398 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
402 if (context.isNamed(
"Solid")) {
409 BOOST_TEST(context.isNamed(
"Fluid"));
418 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
419 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
423 double safetyFactor = 20.0;
431 BOOST_TEST_CONTEXT(*pSolidzMesh)
433 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
434 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 6);
435 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 6);
436 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 12);
437 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
440 if (context.isPrimary()) {
441 BOOST_TEST(pSolidzMesh->nVertices() == 6);
442 BOOST_TEST(pSolidzMesh->edges().size() == 5);
443 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
444 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
445 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
446 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
false);
447 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
false);
448 BOOST_TEST(pSolidzMesh->vertex(5).isOwner() ==
false);
449 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
450 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
451 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
452 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
453 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
454 BOOST_TEST(pSolidzMesh->vertex(5).getGlobalIndex() == 5);
455 }
else if (context.isRank(1)) {
456 BOOST_TEST(pSolidzMesh->nVertices() == 0);
457 BOOST_TEST(pSolidzMesh->edges().size() == 0);
458 }
else if (context.isRank(2)) {
459 BOOST_TEST(pSolidzMesh->nVertices() == 6);
460 BOOST_TEST(pSolidzMesh->edges().size() == 5);
461 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
false);
462 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
false);
463 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
false);
464 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
465 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
466 BOOST_TEST(pSolidzMesh->vertex(5).isOwner() ==
true);
467 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
468 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
469 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
470 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
471 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
472 BOOST_TEST(pSolidzMesh->vertex(5).getGlobalIndex() == 5);
482 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
486 if (context.isNamed(
"Solid")) {
493 BOOST_TEST(context.isNamed(
"Fluid"));
497 double supportRadius = 0.25;
504 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
505 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
509 double safetyFactor = 20.0;
512 part.addFromMapping(boundingFromMapping);
513 part.addToMapping(boundingToMapping);
517 BOOST_TEST_CONTEXT(*pSolidzMesh)
519 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
520 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 3);
521 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 3);
522 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 6);
523 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
526 if (context.isPrimary()) {
527 BOOST_TEST(pSolidzMesh->nVertices() == 3);
528 BOOST_TEST(pSolidzMesh->edges().size() == 2);
529 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
530 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
531 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
532 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
533 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
534 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
535 }
else if (context.isRank(1)) {
536 BOOST_TEST(pSolidzMesh->nVertices() == 0);
537 BOOST_TEST(pSolidzMesh->edges().size() == 0);
538 }
else if (context.isRank(2)) {
539 BOOST_TEST(pSolidzMesh->nVertices() == 3);
540 BOOST_TEST(pSolidzMesh->edges().size() == 2);
541 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
542 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
543 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
544 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 3);
545 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 4);
546 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 5);
556 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
560 if (context.isNamed(
"Solid")) {
567 BOOST_TEST(context.isNamed(
"Fluid"));
571 double supportRadius = 2.45;
578 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
579 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
583 double safetyFactor = 20.0;
586 part.addFromMapping(boundingFromMapping);
587 part.addToMapping(boundingToMapping);
591 BOOST_TEST_CONTEXT(*pSolidzMesh)
593 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
594 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 4);
595 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 4);
596 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 9);
597 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
600 if (context.isPrimary()) {
601 BOOST_TEST(pSolidzMesh->nVertices() == 4);
602 BOOST_TEST(pSolidzMesh->edges().size() == 3);
603 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
604 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
605 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
606 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
false);
607 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
608 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
609 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
610 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
611 }
else if (context.isRank(1)) {
612 BOOST_TEST(pSolidzMesh->nVertices() == 0);
613 BOOST_TEST(pSolidzMesh->edges().size() == 0);
614 }
else if (context.isRank(2)) {
615 BOOST_TEST(pSolidzMesh->nVertices() == 5);
616 BOOST_TEST(pSolidzMesh->edges().size() == 4);
617 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
false);
618 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
false);
619 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
620 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
621 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
622 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 1);
623 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 2);
624 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 3);
625 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 4);
626 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 5);
636 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
640 if (context.isNamed(
"Solid")) {
647 BOOST_TEST(context.isNamed(
"Fluid"));
651 double supportRadius1 = 1.2;
652 double supportRadius2 = 0.2;
660 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
661 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
665 double safetyFactor = 20.0;
668 part.addFromMapping(boundingFromMapping);
669 part.addToMapping(boundingToMapping);
673 BOOST_TEST_CONTEXT(*pSolidzMesh)
675 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 3);
676 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 5);
677 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(1) == 5);
678 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(2) == 10);
679 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 5);
682 if (context.isPrimary()) {
683 BOOST_TEST(pSolidzMesh->nVertices() == 5);
684 BOOST_TEST(pSolidzMesh->edges().size() == 6);
685 BOOST_TEST(pSolidzMesh->triangles().size() == 2);
686 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
687 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
688 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
false);
689 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
false);
690 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
false);
691 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
692 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
693 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
694 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
695 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
696 }
else if (context.isRank(1)) {
697 BOOST_TEST(pSolidzMesh->nVertices() == 0);
698 BOOST_TEST(pSolidzMesh->edges().size() == 0);
699 BOOST_TEST(pSolidzMesh->triangles().size() == 0);
700 }
else if (context.isRank(2)) {
701 BOOST_TEST(pSolidzMesh->nVertices() == 5);
702 BOOST_TEST(pSolidzMesh->edges().size() == 6);
703 BOOST_TEST(pSolidzMesh->triangles().size() == 2);
704 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
false);
705 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
false);
706 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
707 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
708 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
709 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
710 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
711 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
712 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
713 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
725 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
729 if (context.isNamed(
"Solid")) {
736 BOOST_TEST(context.isNamed(
"Fluid"));
744 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
745 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
749 double safetyFactor = 20.0;
758 if (context.isPrimary()) {
759 BOOST_TEST(pSolidzMesh->nVertices() == 2);
760 BOOST_TEST(pSolidzMesh->edges().size() == 1);
761 BOOST_TEST(pSolidzMesh->triangles().size() == 0);
762 }
else if (context.isRank(1)) {
763 BOOST_TEST(pSolidzMesh->nVertices() == 0);
764 BOOST_TEST(pSolidzMesh->edges().size() == 0);
765 BOOST_TEST(pSolidzMesh->triangles().size() == 0);
766 }
else if (context.isRank(2)) {
767 BOOST_TEST(pSolidzMesh->nVertices() == 3);
768 BOOST_TEST(pSolidzMesh->edges().size() == 3);
769 BOOST_TEST(pSolidzMesh->triangles().size() == 1);
778 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
782 if (context.isNamed(
"Solid")) {
785 Eigen::VectorXd position(dimensions);
786 position << 0.0, 0.0;
787 pMesh->createVertex(position);
788 position << 1.0, 0.0;
789 pMesh->createVertex(position);
790 position << 2.0, 0.0;
791 pMesh->createVertex(position);
793 pMesh->computeBoundingBox();
800 BOOST_TEST(context.isNamed(
"Fluid"));
806 boundingFromMapping->setMeshes(pMesh, pOtherMesh);
808 if (context.isPrimary()) {
809 Eigen::VectorXd position(dimensions);
810 position << 0.0, 0.0;
811 pOtherMesh->createVertex(position);
812 position << 0.8, 0.0;
813 pOtherMesh->createVertex(position);
814 }
else if (context.isRank(1)) {
815 Eigen::VectorXd position(dimensions);
816 position << 1.0, 0.0;
817 pOtherMesh->createVertex(position);
818 position << 1.2, 0.0;
819 pOtherMesh->createVertex(position);
820 }
else if (context.isRank(2)) {
824 pOtherMesh->computeBoundingBox();
826 double safetyFactor = 20.0;
829 part.addFromMapping(boundingFromMapping);
833 BOOST_TEST(pMesh->getVertexOffsets().size() == 3);
834 BOOST_TEST(pMesh->getVertexOffsets().at(0) == 2);
835 BOOST_TEST(pMesh->getVertexOffsets().at(1) == 3);
836 BOOST_TEST(pMesh->getVertexOffsets().at(2) == 3);
838 if (context.isPrimary()) {
839 BOOST_TEST(pMesh->getVertexDistribution().at(0).size() == 2);
840 BOOST_TEST(pMesh->getVertexDistribution().at(1).size() == 1);
841 BOOST_TEST(pMesh->getVertexDistribution().at(2).size() == 0);
842 BOOST_TEST(pMesh->getVertexDistribution().at(0).at(0) == 0);
843 BOOST_TEST(pMesh->getVertexDistribution().at(0).at(1) == 1);
844 BOOST_TEST(pMesh->getVertexDistribution().at(1).at(0) == 1);
845 BOOST_TEST(pMesh->nVertices() == 2);
846 BOOST_TEST(pMesh->vertex(0).getGlobalIndex() == 0);
847 BOOST_TEST(pMesh->vertex(1).getGlobalIndex() == 1);
848 BOOST_TEST(pMesh->vertex(0).isOwner() ==
true);
849 BOOST_TEST(pMesh->vertex(1).isOwner() ==
false);
850 }
else if (context.isRank(1)) {
851 BOOST_TEST(pMesh->nVertices() == 1);
852 BOOST_TEST(pMesh->vertex(0).getGlobalIndex() == 1);
853 BOOST_TEST(pMesh->vertex(0).isOwner() ==
true);
854 }
else if (context.isRank(2)) {
855 BOOST_TEST(pMesh->nVertices() == 0);
864 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
868 if (context.isNamed(
"Solid")) {
876 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
877 BOOST_TEST(pSolidzMesh->nVertices() == 6);
878 BOOST_TEST(pSolidzMesh->edges().size() == 5);
879 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 1);
880 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 6);
881 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
882 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
883 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
884 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
885 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
886 BOOST_TEST(pSolidzMesh->vertex(5).getGlobalIndex() == 5);
887 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
888 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
889 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
890 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
891 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
892 BOOST_TEST(pSolidzMesh->vertex(5).isOwner() ==
true);
894 BOOST_TEST(context.isNamed(
"Fluid"));
900 boundingFromMapping->setMeshes(pSolidzMesh, pOtherMesh);
902 double safetyFactor = 0.1;
909 BOOST_TEST(pSolidzMesh->getGlobalNumberOfVertices() == 6);
910 BOOST_TEST(pSolidzMesh->nVertices() == 6);
911 BOOST_TEST(pSolidzMesh->edges().size() == 5);
912 BOOST_TEST(pSolidzMesh->getVertexOffsets().size() == 1);
913 BOOST_TEST(pSolidzMesh->getVertexOffsets().at(0) == 6);
914 BOOST_TEST(pSolidzMesh->vertex(0).getGlobalIndex() == 0);
915 BOOST_TEST(pSolidzMesh->vertex(1).getGlobalIndex() == 1);
916 BOOST_TEST(pSolidzMesh->vertex(2).getGlobalIndex() == 2);
917 BOOST_TEST(pSolidzMesh->vertex(3).getGlobalIndex() == 3);
918 BOOST_TEST(pSolidzMesh->vertex(4).getGlobalIndex() == 4);
919 BOOST_TEST(pSolidzMesh->vertex(5).getGlobalIndex() == 5);
920 BOOST_TEST(pSolidzMesh->vertex(0).isOwner() ==
true);
921 BOOST_TEST(pSolidzMesh->vertex(1).isOwner() ==
true);
922 BOOST_TEST(pSolidzMesh->vertex(2).isOwner() ==
true);
923 BOOST_TEST(pSolidzMesh->vertex(3).isOwner() ==
true);
924 BOOST_TEST(pSolidzMesh->vertex(4).isOwner() ==
true);
925 BOOST_TEST(pSolidzMesh->vertex(5).isOwner() ==
true);
937 auto m2n = context.connectPrimaryRanks(
"SOLIDZ",
"NASTIN", options);
943 for (
int remoteRank = 0; remoteRank < 3; remoteRank++) {
945 for (
int i = 0; i < dimensions; i++) {
952 if (context.isNamed(
"SOLIDZ")) {
953 int connectionMapSize = 0;
956 m2n->getPrimaryRankCommunication()->send(3, 0);
959 connectionMapSize = connectedRanksList.
size();
960 BOOST_TEST_REQUIRE(connectionMapSize == 2);
964 for (
auto &rank : connectedRanksList) {
965 receivedConnectionMap[rank] = connectedRanks;
971 BOOST_TEST(receivedConnectionMap.
at(0).at(0) == 2);
972 BOOST_TEST(receivedConnectionMap.
at(2).at(0) == 0);
983 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
984 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
988 double safetyFactor = 0.0;
1006 auto m2n = context.connectPrimaryRanks(
"SOLIDZ",
"NASTIN", options);
1012 for (
int remoteRank = 0; remoteRank < 3; remoteRank++) {
1014 for (
int i = 0; i < dimensions; i++) {
1021 if (context.isNamed(
"SOLIDZ")) {
1022 int connectionMapSize = 0;
1025 m2n->getPrimaryRankCommunication()->send(3, 0);
1028 connectionMapSize = connectedRanksList.
size();
1029 BOOST_TEST(connectionMapSize == 2);
1033 for (
auto &rank : connectedRanksList) {
1034 receivedConnectionMap[rank] = connectedRanks;
1040 BOOST_TEST(receivedConnectionMap.
at(0).at(0) == 2);
1041 BOOST_TEST(receivedConnectionMap.
at(2).at(0) == 0);
1052 boundingFromMapping->setMeshes(pSolidzMesh, pNastinMesh);
1053 boundingToMapping->setMeshes(pNastinMesh, pSolidzMesh);
1057 double safetyFactor = 0.0;
1061 part.addFromMapping(boundingFromMapping);
1062 part.addToMapping(boundingToMapping);
1063 part.compareBoundingBoxes();
1069 double safetyFactor = 0;
1083 boundingFromMapping->setMeshes(
mesh,
mesh);
1084 boundingToMapping->setMeshes(
mesh,
mesh);
1092 mesh->computeBoundingBox();
1095 Access::prepareBoundingBox(part);
1096 Access::tagMeshFirstRound(part);
1097 Access::createOwnerInformation(part);
1114 if (context.isRank(0)) {
1115 Eigen::VectorXd position(dimensions);
1116 position << 0.0, 0.0;
1117 mesh->createVertex(position);
1118 position << 1.0, 0.0;
1119 mesh->createVertex(position);
1120 position << 2.0, 0.0;
1121 mesh->createVertex(position);
1122 position << 0.0, 1.0;
1123 mesh->createVertex(position);
1124 position << 1.0, 1.0;
1125 mesh->createVertex(position);
1126 position << 2.0, 1.0;
1127 mesh->createVertex(position);
1129 }
else if (context.isRank(1)) {
1130 Eigen::VectorXd position(dimensions);
1131 position << 0.0, 0.0;
1132 mesh->createVertex(position);
1133 position << -1.0, 0.0;
1134 mesh->createVertex(position);
1135 position << -2.0, 0.0;
1136 mesh->createVertex(position);
1137 position << -0.5, 1.0;
1138 mesh->createVertex(position);
1139 position << -1.0, 1.0;
1140 mesh->createVertex(position);
1141 position << -2.0, 1.0;
1142 mesh->createVertex(position);
1143 }
else if (context.isRank(2)) {
1144 Eigen::VectorXd position(dimensions);
1145 position << 0.0, 0.0;
1146 mesh->createVertex(position);
1147 position << -1.0, -0.5;
1148 mesh->createVertex(position);
1150 Eigen::VectorXd position(dimensions);
1151 position << 0.0, 0.0;
1152 mesh->createVertex(position);
1153 position << 1.0, -0.5;
1154 mesh->createVertex(position);
1155 position << 2.0, -0.5;
1156 mesh->createVertex(position);
1157 position << 0.5, -1.0;
1158 mesh->createVertex(position);
1159 position << 1.0, -1.0;
1160 mesh->createVertex(position);
1161 position << 2.0, -1.0;
1162 mesh->createVertex(position);
1165 mesh->computeBoundingBox();
1166 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1168 for (
auto &vertex :
mesh->vertices()) {
1171 if (vertex.coord(0) == 0 && vertex.coord(1) == 0) {
1172 vertex.setGlobalIndex(0);
1179 bool includeVertex =
false;
1181 for (
auto &vertex :
mesh->vertices()) {
1182 if (vertex.getGlobalIndex() == 0) {
1183 includeVertex =
true;
1184 if (context.isRank(2)) {
1185 BOOST_TEST(vertex.isOwner() == 1);
1187 BOOST_TEST(vertex.isOwner() == 0);
1190 BOOST_TEST(includeVertex ==
true);
1208 if (context.isRank(0)) {
1209 Eigen::VectorXd position(dimensions);
1210 position << 0.0, 0.0, 0.0;
1211 mesh->createVertex(position);
1212 position << 1.0, 0.0, 0.0;
1213 mesh->createVertex(position);
1214 position << 2.0, 0.0, 0.0;
1215 mesh->createVertex(position);
1216 position << 0.0, 1.0, 0.0;
1217 mesh->createVertex(position);
1218 position << 1.0, 1.0, 0.0;
1219 mesh->createVertex(position);
1220 position << 2.0, 1.0, 0.0;
1221 mesh->createVertex(position);
1222 position << 0.0, 0.0, 1.0;
1223 mesh->createVertex(position);
1224 position << 1.0, 0.0, 1.0;
1225 mesh->createVertex(position);
1226 position << 2.0, 0.0, 1.0;
1227 mesh->createVertex(position);
1228 position << 0.0, 1.0, 1.0;
1229 mesh->createVertex(position);
1230 position << 1.0, 1.0, 1.0;
1231 mesh->createVertex(position);
1232 position << 2.0, 1.0, 1.0;
1233 mesh->createVertex(position);
1235 }
else if (context.isRank(1)) {
1236 Eigen::VectorXd position(dimensions);
1237 position << 0.0, 0.0, 0.0;
1238 mesh->createVertex(position);
1239 position << -1.0, 0.0, 0.0;
1240 mesh->createVertex(position);
1241 position << -2.0, 0.0, 0.0;
1242 mesh->createVertex(position);
1243 position << -0.1, 1.0, 0.0;
1244 mesh->createVertex(position);
1245 position << -1.0, 1.0, 0.0;
1246 mesh->createVertex(position);
1247 position << -2.0, 1.0, 0.0;
1248 mesh->createVertex(position);
1249 position << 0.0, 0.0, 1.0;
1250 mesh->createVertex(position);
1251 position << -1.0, 0.0, 1.0;
1252 mesh->createVertex(position);
1253 position << -2.0, 0.0, 1.0;
1254 mesh->createVertex(position);
1255 position << -0.1, 1.0, 1.0;
1256 mesh->createVertex(position);
1257 position << -1.0, 1.0, 1.0;
1258 mesh->createVertex(position);
1259 position << -2.0, 1.0, 1.0;
1260 mesh->createVertex(position);
1261 }
else if (context.isRank(2)) {
1262 Eigen::VectorXd position(dimensions);
1263 position << 0.0, 0.0, 0.0;
1264 mesh->createVertex(position);
1265 position << -1.0, -0.1, 0.0;
1266 mesh->createVertex(position);
1267 position << -2.0, -0.1, 0.0;
1268 mesh->createVertex(position);
1269 position << 0.0, -1.0, 0.0;
1270 mesh->createVertex(position);
1271 position << -1.0, -1.0, 0.0;
1272 mesh->createVertex(position);
1273 position << -2.0, -1.0, 0.0;
1274 mesh->createVertex(position);
1275 position << 0.0, 0.0, 1.0;
1276 mesh->createVertex(position);
1277 position << -1.0, -0.1, 1.0;
1278 mesh->createVertex(position);
1279 position << -2.0, -0.1, 1.0;
1280 mesh->createVertex(position);
1281 position << 0.0, -1.0, 1.0;
1282 mesh->createVertex(position);
1283 position << -1.0, -1.0, 1.0;
1284 mesh->createVertex(position);
1285 position << -2.0, -1.0, 1.0;
1286 mesh->createVertex(position);
1288 Eigen::VectorXd position(dimensions);
1289 position << 0.0, 0.0, 0.0;
1290 mesh->createVertex(position);
1291 position << 1.0, -0.1, 0.0;
1292 mesh->createVertex(position);
1293 position << 2.0, -0.1, 0.0;
1294 mesh->createVertex(position);
1295 position << 0.0, -1.0, 0.0;
1296 mesh->createVertex(position);
1297 position << 1.0, -1.0, 0.0;
1298 mesh->createVertex(position);
1299 position << 2.0, -1.0, 0.0;
1300 mesh->createVertex(position);
1301 position << 0.0, 0.0, 1.0;
1302 mesh->createVertex(position);
1303 position << 1.0, -0.1, 1.0;
1304 mesh->createVertex(position);
1305 position << 2.0, -0.1, 1.0;
1306 mesh->createVertex(position);
1307 position << 0.0, -1.0, 1.0;
1308 mesh->createVertex(position);
1309 position << 1.0, -1.0, 1.0;
1310 mesh->createVertex(position);
1311 position << 2.0, -1.0, 1.0;
1312 mesh->createVertex(position);
1315 mesh->computeBoundingBox();
1316 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1318 for (
auto &vertex :
mesh->vertices()) {
1321 if (vertex.coord(0) == 0 && vertex.coord(1) == 0) {
1322 if (vertex.coord(2) == 0) {
1323 vertex.setGlobalIndex(0);
1324 }
else if (vertex.coord(2) == 1) {
1325 vertex.setGlobalIndex(6);
1333 bool includeVertex =
false;
1335 for (
auto &vertex :
mesh->vertices()) {
1336 if (vertex.getGlobalIndex() == 0) {
1337 includeVertex =
true;
1338 if (context.isRank(0)) {
1339 BOOST_TEST(vertex.isOwner() == 1);
1341 BOOST_TEST(vertex.isOwner() == 0);
1344 BOOST_TEST(includeVertex ==
true);
1362 if (context.isRank(0)) {
1363 Eigen::VectorXd position(dimensions);
1364 position << 0.0, 0.0, 0.0;
1365 mesh->createVertex(position);
1366 position << 1.0, 0.0, 0.0;
1367 mesh->createVertex(position);
1368 position << 2.0, 0.0, 0.0;
1369 mesh->createVertex(position);
1370 position << 0.0, 1.0, 0.0;
1371 mesh->createVertex(position);
1372 position << 1.0, 1.0, 0.0;
1373 mesh->createVertex(position);
1374 position << 2.0, 1.0, 0.0;
1375 mesh->createVertex(position);
1376 position << 0.0, 0.0, 1.0;
1377 mesh->createVertex(position);
1378 position << 1.0, 0.0, 1.0;
1379 mesh->createVertex(position);
1380 position << 2.0, 0.0, 1.0;
1381 mesh->createVertex(position);
1382 position << 0.0, 1.0, 1.0;
1383 mesh->createVertex(position);
1384 position << 1.0, 1.0, 1.0;
1385 mesh->createVertex(position);
1386 position << 2.0, 1.0, 1.0;
1387 mesh->createVertex(position);
1389 }
else if (context.isRank(1)) {
1390 Eigen::VectorXd position(dimensions);
1391 position << 0.0, 0.0, 0.0;
1392 mesh->createVertex(position);
1393 position << -1.0, 0.0, 0.0;
1394 mesh->createVertex(position);
1395 position << -2.0, 0.0, 0.0;
1396 mesh->createVertex(position);
1397 position << -0.1, 1.0, 0.0;
1398 mesh->createVertex(position);
1399 position << -1.0, 1.0, 0.0;
1400 mesh->createVertex(position);
1401 position << -2.0, 1.0, 0.0;
1402 mesh->createVertex(position);
1403 position << 0.0, 0.0, 1.0;
1404 mesh->createVertex(position);
1405 position << -1.0, 0.0, 1.0;
1406 mesh->createVertex(position);
1407 position << -2.0, 0.0, 1.0;
1408 mesh->createVertex(position);
1409 position << -0.1, 1.0, 1.0;
1410 mesh->createVertex(position);
1411 position << -1.0, 1.0, 1.0;
1412 mesh->createVertex(position);
1413 position << -2.0, 1.0, 1.0;
1414 mesh->createVertex(position);
1415 }
else if (context.isRank(2)) {
1417 Eigen::VectorXd position(dimensions);
1418 position << 0.0, 0.0, 0.0;
1419 mesh->createVertex(position);
1420 position << 1.0, -0.1, 0.0;
1421 mesh->createVertex(position);
1422 position << 2.0, -0.1, 0.0;
1423 mesh->createVertex(position);
1424 position << 0.0, -1.0, 0.0;
1425 mesh->createVertex(position);
1426 position << 1.0, -1.0, 0.0;
1427 mesh->createVertex(position);
1428 position << 2.0, -1.0, 0.0;
1429 mesh->createVertex(position);
1430 position << 0.0, 0.0, 1.0;
1431 mesh->createVertex(position);
1432 position << 1.0, -0.1, 1.0;
1433 mesh->createVertex(position);
1434 position << 2.0, -0.1, 1.0;
1435 mesh->createVertex(position);
1436 position << 0.0, -1.0, 1.0;
1437 mesh->createVertex(position);
1438 position << 1.0, -1.0, 1.0;
1439 mesh->createVertex(position);
1440 position << 2.0, -1.0, 1.0;
1441 mesh->createVertex(position);
1444 mesh->computeBoundingBox();
1445 mesh->setGlobalNumberOfVertices(
mesh->nVertices());
1447 for (
auto &vertex :
mesh->vertices()) {
1450 if (vertex.coord(0) == 0 && vertex.coord(1) == 0) {
1451 if (vertex.coord(2) == 0) {
1452 vertex.setGlobalIndex(0);
1453 }
else if (vertex.coord(2) == 1) {
1454 vertex.setGlobalIndex(6);
1462 bool includeVertex =
false;
1464 for (
auto &vertex :
mesh->vertices()) {
1465 if (vertex.getGlobalIndex() == 0) {
1466 includeVertex =
true;
1467 if (context.isRank(0)) {
1468 BOOST_TEST(vertex.isOwner() == 1);
1470 BOOST_TEST(vertex.isOwner() == 0);
1473 BOOST_TEST(includeVertex ==
true);
1482 auto m2n = context.connectPrimaryRanks(
"Solid",
"Fluid");
1485 Eigen::VectorXd offset = Eigen::VectorXd::Zero(dimensions);
1487 if (context.isNamed(
"Solid")) {
1490 BOOST_TEST(pSolidzMesh->nVertices() == 6);
1495 BOOST_TEST(context.isNamed(
"Fluid"));
1509 boundingFromMapping1->setMeshes(pSolidzMesh, pNastinMesh1);
1510 boundingToMapping1->setMeshes(pNastinMesh1, pSolidzMesh);
1511 boundingFromMapping2->setMeshes(pSolidzMesh, pNastinMesh2);
1512 boundingToMapping2->setMeshes(pNastinMesh3, pSolidzMesh);
1514 if (context.rank == 0) {
1515 Eigen::VectorXd position(dimensions);
1516 position << 0.0, 0.0;
1517 pNastinMesh1->createVertex(position);
1518 position << 0.0, 2.0;
1519 pNastinMesh2->createVertex(position);
1520 }
else if (context.rank == 1) {
1522 }
else if (context.rank == 2) {
1523 Eigen::VectorXd position(dimensions);
1524 position << 0.0, 4.0;
1525 pNastinMesh2->createVertex(position);
1526 position << 0.0, 6.0;
1527 pNastinMesh3->createVertex(position);
1529 pNastinMesh1->computeBoundingBox();
1530 pNastinMesh2->computeBoundingBox();
1531 pNastinMesh3->computeBoundingBox();
1533 double safetyFactor = 0.1;
1537 part.addFromMapping(boundingFromMapping1);
1538 part.addToMapping(boundingToMapping1);
1539 part.addFromMapping(boundingFromMapping2);
1540 part.addToMapping(boundingToMapping2);
1544 BOOST_TEST_CONTEXT(*pSolidzMesh)
1547 if (context.isPrimary()) {
1548 BOOST_TEST(pSolidzMesh->nVertices() == 2);
1549 BOOST_TEST(pSolidzMesh->edges().size() == 1);
1550 }
else if (context.isRank(1)) {
1551 BOOST_TEST(pSolidzMesh->nVertices() == 0);
1552 BOOST_TEST(pSolidzMesh->edges().size() == 0);
1553 }
else if (context.isRank(2)) {
1554 BOOST_TEST(pSolidzMesh->nVertices() == 2);
1555 BOOST_TEST(pSolidzMesh->edges().size() == 1);
BOOST_AUTO_TEST_CASE(testIQNIMVJPPWithSubsteps)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
void createNastinMesh3D2(mesh::PtrMesh pNastinMesh, Rank rank)
void createNastinMesh2D2(mesh::PtrMesh pNastinMesh, Rank rank)
void testParallelSetOwnerInformation(mesh::PtrMesh mesh, int dimensions)
void createSolidzMesh2DSmall(mesh::PtrMesh pSolidzMesh)
void createNastinMesh2D(mesh::PtrMesh pNastinMesh, Rank rank)
void createSolidzMesh3D(mesh::PtrMesh pSolidzMesh)
void createNastinMesh3D(mesh::PtrMesh pNastinMesh, Rank rank)
void createSolidzMesh2D(mesh::PtrMesh pSolidzMesh)
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
#define PRECICE_ASSERT(...)
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.
Container and creator for meshes.
std::map< int, BoundingBox > BoundingBoxMap
void setGlobalIndex(int globalIndex)
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.
@ 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)
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
contains the partitioning of distributed meshes.
@ PETSc
Require to initialize PETSc. This implies the initialization of Events.
@ Events
Require to initialize Event.
Main namespace of the precice library.