39 std::vector<double>
value;
69 int globalIndexOffset = 0,
70 bool meshIsSmaller =
false)
73 for (
auto &vertex : meshSpec.
vertices) {
74 if (vertex.rank == context.
rank or vertex.rank == -1) {
75 if (vertex.position.size() == 3)
76 distributedMesh->
createVertex(Eigen::Vector3d(vertex.position.data()));
77 else if (vertex.position.size() == 2)
78 distributedMesh->
createVertex(Eigen::Vector2d(vertex.position.data()));
80 if (vertex.owner == context.
rank)
81 distributedMesh->
vertices().back().setOwner(
true);
83 distributedMesh->
vertices().back().setOwner(
false);
93 return distributedMesh;
102 for (
auto &vertex : meshSpec.
vertices) {
103 if (vertex.rank == context.
rank or vertex.rank == -1) {
104 int valueDimension = vertex.value.size();
105 d.conservativeResize(i * valueDimension + valueDimension);
107 for (
int dim = 0; dim < valueDimension; ++dim) {
108 d(i * valueDimension + dim) = vertex.value.at(dim);
121 int inGlobalIndexOffset = 0,
122 bool meshIsSmaller =
false)
124 int valueDimension = inMeshSpec.
vertices.at(0).value.size();
131 mapping.setMeshes(inMesh, outMesh);
132 BOOST_TEST(
mapping.hasComputedMapping() ==
false);
135 BOOST_TEST(
mapping.hasComputedMapping() ==
true);
137 mapping.map(inSample, outValues);
140 for (
auto &referenceVertex : referenceSpec) {
141 if (referenceVertex.first == context.
rank or referenceVertex.first == -1) {
142 for (
int dim = 0; dim < valueDimension; ++dim) {
143 BOOST_TEST_INFO(
"Index of vertex: " << index <<
" - Dimension: " << dim);
144 BOOST_TEST(outValues(index * valueDimension + dim) == referenceVertex.second.at(dim));
149 BOOST_TEST(outValues.size() == index * valueDimension);
161 std::vector<VertexSpecification> inVertexList{
162 {-1, 0, {0, 0}, {1}},
163 {-1, 0, {0, 1}, {2}},
164 {-1, 1, {1, 0}, {3}},
165 {-1, 1, {1, 1}, {4}},
166 {-1, 2, {2, 0}, {5}},
167 {-1, 2, {2, 1}, {6}},
168 {-1, 3, {3, 0}, {7}},
169 {-1, 3, {3, 1}, {8}}};
172 std::move(inVertexList),
176 std::vector<VertexSpecification> outVertexList{
177 {0, -1, {0, 0}, {0}},
178 {0, -1, {0, 1}, {0}},
179 {1, -1, {1, 0}, {0}},
180 {1, -1, {1, 1}, {0}},
181 {2, -1, {2, 0}, {0}},
182 {2, -1, {2, 1}, {0}},
183 {3, -1, {3, 0}, {0}},
184 {3, -1, {3, 1}, {0}}};
187 std::move(outVertexList),
214 std::vector<VertexSpecification> inVertexList{
215 {-1, 0, {0, 0}, {1, 4}},
216 {-1, 0, {0, 1}, {2, 5}},
217 {-1, 1, {1, 0}, {3, 6}},
218 {-1, 1, {1, 1}, {4, 7}},
219 {-1, 2, {2, 0}, {5, 8}},
220 {-1, 2, {2, 1}, {6, 9}},
221 {-1, 3, {3, 0}, {7, 10}},
222 {-1, 3, {3, 1}, {8, 11}}};
224 std::move(inVertexList),
228 std::vector<VertexSpecification> outVertexList{
229 {0, -1, {0, 0}, {0, 0}},
230 {0, -1, {0, 1}, {0, 0}},
231 {1, -1, {1, 0}, {0, 0}},
232 {1, -1, {1, 1}, {0, 0}},
233 {2, -1, {2, 0}, {0, 0}},
234 {2, -1, {2, 1}, {0, 0}},
235 {3, -1, {3, 0}, {0, 0}},
236 {3, -1, {3, 1}, {0, 0}}};
238 std::move(outVertexList),
266 std::vector<VertexSpecification> inVertexList{
267 {-1, 0, {0, 0}, {1}},
268 {-1, 0, {0, 1}, {2}},
269 {-1, 1, {1, 0}, {3}},
270 {-1, 1, {1, 1}, {4}},
271 {-1, 1, {2, 0}, {5}},
272 {-1, 3, {2, 1}, {6}},
273 {-1, 3, {3, 0}, {7}},
274 {-1, 3, {3, 1}, {8}}};
277 std::move(inVertexList),
280 std::vector<VertexSpecification> outVertexList{
281 {0, -1, {0, 0}, {0}},
282 {0, -1, {0, 1}, {0}},
283 {0, -1, {1, 0}, {0}},
284 {2, -1, {1, 1}, {0}},
285 {2, -1, {2, 0}, {0}},
286 {2, -1, {2, 1}, {0}},
287 {3, -1, {3, 0}, {0}},
288 {3, -1, {3, 1}, {0}}};
290 std::move(outVertexList),
318 std::vector<int> globalIndexOffsets = {0, 0, 0, 4};
320 std::vector<VertexSpecification> inVertexList{
325 {0, -1, {1, 1}, {4}},
326 {0, -1, {2, 0}, {5}},
327 {0, -1, {2, 1}, {6}},
330 {2, -1, {0, 0}, {1}},
331 {2, -1, {0, 1}, {2}},
332 {2, -1, {1, 0}, {3}},
334 {2, -1, {2, 0}, {5}},
336 {2, -1, {3, 0}, {7}},
337 {2, -1, {3, 1}, {8}},
340 {3, -1, {2, 1}, {6}},
345 std::move(inVertexList),
348 std::vector<VertexSpecification> outVertexList{
349 {0, -1, {0, 0}, {0}},
350 {0, -1, {0, 1}, {0}},
351 {0, -1, {1, 0}, {0}},
352 {2, -1, {1, 1}, {0}},
353 {2, -1, {2, 0}, {0}},
354 {2, -1, {2, 1}, {0}},
355 {3, -1, {3, 0}, {0}},
356 {3, -1, {3, 1}, {0}}};
358 std::move(outVertexList),
373 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
375 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
377 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
387 std::vector<int> globalIndexOffsets = {0, 0, 0, 4};
389 std::vector<VertexSpecification> inVertexList{
391 {0, 0, {0, 0}, {1, 4}},
392 {0, 0, {0, 1}, {2, 5}},
393 {0, 0, {1, 0}, {3, 6}},
394 {0, -1, {1, 1}, {4, 7}},
395 {0, -1, {2, 0}, {5, 8}},
396 {0, -1, {2, 1}, {6, 9}},
399 {2, -1, {0, 0}, {1, 4}},
400 {2, -1, {0, 1}, {2, 5}},
401 {2, -1, {1, 0}, {3, 6}},
402 {2, 2, {1, 1}, {4, 7}},
403 {2, -1, {2, 0}, {5, 8}},
404 {2, 2, {2, 1}, {6, 9}},
405 {2, -1, {3, 0}, {7, 10}},
406 {2, -1, {3, 1}, {8, 11}},
408 {3, 3, {2, 0}, {5, 8}},
409 {3, -1, {2, 1}, {6, 9}},
410 {3, 3, {3, 0}, {7, 10}},
411 {3, 3, {3, 1}, {8, 11}},
414 std::move(inVertexList),
417 std::vector<VertexSpecification> outVertexList{
418 {0, -1, {0, 0}, {0, 0}},
419 {0, -1, {0, 1}, {0, 0}},
420 {0, -1, {1, 0}, {0, 0}},
421 {2, -1, {1, 1}, {0, 0}},
422 {2, -1, {2, 0}, {0, 0}},
423 {2, -1, {2, 1}, {0, 0}},
424 {3, -1, {3, 0}, {0, 0}},
425 {3, -1, {3, 1}, {0, 0}}};
427 std::move(outVertexList),
442 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
444 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
446 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
456 std::vector<int> globalIndexOffsets = {0, 0, 0, 0};
458 std::vector<VertexSpecification> inVertexList{
461 {1, 1, {0, 0}, {1.1}},
462 {1, 1, {0, 1}, {2.5}},
465 {1, -1, {2, 0}, {5}},
466 {1, -1, {2, 1}, {6}},
467 {1, -1, {3, 0}, {7}},
468 {1, -1, {3, 1}, {8}},
470 {2, -1, {0, 0}, {1.1}},
471 {2, -1, {0, 1}, {2.5}},
472 {2, -1, {1, 0}, {3}},
473 {2, -1, {1, 1}, {4}},
481 std::move(inVertexList),
484 std::vector<VertexSpecification> outVertexList{
486 {1, -1, {2, 0}, {0}},
487 {1, -1, {1, 0}, {0}},
488 {1, -1, {0, 1}, {0}},
489 {1, -1, {1, 1}, {0}},
490 {1, -1, {0, 0}, {0}},
491 {2, -1, {2, 0}, {0}},
492 {2, -1, {2, 1}, {0}},
493 {2, -1, {3, 0}, {0}},
494 {2, -1, {3, 1}, {0}}};
496 std::move(outVertexList),
509 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
511 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
513 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
523 std::vector<int> globalIndexOffsets = {0, 0, 0, 0};
524 std::vector<VertexSpecification> inVertexList = {
526 {0, 0, {0, 0}, {1.1}},
527 {0, 0, {0, 1}, {2.5}},
528 {0, -1, {1, 0}, {3}},
529 {0, -1, {1, 1}, {4}},
530 {0, -1, {2, 0}, {5}},
531 {0, -1, {2, 1}, {6}},
532 {0, -1, {3, 0}, {7}},
533 {0, -1, {3, 1}, {8}},
534 {1, -1, {0, 0}, {1.1}},
535 {1, -1, {0, 1}, {2.5}},
538 {1, -1, {2, 0}, {5}},
539 {1, -1, {2, 1}, {6}},
540 {1, -1, {3, 0}, {7}},
541 {1, -1, {3, 1}, {8}},
542 {2, -1, {0, 0}, {1.1}},
543 {2, -1, {0, 1}, {2.5}},
544 {2, -1, {1, 0}, {3}},
545 {2, -1, {1, 1}, {4}},
548 {2, -1, {3, 0}, {7}},
549 {2, -1, {3, 1}, {8}},
550 {3, -1, {0, 0}, {1.1}},
551 {3, -1, {0, 1}, {2.5}},
552 {3, -1, {1, 0}, {3}},
553 {3, -1, {1, 1}, {4}},
554 {3, -1, {2, 0}, {5}},
555 {3, -1, {2, 1}, {6}},
560 std::move(inVertexList),
563 std::vector<VertexSpecification> outVertexList{
565 {1, -1, {2, 0}, {0}},
566 {1, -1, {1, 0}, {0}},
567 {1, -1, {0, 1}, {0}},
568 {1, -1, {1, 1}, {0}},
569 {1, -1, {0, 0}, {0}},
570 {2, -1, {2, 0}, {0}},
571 {2, -1, {2, 1}, {0}},
572 {2, -1, {3, 0}, {0}},
573 {2, -1, {3, 1}, {0}}};
575 std::move(outVertexList),
588 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
590 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
592 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
598 *
boost::unit_test::tolerance(1e-7))
602 std::vector<int> globalIndexOffsets = {0, 0, 0, 0};
604 std::vector<VertexSpecification> inVertexList{
611 {1, -1, {2, 0}, {5}},
612 {1, -1, {2, 1}, {6}},
613 {1, -1, {3, 0}, {7}},
614 {1, -1, {3, 1}, {8}},
616 {2, -1, {0, 0}, {1}},
617 {2, -1, {0, 1}, {2}},
618 {2, -1, {1, 0}, {3}},
619 {2, -1, {1, 1}, {4}},
627 std::move(inVertexList),
630 std::vector<VertexSpecification> outVertexList{
632 {1, -1, {2, 0}, {0}},
633 {1, -1, {1, 0}, {0}},
634 {1, -1, {0, 1}, {0}},
635 {1, -1, {1, 1}, {0}},
636 {1, -1, {0, 0}, {0}},
637 {2, -1, {2, 0}, {0}},
638 {2, -1, {2, 1}, {0}},
639 {2, -1, {3, 0}, {0}},
640 {2, -1, {3, 1}, {0}}};
642 std::move(outVertexList),
655 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
657 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
659 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
669 std::vector<VertexSpecification> inVertexList{
670 {0, -1, {0, 0}, {1}},
671 {0, -1, {0, 1}, {2}},
672 {1, -1, {1, 0}, {3}},
673 {1, -1, {1, 1}, {4}},
674 {2, -1, {2, 0}, {5}},
675 {2, -1, {2, 1}, {6}},
676 {3, -1, {3, 0}, {7}},
677 {3, -1, {3, 1}, {8}}};
679 std::move(inVertexList),
682 std::vector<VertexSpecification> outVertexList{
683 {-1, 0, {0, 0}, {0}},
684 {-1, 0, {0, 1}, {0}},
685 {-1, 1, {1, 0}, {0}},
686 {-1, 1, {1, 1}, {0}},
687 {-1, 2, {2, 0}, {0}},
688 {-1, 2, {2, 1}, {0}},
689 {-1, 3, {3, 0}, {0}},
690 {-1, 3, {3, 1}, {0}}};
692 std::move(outVertexList),
744 std::vector<VertexSpecification> inVertexList{
745 {0, -1, {0, 0}, {1, 4}},
746 {0, -1, {0, 1}, {2, 5}},
747 {1, -1, {1, 0}, {3, 6}},
748 {1, -1, {1, 1}, {4, 7}},
749 {2, -1, {2, 0}, {5, 8}},
750 {2, -1, {2, 1}, {6, 9}},
751 {3, -1, {3, 0}, {7, 10}},
752 {3, -1, {3, 1}, {8, 11}}};
754 std::move(inVertexList),
757 std::vector<VertexSpecification> outVertexList{
758 {-1, 0, {0, 0}, {0, 0}},
759 {-1, 0, {0, 1}, {0, 0}},
760 {-1, 1, {1, 0}, {0, 0}},
761 {-1, 1, {1, 1}, {0, 0}},
762 {-1, 2, {2, 0}, {0, 0}},
763 {-1, 2, {2, 1}, {0, 0}},
764 {-1, 3, {3, 0}, {0, 0}},
765 {-1, 3, {3, 1}, {0, 0}}};
767 std::move(outVertexList),
819 std::vector<int> globalIndexOffsets = {0, 0, 4, 6};
821 std::vector<VertexSpecification> inVertexList{
822 {1, -1, {0, 0}, {1}},
823 {1, -1, {0, 1}, {2}},
824 {1, -1, {1, 0}, {3}},
825 {1, -1, {1, 1}, {4}},
826 {2, -1, {2, 0}, {5}},
827 {2, -1, {2, 1}, {6}},
828 {3, -1, {3, 0}, {7}},
829 {3, -1, {3, 1}, {8}}};
831 std::move(inVertexList),
834 std::vector<VertexSpecification> outVertexList{
835 {-1, 1, {0, 0}, {0}},
836 {-1, 1, {0, 1}, {0}},
837 {-1, 1, {1, 0}, {0}},
838 {-1, 1, {1, 1}, {0}},
839 {-1, 2, {2, 0}, {0}},
840 {-1, 2, {2, 1}, {0}},
841 {-1, 3, {3, 0}, {0}},
842 {-1, 3, {3, 1}, {0}}};
844 std::move(outVertexList),
883 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
885 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
887 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
896 std::vector<int> globalIndexOffsets = {0, 0, 3, 5};
898 std::vector<VertexSpecification> inVertexList{
899 {1, -1, {0, 0}, {1}},
900 {1, -1, {1, 0}, {3}},
901 {1, -1, {1, 1}, {4}},
902 {2, -1, {2, 0}, {5}},
903 {2, -1, {2, 1}, {6}},
904 {3, -1, {3, 0}, {7}},
905 {3, -1, {3, 1}, {8}}};
907 std::move(inVertexList),
910 std::vector<VertexSpecification> outVertexList{
911 {-1, 1, {0, 0}, {0}},
912 {-1, 1, {0, 1}, {0}},
913 {-1, 1, {1, 0}, {0}},
914 {-1, 1, {1, 1}, {0}},
915 {-1, 2, {2, 0}, {0}},
916 {-1, 2, {2, 1}, {0}},
917 {-1, 3, {3, 0}, {0}},
918 {-1, 3, {3, 1}, {0}}};
920 std::move(outVertexList),
959 testDistributed(context, mapping_on, in, out, ref, globalIndexOffsets.at(context.rank));
961 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank));
963 testDistributed(context, mapping_off, in, out, ref, globalIndexOffsets.at(context.rank));
969 *
boost::unit_test::tolerance(1e-6))
973 std::vector<int> globalIndexOffsets = {0, 2, 4, 6};
975 std::vector<VertexSpecification> inVertexList{
976 {0, -1, {0, 0}, {1}},
977 {0, -1, {0, 1}, {2}},
978 {1, -1, {1, 0}, {3}},
979 {1, -1, {1, 1}, {4}},
980 {2, -1, {2, 0}, {5}},
981 {2, -1, {2, 1}, {6}},
982 {3, -1, {3, 0}, {7}},
983 {3, -1, {3, 1}, {8}}};
985 std::move(inVertexList),
988 std::vector<VertexSpecification> outVertexList{
989 {-1, 1, {0, 1}, {0}},
990 {-1, 1, {1, 0}, {0}},
991 {-1, 1, {1, 1}, {0}},
992 {-1, 2, {2, 0}, {0}},
993 {-1, 2, {2, 1}, {0}},
994 {-1, 3, {3, 0}, {0}},
995 {-1, 3, {3, 1}, {0}}};
997 std::move(outVertexList),
1009 {1, {3.1307987056295525}},
1010 {1, {4.0734031184906971}},
1011 {1, {3.0620533966233006}},
1019 {2, {4.4582564956060873}},
1020 {2, {5.8784343572772633}},
1028 {3, {7.4683403859032156}},
1029 {3, {7.9287135404698859}}};
1031 testDistributed(context, mapping_sep, in, out, ref, globalIndexOffsets.at(context.rank),
true);
1041 std::vector<VertexSpecification> inVertexList{
1042 {0, -1, {0, 0}, {1}},
1043 {0, -1, {0, 1}, {2}},
1044 {1, -1, {1, 0}, {3}},
1045 {1, -1, {1, 1}, {4}},
1046 {2, -1, {2, 0}, {5}},
1047 {2, -1, {2, 1}, {6}},
1048 {3, -1, {3, 0}, {7}},
1049 {3, -1, {3, 1}, {8}}};
1051 std::move(inVertexList),
1054 std::vector<VertexSpecification> outVertexList{
1055 {-1, 0, {0, 0}, {0}},
1056 {-1, 1, {0, 1}, {0}},
1057 {-1, 1, {1, 0}, {0}},
1058 {-1, 0, {1, 1}, {0}},
1059 {-1, 2, {2, 0}, {0}},
1060 {-1, 2, {2, 1}, {0}},
1061 {-1, 3, {3, 0}, {0}},
1062 {-1, 3, {3, 1}, {0}}};
1064 std::move(outVertexList),
1105 testDistributed(context, mapping_sep, in, out, ref, context.rank * 2);
1107 testDistributed(context, mapping_off, in, out, ref, context.rank * 2);
1117 std::vector<VertexSpecification> inVertexList{
1118 {0, -1, {0, 0}, {1, 4}},
1119 {0, -1, {0, 1}, {2, 5}},
1120 {1, -1, {1, 0}, {3, 6}},
1121 {1, -1, {1, 1}, {4, 7}},
1122 {2, -1, {2, 0}, {5, 8}},
1123 {2, -1, {2, 1}, {6, 9}},
1124 {3, -1, {3, 0}, {7, 10}},
1125 {3, -1, {3, 1}, {8, 11}}};
1127 std::move(inVertexList),
1130 std::vector<VertexSpecification> outVertexList{
1131 {-1, 0, {0, 0}, {0, 0}},
1132 {-1, 1, {0, 1}, {0, 0}},
1133 {-1, 1, {1, 0}, {0, 0}},
1134 {-1, 0, {1, 1}, {0, 0}},
1135 {-1, 2, {2, 0}, {0, 0}},
1136 {-1, 2, {2, 1}, {0, 0}},
1137 {-1, 3, {3, 0}, {0, 0}},
1138 {-1, 3, {3, 1}, {0, 0}}};
1140 std::move(outVertexList),
1180 testDistributed(context, mapping_sep, in, out, ref, context.rank * 2);
1182 testDistributed(context, mapping_off, in, out, ref, context.rank * 2);
1206 mapping.setMeshes(inMesh, outMesh);
1209 for (
const auto &v : inMesh->
vertices()) {
1210 auto pos = std::find_if(shouldTagFirstRound.
vertices.begin(), shouldTagFirstRound.
vertices.end(),
1212 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1214 bool found = pos != shouldTagFirstRound.
vertices.end();
1215 BOOST_TEST(found >= v.isTagged(),
1216 "FirstRound: Vertex " << v <<
" is tagged, but should not be.");
1217 BOOST_TEST(found <= v.isTagged(),
1218 "FirstRound: Vertex " << v <<
" is not tagged, but should be.");
1223 for (
const auto &v : inMesh->
vertices()) {
1224 auto posFirst = std::find_if(shouldTagFirstRound.
vertices.begin(), shouldTagFirstRound.
vertices.end(),
1226 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1228 bool foundFirst = posFirst != shouldTagFirstRound.
vertices.end();
1229 auto posSecond = std::find_if(shouldTagSecondRound.
vertices.begin(), shouldTagSecondRound.
vertices.end(),
1231 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1233 bool foundSecond = posSecond != shouldTagSecondRound.
vertices.end();
1234 BOOST_TEST(foundFirst <= v.isTagged(),
"SecondRound: Vertex " << v
1235 <<
" is not tagged, but should be from the first round.");
1236 BOOST_TEST(foundSecond <= v.isTagged(),
"SecondRound: Vertex " << v
1237 <<
" is not tagged, but should be.");
1238 BOOST_TEST((foundSecond or foundFirst) >= v.isTagged(),
"SecondRound: Vertex " << v
1239 <<
" is tagged, but should not be.");
1252 std::vector<VertexSpecification> outVertexList{
1253 {0, -1, {0, 0}, {0}}};
1255 std::move(outVertexList),
1258 std::vector<VertexSpecification> inVertexList{
1259 {0, -1, {-1, 0}, {1}},
1260 {0, -1, {-2, 0}, {1}},
1261 {0, 0, {1, 0}, {1}},
1262 {0, -1, {2, 0}, {1}},
1263 {0, -1, {0, -1}, {1}},
1264 {0, -1, {0, -2}, {1}},
1265 {0, -1, {0, 1}, {1}},
1266 {0, -1, {0, 2}, {1}}
1269 std::move(inVertexList),
1272 std::vector<VertexSpecification> firstRoundVertices = {
1273 {0, -1, {-1, 0}, {1}},
1274 {0, -1, {1, 0}, {1}},
1275 {0, -1, {0, -1}, {1}},
1276 {0, -1, {0, 1}, {1}}};
1280 static_cast<int>(firstRoundVertices.at(0).position.size()),
1282 std::vector<VertexSpecification> secondRoundVertices = {
1283 {0, -1, {2, 0}, {1}}};
1285 secondRoundVertices,
1286 static_cast<int>(secondRoundVertices.at(0).position.size()),
1288 testTagging(context, inMeshSpec, outMeshSpec, shouldTagFirstRound, shouldTagSecondRound,
true);
1290 testTagging(context, outMeshSpec, inMeshSpec, shouldTagFirstRound, shouldTagSecondRound,
false);
1298#define doLocalCode(Type, function, polynomial) \
1300 RadialBasisFctMapping<RadialBasisFctSolver<Type>> consistentMap2D(Mapping::CONSISTENT, 2, function, {{false, false, false}}, polynomial); \
1301 perform2DTestConsistentMapping(consistentMap2D); \
1302 RadialBasisFctMapping<RadialBasisFctSolver<Type>> consistentMap2DVector(Mapping::CONSISTENT, 2, function, {{false, false, false}}, polynomial); \
1303 perform2DTestConsistentMappingVector(consistentMap2DVector); \
1304 RadialBasisFctMapping<RadialBasisFctSolver<Type>> consistentMap3D(Mapping::CONSISTENT, 3, function, {{false, false, false}}, polynomial); \
1305 perform3DTestConsistentMapping(consistentMap3D); \
1306 RadialBasisFctMapping<RadialBasisFctSolver<Type>> scaledConsistentMap2D(Mapping::SCALED_CONSISTENT_SURFACE, 2, function, {{false, false, false}}, polynomial); \
1307 perform2DTestScaledConsistentMapping(scaledConsistentMap2D); \
1308 RadialBasisFctMapping<RadialBasisFctSolver<Type>> scaledConsistentMap3D(Mapping::SCALED_CONSISTENT_SURFACE, 3, function, {{false, false, false}}, polynomial); \
1309 perform3DTestScaledConsistentMapping(scaledConsistentMap3D); \
1310 RadialBasisFctMapping<RadialBasisFctSolver<Type>> conservativeMap2D(Mapping::CONSERVATIVE, 2, function, {{false, false, false}}, polynomial); \
1311 perform2DTestConservativeMapping(conservativeMap2D); \
1312 RadialBasisFctMapping<RadialBasisFctSolver<Type>> conservativeMap2DVector(Mapping::CONSERVATIVE, 2, function, {{false, false, false}}, polynomial); \
1313 perform2DTestConservativeMappingVector(conservativeMap2DVector); \
1314 RadialBasisFctMapping<RadialBasisFctSolver<Type>> conservativeMap3D(Mapping::CONSERVATIVE, 3, function, {{false, false, false}}, polynomial); \
1315 perform3DTestConservativeMapping(conservativeMap3D); \
1365 double supportRadius = 1.2;
1374 double supportRadius = 1.2;
1383 double supportRadius = 1.2;
1392 double supportRadius = 1.2;
1401 double supportRadius = 1.2;
1410 double supportRadius = 1.2;
1418 using Eigen::Vector2d;
1427 {{xDead, yDead, zDead}}, polynomial);
1431 inMesh->createVertex(Vector2d(0.0, 1.0));
1432 inMesh->createVertex(Vector2d(1.0, 1.0));
1433 inMesh->createVertex(Vector2d(2.0, 1.0));
1434 inMesh->createVertex(Vector2d(3.0, 1.0));
1436 inMesh->setGlobalNumberOfVertices(inMesh->nVertices());
1438 Eigen::VectorXd values(4);
1439 values << 1.0, 2.0, 2.0, 1.0;
1451 mapping.setMeshes(inMesh, outMesh);
1452 BOOST_TEST(
mapping.hasComputedMapping() ==
false);
1455 Eigen::VectorXd outValues(4);
1457 mapping.map(inSample, outValues);
1458 BOOST_TEST(
mapping.hasComputedMapping() ==
true);
1480 using Eigen::Vector3d;
1488 Mapping mapping(constraint, dimensions, fct, {{xDead, yDead, zDead}}, polynomial);
1492 inMesh->createVertex(Vector3d(0.0, 3.0, 0.0));
1493 inMesh->createVertex(Vector3d(1.0, 3.0, 0.0));
1494 inMesh->createVertex(Vector3d(0.0, 3.0, 1.0));
1495 inMesh->createVertex(Vector3d(1.0, 3.0, 1.0));
1497 inMesh->setGlobalNumberOfVertices(inMesh->nVertices());
1499 Eigen::VectorXd values(4);
1500 values << 1.0, 2.0, 3.0, 4.0;
1512 mapping.setMeshes(inMesh, outMesh);
1513 BOOST_TEST(
mapping.hasComputedMapping() ==
false);
1516 Eigen::VectorXd outValues(4);
1518 mapping.map(inSample, outValues);
1519 BOOST_TEST(
mapping.hasComputedMapping() ==
true);
1523 const double tolerance = 1e-7;
1524 Eigen::VectorXd expected(4);
1525 expected << 1.0, -0.454450524334, 0.99146426249, 6.98958304876;
1528 Eigen::VectorXd expected(4);
1529 expected << 1.0, 2.0, 2.9, 4.3;
1534 const double tolerance = 1e-6;
1535 Eigen::VectorXd expected(4);
1536 expected << 1.17251596926, 4.10368825944, 3.56931954192, 3.40160932341;
1539 const double tolerance = 1e-6;
1540 Eigen::VectorXd expected(4);
1541 expected << 0.856701171969, 2.38947124326, 3.34078733786, 3.41304024691;
1544 const double tolerance = 1e-6;
1545 Eigen::VectorXd expected(4);
1546 expected << 0.380480856704, 2.83529451713, 3.73088270249, 3.05334192368;
1597 const int inSize = 112;
1600 Eigen::MatrixXd A = Eigen::MatrixXd::Random(inSize, inSize);
1603 Eigen::MatrixXd M = A * A.transpose();
1609 Eigen::MatrixXd M_inv_builtin = Eigen::MatrixXd::Identity(inSize, inSize);
1610 M.triangularView<Eigen::Lower>().solveInPlace(M_inv_builtin);
1613 Eigen::MatrixXd diff = M_inv_custom - M_inv_builtin;
1615 double max_abs_diff = diff.maxCoeff();
1616 double min_abs_diff = diff.minCoeff();
1619 double tolerance = 1e-12;
1622 BOOST_CHECK_SMALL(max_abs_diff, tolerance);
1623 BOOST_CHECK_SMALL(min_abs_diff, tolerance);
BOOST_AUTO_TEST_CASE(testIQNIMVJPPWithSubsteps)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
void addGlobalIndex(mesh::PtrMesh &mesh, int offset=0)
std::vector< std::pair< int, std::vector< double > > > ReferenceSpecification
Contains which values are expected on which rank: rank -> vector of data.
void testTagging(const TestContext &context, MeshSpecification inMeshSpec, MeshSpecification outMeshSpec, MeshSpecification shouldTagFirstRound, MeshSpecification shouldTagSecondRound, bool consistent)
void testDeadAxis3d(Polynomial polynomial, Mapping::Constraint constraint)
void testDistributed(const TestContext &context, Mapping &mapping, MeshSpecification inMeshSpec, MeshSpecification outMeshSpec, ReferenceSpecification referenceSpec, int inGlobalIndexOffset=0, bool meshIsSmaller=false)
void testDeadAxis2d(Polynomial polynomial, Mapping::Constraint constraint)
Eigen::VectorXd getDistributedData(const TestContext &context, MeshSpecification const &meshSpec)
mesh::PtrMesh getDistributedMesh(const TestContext &context, MeshSpecification &meshSpec, int globalIndexOffset=0, bool meshIsSmaller=false)
#define doLocalCode(Type, function, polynomial)
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
Utility class for managing MPI operations.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Radial basis function with compact support.
Radial basis function with global and compact support.
Radial basis function with global support.
Abstract base class for mapping of data from one mesh to another.
Constraint
Specifies additional constraints for a mapping.
Radial basis function with global support.
Mapping with radial basis functions.
Radial basis function with global support.
Radial basis function with global support.
Container and creator for meshes.
void setGlobalNumberOfVertices(int num)
VertexContainer & vertices()
Returns modifieable container holding all vertices.
std::size_t nVertices() const
Returns the number of vertices.
void computeBoundingBox()
Computes the boundingBox for the vertices.
Vertex & createVertex(const Eigen::Ref< const Eigen::VectorXd > &coords)
Creates and initializes a Vertex object.
Rank rank
the rank of the current participant
contains data mapping from points to meshes.
Polynomial
How to handle the polynomial?
provides Mesh, Data and primitives.
std::shared_ptr< Mesh > PtrMesh
contains the testing framework.
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...
Eigen::MatrixXd invertLowerTriangularBlockwise(const Eigen::MatrixXd &L)
Implements an iterative block scheme to determine the inverse of a lower triangular matrix which is m...
Main namespace of the precice library.
std::vector< VertexSpecification > vertices
Holds rank, owner, position and value of a single vertex.
std::vector< double > value
std::vector< double > position