34 v.setGlobalIndex(v.getID() + offset);
42 for (
unsigned int i = 0; i < vec.size() / dataDimension; ++i) {
43 sum += vec[(i * dataDimension) + component];
53 using Eigen::Vector2d;
58 int inDataID = inData->
getID();
77 auto &values = inData->
values();
78 values << 1.0, 2.0, 2.0, 1.0, 3.0, 4.0, 4.0, 3.0, 5.0, 6.0, 6.0, 5.0;
83 int outDataID = outData->
getID();
94 mapping.setMeshes(inMesh, outMesh);
95 BOOST_TEST(mapping.hasComputedMapping() ==
false);
98 mapping.computeMapping();
99 mapping.map(inDataID, outDataID);
100 double value = outData->
values()(0);
101 double value1 = outData->
values()(1);
102 double value2 = outData->
values()(2);
103 BOOST_TEST(mapping.hasComputedMapping() ==
true);
104 BOOST_TEST(value == 1.0);
105 BOOST_TEST(value1 == 4.5);
106 BOOST_TEST(value2 == 3.5);
110 outData->
values().setZero();
111 BOOST_TEST(mapping.hasComputedMapping() ==
false);
112 mapping.computeMapping();
113 mapping.map(inDataID, outDataID);
114 value = outData->
values()(0);
115 BOOST_TEST(mapping.hasComputedMapping() ==
true);
116 BOOST_TEST(value == 1.0);
120 outData->
values().setZero();
121 mapping.computeMapping();
122 mapping.map(inDataID, outDataID);
123 value = outData->
values()(0);
124 BOOST_TEST(mapping.hasComputedMapping() ==
true);
125 BOOST_TEST(value == 1.0);
129 outData->
values().setZero();
130 mapping.computeMapping();
131 mapping.map(inDataID, outDataID);
132 value = outData->
values()(0);
133 BOOST_TEST(mapping.hasComputedMapping() ==
true);
134 BOOST_TEST(value == 2.0);
138 outData->
values().setZero();
139 mapping.computeMapping();
140 mapping.map(inDataID, outDataID);
141 value = outData->
values()(0);
142 BOOST_TEST(mapping.hasComputedMapping() ==
true);
143 BOOST_TEST(value == 2.0);
147 outData->
values().setZero();
148 mapping.computeMapping();
149 mapping.map(inDataID, outDataID);
150 value = outData->
values()(0);
151 BOOST_TEST(mapping.hasComputedMapping() ==
true);
152 BOOST_TEST(value == 2.0);
156 outData->
values().setZero();
157 mapping.computeMapping();
158 mapping.map(inDataID, outDataID);
159 value = outData->
values()(0);
160 BOOST_TEST(mapping.hasComputedMapping() ==
true);
161 BOOST_TEST(value == 1.5);
165 outData->
values().setZero();
166 mapping.computeMapping();
167 mapping.map(inDataID, outDataID);
168 value = outData->
values()(0);
169 BOOST_TEST(mapping.hasComputedMapping() ==
true);
170 BOOST_TEST(value == 1.5);
174 outData->
values().setZero();
175 mapping.computeMapping();
176 mapping.map(inDataID, outDataID);
177 value = outData->
values()(0);
178 BOOST_TEST(mapping.hasComputedMapping() ==
true);
179 BOOST_TEST(value == 1.5);
185 int dataDimensions = dimensions;
186 using Eigen::Vector2d;
191 int inDataID = inData->
getID();
210 auto &values = inData->
values();
212 values << 1.0, 2.0, 2.0, 4.0, 2.0, 4.0, 1.0, 2.0, 3.0, 6.0, 4.0, 8.0, 4.0, 8.0, 3.0, 6.0, 5.0, 10.0, 6.0, 12.0, 6.0, 12.0, 5.0, 10.0;
217 int outDataID = outData->
getID();
233 mapping.
map(inDataID, outDataID);
235 DataID index1 = 1 * dataDimensions;
236 DataID index2 = 2 * dataDimensions;
240 BOOST_TEST(outData->
values()(index1) == 4.5);
241 BOOST_TEST(outData->
values()(index1 + 1) == 9.0);
242 BOOST_TEST(outData->
values()(index2) == 3.5);
243 BOOST_TEST(outData->
values()(index2 + 1) == 7.0);
247 outData->
values().setZero();
249 mapping.
map(inDataID, outDataID);
251 BOOST_TEST(outData->
values()(0) == 1.0);
252 BOOST_TEST(outData->
values()(1) == 2.0);
256 outData->
values().setZero();
258 mapping.
map(inDataID, outDataID);
260 BOOST_TEST(outData->
values()(0) == 1.0);
261 BOOST_TEST(outData->
values()(1) == 2.0);
265 outData->
values().setZero();
267 mapping.
map(inDataID, outDataID);
269 BOOST_TEST(outData->
values()(0) == 2.0);
270 BOOST_TEST(outData->
values()(1) == 4.0);
274 outData->
values().setZero();
276 mapping.
map(inDataID, outDataID);
278 BOOST_TEST(outData->
values()(0) == 2.0);
279 BOOST_TEST(outData->
values()(1) == 4.0);
283 outData->
values().setZero();
285 mapping.
map(inDataID, outDataID);
287 BOOST_TEST(outData->
values()(0) == 2.0);
288 BOOST_TEST(outData->
values()(1) == 4.0);
292 outData->
values().setZero();
294 mapping.
map(inDataID, outDataID);
296 BOOST_TEST(outData->
values()(0) == 1.5);
297 BOOST_TEST(outData->
values()(1) == 3.0);
301 outData->
values().setZero();
303 mapping.
map(inDataID, outDataID);
305 BOOST_TEST(outData->
values()(0) == 1.5);
306 BOOST_TEST(outData->
values()(1) == 3.0);
310 outData->
values().setZero();
312 mapping.
map(inDataID, outDataID);
314 BOOST_TEST(outData->
values()(0) == 1.5);
315 BOOST_TEST(outData->
values()(1) == 3.0);
324 int inDataID = inData->
getID();
327 for (
unsigned int i = 0; i < 20; ++i)
329 inMesh->
createVertex(Eigen::Vector2d(0.0, 0.0 + i * dim));
330 inMesh->
createVertex(Eigen::Vector2d(1e-5, 0.0 + i * dim));
332 inMesh->
createVertex(Eigen::Vector3d(7.0, 7.0, 40 + i * dim));
333 inMesh->
createVertex(Eigen::Vector3d(7.001, 7.001, 40 + i * dim));
339 auto &values = inData->
values();
341 values[v * 2] = v * dim * 1e-5;
342 values[v * 2 + 1] = v * dim * 1e-5 + 2;
348 int outDataID = outData->
getID();
350 for (
unsigned int i = 0; i < 15; ++i) {
352 outMesh->
createVertex(Eigen::Vector2d(.1, 1 + 1 + i * dim));
354 outMesh->
createVertex(Eigen::Vector3d(7.4, 7.4, 41 + i * dim));
365 mapping.
map(inDataID, outDataID);
366 double value = outData->
values()(0);
367 double value1 = outData->
values()(1);
368 double value2 = outData->
values()(2);
371 BOOST_TEST(
math::equals(value, 19935.374757794027, 0.2));
372 BOOST_TEST(
math::equals(value1, 19935.37795225389, 0.2));
373 BOOST_TEST(
math::equals(value2, 19935.35164938603, 0.2));
375 BOOST_TEST(value == 829.28063055069435);
376 BOOST_TEST(value1 == 819.35577218983303);
377 BOOST_TEST(value2 == 829.38388713302811);
384 using Eigen::Vector2d;
389 int inDataID = inData->
getID();
402 auto &values = inData->
values();
403 values << 10.0, 0.0, 0.0, 10.0, 0.0;
407 int outDataID = outData->
getID();
435 mapping.
map(inDataID, outDataID);
437 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
438 BOOST_TEST(outData->
values()(0) == 10);
439 BOOST_TEST(outData->
values()(1) == 10);
440 BOOST_TEST(outData->
values()(2) == 0);
441 BOOST_TEST(outData->
values()(3) == 0);
446 values << 0.0, 10.0, 0.0, 0.0, 0.0;
449 outData->
values().setZero();
451 mapping.
map(inDataID, outDataID);
452 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
453 BOOST_TEST(outData->
values()(5) == outData->
values()(8));
456 values << 5.0, 10.0, 7.0, 3.0, 4.0;
459 outData->
values().setZero();
461 mapping.
map(inDataID, outDataID);
463 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
467 values << 3.0, 4.0, 5.0, 7.0, 9.0;
470 outData->
values().setZero();
472 mapping.
map(inDataID, outDataID);
473 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
475 BOOST_TEST(outData->
values()(5) == 3.2931869752057001);
481 int dataDimensions = dimensions;
482 using Eigen::Vector2d;
498 auto &values = inData->
values();
500 values << 1.0, 2.0, 2.0, 4.0, 2.0, 4.0, 1.0, 2.0, 3.0, 6.0;
532 mapping.
map(inDataID, outDataID);
537 BOOST_TEST(insumc0 == outsumc0);
543 BOOST_TEST(insumc0 * 2 == insumc1);
544 BOOST_TEST(outsumc0 * 2 == outsumc1);
545 BOOST_TEST(insumc1 == outsumc1);
550 values << 1.0, 0.0, 12.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0;
553 outData->
values().setZero();
555 mapping.
map(inDataID, outDataID);
559 BOOST_TEST(19.0 == outsumc0);
564 BOOST_TEST(0.0 == outsumc1);
569 values << 0.0, 2.0, 0.0, 4.0, 0.0, 8.0, 0.0, 7.0, 0.0, 0.0;
572 outData->
values().setZero();
574 mapping.
map(inDataID, outDataID);
578 BOOST_TEST(0.0 == outsumc0);
583 BOOST_TEST(21.0 == outsumc1);
588 values << 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 27.0;
591 outData->
values().setZero();
593 mapping.
map(inDataID, outDataID);
597 BOOST_TEST(10.0 == outsumc0);
598 BOOST_TEST(outData->
values()(2) == 10);
602 BOOST_TEST(27.0 == outsumc1);
603 BOOST_TEST(outData->
values()(21) == 27);
608 values << 3.0, 6.0, 2.0, 4.0, 12.0, 24.0, 1.0, 2.0, 3.0, 6.0;
611 outData->
values().setZero();
613 mapping.
map(inDataID, outDataID);
615 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
617 double expectedValue = 3.5933508322619825;
619 BOOST_TEST(outData->
values()(12) == expectedValue);
622 BOOST_TEST(outData->
values()(13) == 2 * expectedValue);
628 using Eigen::Vector3d;
633 int inDataID = inData->
getID();
667 auto &values = inData->
values();
669 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0;
674 int outDataID = outData->
getID();
687 vertex.
setCoords(Vector3d(0.0, 0.0, 0.0));
689 mapping.
map(inDataID, outDataID);
690 double value = outData->
values()(0);
691 double value1 = outData->
values()(1);
692 double value2 = outData->
values()(2);
694 BOOST_TEST(value == 1.0);
695 BOOST_TEST(value1 == 9.0);
696 BOOST_TEST(value2 == 10.5);
698 vertex.
setCoords(Vector3d(0.0, 0.5, 0.5));
700 outData->
values().setZero();
702 mapping.
map(inDataID, outDataID);
703 value = outData->
values()(0);
705 BOOST_TEST(value == 2.0);
707 vertex.
setCoords(Vector3d(0.0, 1.0, 1.0));
709 outData->
values().setZero();
711 mapping.
map(inDataID, outDataID);
712 value = outData->
values()(0);
714 BOOST_TEST(value == 3.0);
716 vertex.
setCoords(Vector3d(1.0, 0.0, 0.0));
718 outData->
values().setZero();
720 mapping.
map(inDataID, outDataID);
721 value = outData->
values()(0);
723 BOOST_TEST(value == 2.0);
725 vertex.
setCoords(Vector3d(1.0, 0.5, 0.5));
727 outData->
values().setZero();
729 mapping.
map(inDataID, outDataID);
730 value = outData->
values()(0);
732 BOOST_TEST(value == 4.0);
734 vertex.
setCoords(Vector3d(1.0, 1.0, 1.0));
736 outData->
values().setZero();
738 mapping.
map(inDataID, outDataID);
739 value = outData->
values()(0);
741 BOOST_TEST(value == 6.0);
743 vertex.
setCoords(Vector3d(0.5, 0.0, 0.5));
745 outData->
values().setZero();
747 mapping.
map(inDataID, outDataID);
748 value = outData->
values()(0);
750 BOOST_TEST(value == 3.0);
752 vertex.
setCoords(Vector3d(0.5, 0.5, 1.0));
754 outData->
values().setZero();
756 mapping.
map(inDataID, outDataID);
757 value = outData->
values()(0);
759 BOOST_TEST(value == 4.5);
761 vertex.
setCoords(Vector3d(0.5, 1.0, 0.0));
763 outData->
values().setZero();
765 mapping.
map(inDataID, outDataID);
766 value = outData->
values()(0);
768 BOOST_TEST(value == 1.5);
774 const int dimensions = 3;
775 const int dataComponents = 1;
813 auto &values = inData->
values();
816 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0;
841 Eigen::MatrixXd coords(dimensions, 1);
842 Eigen::MatrixXd result(dataComponents, 1);
849 BOOST_TEST(result(0, 0) == 1.0);
851 coords.col(0) = Eigen::RowVector3d(3.5, 0.5, 0.5);
855 BOOST_TEST(result(0, 0) == 9.0);
857 coords.col(0) = Eigen::RowVector3d(2.5, 0.5, 1.0);
861 BOOST_TEST(result(0, 0) == 10.5);
864 coords.resize(dimensions, 3);
865 result.resize(dataComponents, 3);
867 coords.col(0) = Eigen::RowVector3d(0.0, 0.5, 0.5);
868 coords.col(1) = Eigen::RowVector3d(0.0, 1.0, 1.0);
869 coords.col(2) = Eigen::RowVector3d(1.0, 0.0, 0.0);
873 BOOST_TEST(result(0, 0) == 2.0);
874 BOOST_TEST(result(0, 1) == 3.0);
875 BOOST_TEST(result(0, 2) == 2.0);
893 BOOST_TEST(result(0, 0) == 4.0);
894 BOOST_TEST(result(0, 1) == 6.0);
895 BOOST_TEST(result(0, 2) == 4.0);
897 coords.col(0) = Eigen::RowVector3d(0.5, 0.0, 0.5);
898 coords.col(1) = Eigen::RowVector3d(0.5, 0.5, 1.0);
899 coords.col(2) = Eigen::RowVector3d(0.5, 1.0, 0.0);
903 BOOST_TEST(result(0, 0) == 6.0);
904 BOOST_TEST(result(0, 1) == 9.0);
905 BOOST_TEST(result(0, 2) == 3.0);
919 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0, 7.0, 8.0, 8.0, 7.0;
931 coords.col(0) = Eigen::RowVector3d(6.5, 1.0, 0.0);
933 BOOST_TEST(result(0, 0) == 7.5);
934 BOOST_TEST(result(0, 1) == 4.5);
935 BOOST_TEST(result(0, 2) == 1.5);
942 int dataComponents = 2;
965 auto &values = inData->
values();
968 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0;
993 Eigen::MatrixXd coords(dimensions, 1);
994 Eigen::MatrixXd result(dataComponents, 1);
1001 BOOST_TEST(result(0, 0) == 1.0);
1002 BOOST_TEST(result(1, 0) == 2.0);
1005 coords.col(0) = Eigen::RowVector2d(5.0, 1.0);
1009 BOOST_TEST(result(0, 0) == 15.0);
1010 BOOST_TEST(result(1, 0) == 18.0);
1013 coords.col(0) = Eigen::RowVector2d(0.5, 0.0);
1017 BOOST_TEST(result(0, 0) == 1.71978075, boost::test_tools::tolerance(1e-7));
1018 BOOST_TEST(result(1, 0) == 1.71978075, boost::test_tools::tolerance(1e-7));
1020 coords.col(0) = Eigen::RowVector2d(3.5, 0.5);
1024 BOOST_TEST(result(0, 0) == 10.39684625, boost::test_tools::tolerance(1e-7));
1025 BOOST_TEST(result(1, 0) == 10.48101386, boost::test_tools::tolerance(1e-7));
1028 coords.resize(dimensions, 2);
1029 result.resize(dataComponents, 2);
1031 coords.col(0) = Eigen::RowVector2d(4.0, 0.0);
1032 coords.col(1) = Eigen::RowVector2d(5.0, 0.0);
1036 BOOST_TEST(result(0, 0) == 5.0);
1037 BOOST_TEST(result(1, 0) == 6.0);
1038 BOOST_TEST(result(0, 1) == 6.0);
1039 BOOST_TEST(result(1, 1) == 5.0);
1057 BOOST_TEST(result(0, 0) == 2.5);
1058 BOOST_TEST(result(1, 0) == 3.0);
1059 BOOST_TEST(result(0, 1) == 3.0);
1060 BOOST_TEST(result(1, 1) == 2.5);
1074 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0, 7.0, 8.0, 8.0, 7.0, 20.0, 22.0, 22.0, 20.0;
1088 BOOST_TEST(result(0, 0) == 5.0);
1089 BOOST_TEST(result(1, 0) == 6.0);
1090 BOOST_TEST(result(0, 1) == 6.0);
1091 BOOST_TEST(result(1, 1) == 5.0);
1093 coords.col(0) = Eigen::RowVector2d(7.0, 1.0);
1094 coords.col(1) = Eigen::RowVector2d(6.0, 0.0);
1096 BOOST_TEST(result(0, 0) == 20.0);
1097 BOOST_TEST(result(1, 0) == 22.0);
1098 BOOST_TEST(result(0, 1) == 7.0);
1099 BOOST_TEST(result(1, 1) == 8.0);
1105 int dataDimensions = dimensions;
1107 using Eigen::Vector3d;
1112 int inDataID = inData->
getID();
1149 int outDataID = outData->
getID();
1162 for (
unsigned int i = 0; i < inData->
values().size() / dataDimensions; ++i) {
1163 inData->
values()(i * dataDimensions) = 7;
1164 inData->
values()(i * dataDimensions + 1) = 38;
1165 inData->
values()(i * dataDimensions + 2) = 19;
1170 mapping.
map(inDataID, outDataID);
1172 BOOST_TEST(outData->
values()(0) == 7.0);
1173 BOOST_TEST(outData->
values()(1) == 38.0);
1174 BOOST_TEST(outData->
values()(2) == 19.0);
1175 BOOST_TEST(outData->
values()(9) == 7.0);
1176 BOOST_TEST(outData->
values()(10) == 38.0);
1177 BOOST_TEST(outData->
values()(11) == 19.0);
1180 for (
unsigned int i = 0; i < inData->
values().size() / dataDimensions; ++i) {
1181 inData->
values()(i * dataDimensions) =
std::pow(i * dataDimensions, 2);
1182 inData->
values()(i * dataDimensions + 1) = 2 *
std::pow(i * dataDimensions, 2);
1183 inData->
values()(i * dataDimensions + 2) = 3 *
std::pow(i * dataDimensions, 2);
1187 outData->
values().setZero();
1189 mapping.
map(inDataID, outDataID);
1191 BOOST_TEST(outData->
values()(12) == 3673.7308684337013);
1192 BOOST_TEST(outData->
values()(13) == 2 * outData->
values()(12));
1193 BOOST_TEST(outData->
values()(14) == 3 * outData->
values()(12));
1201 using Eigen::Vector3d;
1256 auto &values = inData->
values();
1258 values << 1.0, 2.0, 2.0, 1.0, 3.0;
1261 mapping.
map(inDataID, outDataID);
1263 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1266 values << 12.0, 5.0, 7.0, 8.0, 9.0;
1269 outData->
values().setZero();
1271 mapping.
map(inDataID, outDataID);
1273 const double expectedSum = 41;
1274 BOOST_TEST(outData->
values().sum() == expectedSum);
1275 BOOST_TEST(outData->
values()(6) == 8);
1276 BOOST_TEST(outData->
values()(0) == 12);
1279 values << 0.0, 50.0, 107.0, 108.0, 48.0;
1282 outData->
values().setZero();
1284 mapping.
map(inDataID, outDataID);
1286 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1287 BOOST_TEST(outData->
values()(0) == 0.0);
1288 BOOST_TEST(outData->
values()(6) > outData->
values()(1));
1289 BOOST_TEST(outData->
values()(13) > outData->
values()(9));
1292 values << 0.0, 100.0, 0.0, 0.0, 0.0;
1295 outData->
values().setZero();
1297 mapping.
map(inDataID, outDataID);
1299 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1300 BOOST_TEST(outData->
values()(9) == outData->
values()(13));
1301 BOOST_TEST(outData->
values()(9) == outData->
values()(10));
1302 BOOST_TEST(outData->
values()(16) == outData->
values()(19));
1306 BOOST_TEST(outData->
values()(20) == outData->
values()(23));
1307 BOOST_TEST(outData->
values()(16) == outData->
values()(20));
1308 BOOST_TEST(outData->
values()(9) == 15.470584170385226);
1313 const int dimensions = 3;
1314 const int dataComponents = 1;
1369 Eigen::MatrixXd coords(dimensions, 1);
1370 Eigen::MatrixXd inData(dataComponents, 1);
1371 Eigen::Map<Eigen::MatrixXd> outValues(outData->
values().data(), dataComponents, outMesh->
vertices().
size());
1375 outValues.setZero();
1377 coords.col(0) = Eigen::RowVector3d(5.0, 0.0, 1.0);
1384 BOOST_TEST(outValues.sum() == inData.sum());
1385 Eigen::VectorXd expectedValues(24);
1386 expectedValues.setZero();
1387 expectedValues(21) = 4.3;
1388 BOOST_TEST(outData->
values() == expectedValues, boost::test_tools::per_element());
1392 outValues.setZero();
1398 BOOST_TEST(outValues.sum() == 2 * inData.sum());
1399 BOOST_TEST(outData->
values() == 2 * expectedValues, boost::test_tools::per_element());
1403 outValues.setZero();
1405 double expectedSum = 0;
1407 expectedSum += inData.sum();
1410 coords.resize(dimensions, 3);
1411 inData.resize(dataComponents, 3);
1412 coords.col(0) = Eigen::RowVector3d(3.5, 0.5, 0.5);
1413 coords.col(1) = Eigen::RowVector3d(4.5, 1.0, 1.0);
1414 coords.col(2) = Eigen::RowVector3d(0.1, 0.0, 1.0);
1416 inData(0, 1) = 17.3;
1419 expectedSum += inData.sum();
1422 BOOST_TEST(outValues.sum() == expectedSum);
1423 BOOST_TEST(outValues(0, 6) == 0.063700286667, boost::test_tools::tolerance(1e-7));
1424 BOOST_TEST(outValues(0, 23) == 9.2744883594, boost::test_tools::tolerance(1e-7));
1428 outValues.setZero();
1432 coords.col(0) = Eigen::RowVector3d(0, 0, 0);
1433 coords.col(1) = Eigen::RowVector3d(3.5, 0.5, 0.5);
1434 coords.col(2) = Eigen::RowVector3d(2.5, 0.5, 1.0);
1439 expectedSum += inData.sum();
1441 coords.resize(dimensions, 2);
1442 inData.resize(dataComponents, 2);
1443 coords.col(0) = Eigen::RowVector3d(1, 1, 1);
1444 coords.col(1) = Eigen::RowVector3d(5, 1, 0.5);
1448 expectedSum += inData.sum();
1451 BOOST_TEST(outValues.sum() == expectedSum);
1454 BOOST_TEST(outData->
values()(0) == 0.0);
1455 BOOST_TEST(outData->
values()(6) > outData->
values()(1));
1456 BOOST_TEST(outData->
values()(13) > outData->
values()(9));
1470 Eigen::Map<Eigen::MatrixXd> outValues2(outData->
values().data(), dataComponents, outMesh->
vertices().
size());
1474 outValues2.setZero();
1477 coords.resize(dimensions, 1);
1478 inData.resize(dataComponents, 1);
1479 coords.col(0) = Eigen::RowVector3d(0.5, 0.5, 0.5);
1482 expectedSum += inData.sum();
1483 coords.col(0) = Eigen::RowVector3d(6.0, 0, 0);
1486 expectedSum += inData.sum();
1489 BOOST_TEST(outValues2.sum() == expectedSum);
1490 BOOST_TEST(outValues2(0, 24) == 42, boost::test_tools::tolerance(1e-12));
1491 BOOST_TEST(outValues2(0, 0) == 0.505106848, boost::test_tools::tolerance(1e-7));
1496 const int dimensions = 2;
1497 const int dataComponents = 2;
1537 Eigen::MatrixXd coords(dimensions, 1);
1538 Eigen::MatrixXd inData(dataComponents, 1);
1539 Eigen::Map<Eigen::MatrixXd> outValues(outData->
values().data(), dataComponents, outMesh->
vertices().
size());
1543 outValues.setZero();
1545 coords.col(0) = Eigen::RowVector2d(5.0, 0.0);
1546 inData.col(0) = Eigen::RowVector2d(7.3, 14.6);
1553 BOOST_TEST(outValues.sum() == inData.sum());
1554 Eigen::MatrixXd expectedValues(dataComponents, 12);
1555 expectedValues.setZero();
1556 expectedValues.col(9) = Eigen::RowVector2d(7.3, 14.6);
1557 BOOST_TEST(outValues.row(0) == expectedValues.row(0), boost::test_tools::per_element());
1558 BOOST_TEST(outValues.row(1) == expectedValues.row(1), boost::test_tools::per_element());
1559 BOOST_TEST(outValues.row(0) == 0.5 * outValues.row(1), boost::test_tools::per_element());
1563 outValues.setZero();
1569 BOOST_TEST(outValues.row(0) == 2 * expectedValues.row(0), boost::test_tools::per_element());
1570 BOOST_TEST(outValues.row(1) == 2 * expectedValues.row(1), boost::test_tools::per_element());
1571 BOOST_TEST(outValues.row(0) == 0.5 * outValues.row(1), boost::test_tools::per_element());
1575 outValues.setZero();
1577 Eigen::Vector2d expectedSum;
1578 expectedSum.setZero();
1580 expectedSum += inData.rowwise().sum();
1583 coords.resize(dimensions, 3);
1584 inData.resize(dataComponents, 3);
1585 coords.col(0) = Eigen::RowVector2d(3.5, 0.5);
1586 coords.col(1) = Eigen::RowVector2d(4.5, 1.0);
1587 coords.col(2) = Eigen::RowVector2d(0.1, 0.0);
1589 inData.col(0) = Eigen::RowVector2d(4.3, 8.6);
1590 inData.col(1) = Eigen::RowVector2d(17.3, 34.6);
1591 inData.col(2) = Eigen::RowVector2d(5.8, 11.6);
1594 expectedSum += inData.rowwise().sum();
1598 BOOST_TEST(outValues.rowwise().sum()(0) == expectedSum(0), boost::test_tools::tolerance(0.6));
1599 BOOST_TEST(outValues.rowwise().sum()(1) == expectedSum(1), boost::test_tools::tolerance(0.6));
1600 BOOST_TEST(outValues.row(0) == 0.5 * outValues.row(1), boost::test_tools::per_element());
1601 BOOST_TEST(outValues(0, 10) == 8.76997588, boost::test_tools::tolerance(1e-7));
1615 Eigen::Map<Eigen::MatrixXd> outValues2(outData->
values().data(), dataComponents, outMesh->
vertices().
size());
1619 outValues2.setZero();
1620 expectedSum.setZero();
1622 coords.resize(dimensions, 1);
1623 inData.resize(dataComponents, 1);
1624 coords.col(0) = Eigen::RowVector2d(0.5, 0.5);
1625 inData.col(0) = Eigen::RowVector2d(4.3, 43);
1627 expectedSum += inData.rowwise().sum();
1628 coords.col(0) = Eigen::RowVector2d(6.0, 0);
1629 inData.col(0) = Eigen::RowVector2d(5.1, 51);
1631 expectedSum += inData.rowwise().sum();
1634 BOOST_TEST(outValues2.rowwise().sum()(0) == expectedSum(0), boost::test_tools::tolerance(0.6));
1635 BOOST_TEST(outValues2.rowwise().sum()(1) == expectedSum(1), boost::test_tools::tolerance(0.6));
1636 BOOST_TEST(outValues2.col(12) == Eigen::RowVector2d(5.1, 51), boost::test_tools::per_element());
1637 BOOST_TEST(outValues2(0, 0) == 1.13162327, boost::test_tools::tolerance(1e-7));
1642 const int dimensions = 3;
1643 const int dataDimension = dimensions;
1644 using Eigen::Vector3d;
1700 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1701 inData->
values()(i * dataDimension) = 7;
1702 inData->
values()(i * dataDimension + 1) = 0;
1703 inData->
values()(i * dataDimension + 2) = 0;
1707 mapping.
map(inDataID, outDataID);
1709 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1710 BOOST_TEST(outData->
values().sum() == 35);
1711 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1712 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 0);
1713 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 0);
1717 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1718 inData->
values()(i * dataDimension) = 0;
1719 inData->
values()(i * dataDimension + 1) = 27;
1720 inData->
values()(i * dataDimension + 2) = 0;
1723 outData->
values().setZero();
1725 mapping.
map(inDataID, outDataID);
1727 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1728 BOOST_TEST(outData->
values().sum() == 135);
1730 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1731 BOOST_TEST(outData->
values()(i * dataDimension) == 0);
1732 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 0);
1736 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1737 inData->
values()(i * dataDimension) = 0;
1738 inData->
values()(i * dataDimension + 1) = 0;
1739 inData->
values()(i * dataDimension + 2) = 3;
1742 outData->
values().setZero();
1744 mapping.
map(inDataID, outDataID);
1746 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1747 BOOST_TEST(outData->
values().sum() == 15);
1749 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1750 BOOST_TEST(outData->
values()(i * dataDimension) == 0);
1751 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 0);
1755 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1756 inData->
values()(i * dataDimension) =
std::pow(i * dataDimension, 3);
1757 inData->
values()(i * dataDimension + 1) = 5 *
std::pow(i * dataDimension, 3);
1758 inData->
values()(i * dataDimension + 2) = 10 *
std::pow(i * dataDimension, 3);
1761 outData->
values().setZero();
1763 mapping.
map(inDataID, outDataID);
1765 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1767 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1769 if (outData->
values()(i * dataDimension) > 1e-10) {
1770 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 5 * outData->
values()(i * dataDimension));
1771 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 10 * outData->
values()(i * dataDimension));
1774 BOOST_TEST(outData->
values()(55) == 4087.8100404079933);
1838 using Eigen::Vector3d;
1843 int inDataID = inData->
getID();
1877 auto &values = inData->
values();
1879 values << 1.0, 2.0, 2.0, 1.0, 3.0, 6.0, 6.0, 3.0, 3.0, 4.0, 4.0, 3.0, 9.0, 12.0, 12.0, 9.0, 5.0, 6.0, 6.0, 5.0, 15.0, 18.0, 18.0, 15.0;
1884 int outDataID = outData->
getID();
1897 vertex.
setCoords(Vector3d(0.0, 0.0, 0.0));
1899 mapping.
map(inDataID, outDataID);
1900 double value = outData->
values()(0);
1901 double value1 = outData->
values()(1);
1902 double value2 = outData->
values()(2);
1904 BOOST_TEST(value == 1.0);
1905 BOOST_TEST(value1 == 9.0);
1906 BOOST_TEST(value2 == 10.5);
1908 vertex.
setCoords(Vector3d(0.0, 0.5, 0.5));
1910 outData->
values().setZero();
1912 mapping.
map(inDataID, outDataID);
1913 value = outData->
values()(0);
1915 BOOST_TEST(value == 2.0);
1917 vertex.
setCoords(Vector3d(1.0, 0.0, 0.0));
1919 outData->
values().setZero();
1921 mapping.
map(inDataID, outDataID);
1922 value = outData->
values()(0);
1924 BOOST_TEST(value == 2.0);
1926 vertex.
setCoords(Vector3d(1.0, 0.5, 0.5));
1928 outData->
values().setZero();
1930 mapping.
map(inDataID, outDataID);
1931 value = outData->
values()(0);
1933 BOOST_TEST(value == 4.0);
1935 vertex.
setCoords(Vector3d(0.5, 0.5, 1.0));
1937 outData->
values().setZero();
1939 mapping.
map(inDataID, outDataID);
1940 value = outData->
values()(0);
1942 BOOST_TEST(value > 4.6);
1944 vertex.
setCoords(Vector3d(0.5, 1.0, 0.0));
1946 outData->
values().setZero();
1948 mapping.
map(inDataID, outDataID);
1949 value = outData->
values()(0);
1951 BOOST_TEST(value < 1.4);
1961 v.setGlobalIndex(v.getID() + offset);
1998 int globalIndexOffset = 0,
1999 bool meshIsSmaller =
false)
2004 for (
auto &vertex : vertices) {
2005 if (vertex.rank == context.
rank or vertex.rank == -1) {
2006 if (vertex.position.size() == 3)
2007 mesh->
createVertex(Eigen::Vector3d(vertex.position.data()));
2008 else if (vertex.position.size() == 2)
2009 mesh->
createVertex(Eigen::Vector2d(vertex.position.data()));
2011 int valueDimension = vertex.value.size();
2013 if (vertex.owner == context.
rank)
2018 d.conservativeResize(i * valueDimension + valueDimension);
2020 for (
int dim = 0; dim < valueDimension; ++dim) {
2021 d(i * valueDimension + dim) = vertex.value.at(dim);
2042 int inGlobalIndexOffset = 0,
2043 bool meshIsSmaller =
false)
2045 int meshDimension = inMeshSpec.at(0).position.size();
2046 int valueDimension = inMeshSpec.at(0).value.size();
2050 int inDataID = inData->
getID();
2056 int outDataID = outData->
getID();
2065 mapping.
map(inDataID, outDataID);
2068 for (
auto &referenceVertex : referenceSpec) {
2069 if (referenceVertex.first == context.
rank or referenceVertex.first == -1) {
2070 for (
int dim = 0; dim < valueDimension; ++dim) {
2071 BOOST_TEST_INFO(
"Index of vertex: " <<
index <<
" - Dimension: " << dim);
2072 BOOST_TEST(outData->
values()(
index * valueDimension + dim) == referenceVertex.second.at(dim));
2077 BOOST_TEST(outData->
values().size() ==
index * valueDimension);
2087 {-1, 0, {0, 0}, {1}},
2088 {-1, 0, {0, 1}, {2}},
2089 {-1, 1, {1, 0}, {3}},
2090 {-1, 1, {1, 1}, {4}},
2091 {-1, 2, {2, 0}, {5}},
2092 {-1, 2, {2, 1}, {6}},
2093 {-1, 3, {3, 0}, {7}},
2094 {-1, 3, {3, 1}, {8}}};
2096 {0, -1, {0, 0}, {0}},
2097 {0, -1, {0, 1}, {0}},
2098 {1, -1, {1, 0}, {0}},
2099 {1, -1, {1, 1}, {0}},
2100 {2, -1, {2, 0}, {0}},
2101 {2, -1, {2, 1}, {0}},
2102 {3, -1, {3, 0}, {0}},
2103 {3, -1, {3, 1}, {0}}};
2127 {-1, 0, {0, 0}, {1}},
2128 {-1, 0, {0, 1}, {2}},
2129 {-1, 1, {1, 0}, {3}},
2130 {-1, 1, {1, 1}, {4}},
2131 {-1, 2, {2, 0}, {5}},
2132 {-1, 2, {2, 1}, {6}},
2133 {-1, 3, {3, 0}, {7}},
2134 {-1, 3, {3, 1}, {8}}};
2136 {0, 0, {0, 0}, {0}},
2137 {0, 0, {0, 1}, {0}},
2138 {1, 1, {1, 0}, {0}},
2139 {1, 1, {1, 1}, {0}},
2140 {2, 2, {2, 0}, {0}},
2141 {2, 2, {2, 1}, {0}},
2142 {2, 2, {3, 0}, {0}},
2143 {2, 2, {3, 1}, {0}}};
2167 {-1, 0, {0, 0}, {1}},
2168 {-1, 0, {0, 1}, {2}},
2169 {-1, 1, {1, 0}, {3}},
2170 {-1, 1, {1, 1}, {4}},
2171 {-1, 2, {2, 0}, {5}},
2172 {-1, 2, {2, 1}, {6}}};
2175 {0, 0, {0, 0}, {0}},
2176 {0, 0, {0, 1}, {0}},
2177 {1, 1, {1, 0}, {0}},
2178 {1, 1, {1, 1}, {0}},
2179 {2, 2, {2, 0}, {0}},
2180 {2, 2, {2, 1}, {0}}};
2201 {0, -1, {0, 0}, {1}},
2202 {0, -1, {0, 1}, {2}},
2203 {1, -1, {1, 0}, {3}},
2204 {1, -1, {1, 1}, {4}},
2205 {2, -1, {2, 0}, {5}},
2206 {2, -1, {2, 1}, {6}},
2207 {3, -1, {3, 0}, {7}},
2208 {3, -1, {3, 1}, {8}}};
2210 {0, 0, {0, 0}, {0}},
2211 {0, 0, {0, 1}, {0}},
2212 {1, 1, {1, 0}, {0}},
2213 {1, 1, {1, 1}, {0}},
2214 {2, 2, {2, 0}, {0}},
2215 {2, 2, {2, 1}, {0}},
2216 {3, 3, {3, 0}, {0}},
2217 {3, 3, {3, 1}, {0}}};
2230 testDistributed(context, conservativeMap2D, in,
out, ref, globalIndexOffsets.
at(context.rank));
2241 {0, -1, {0, 0}, {1}},
2242 {0, -1, {0, 1}, {2}},
2243 {1, -1, {1, 0}, {3}},
2244 {1, -1, {1, 1}, {4}},
2245 {2, -1, {2, 0}, {5}},
2246 {2, -1, {2, 1}, {6}},
2247 {2, -1, {3, 0}, {7}},
2248 {2, -1, {3, 1}, {8}}};
2250 {-1, 0, {0, 0}, {0}},
2251 {-1, 0, {0, 1}, {0}},
2252 {-1, 1, {1, 0}, {0}},
2253 {-1, 1, {1, 1}, {0}},
2254 {-1, 2, {2, 0}, {0}},
2255 {-1, 2, {2, 1}, {0}},
2256 {-1, 3, {3, 0}, {0}},
2257 {-1, 3, {3, 1}, {0}}};
2294 testDistributed(context, conservativeMap2D, in,
out, ref, globalIndexOffsets.
at(context.rank));
2305 {0, -1, {0, 0}, {1}},
2306 {0, -1, {0, 1}, {2}},
2307 {0, -1, {1, 0}, {3}},
2308 {0, -1, {1, 1}, {4}},
2309 {1, -1, {2, 0}, {5}},
2310 {1, -1, {2, 1}, {6}},
2311 {1, -1, {3, 0}, {7}},
2312 {1, -1, {3, 1}, {8}}};
2314 {-1, 0, {0, 0}, {0}},
2315 {-1, 0, {0, 1}, {0}},
2316 {-1, 0, {1, 0}, {0}},
2317 {-1, 0, {1, 1}, {0}},
2318 {-1, 0, {2, 0}, {0}},
2319 {-1, 0, {2, 1}, {0}},
2320 {-1, 0, {3, 0}, {0}},
2321 {-1, 0, {3, 1}, {0}}};
2342 testDistributed(context, conservativeMap2D, in,
out, ref, globalIndexOffsets.
at(context.rank));
2352 int meshDimension = inMeshSpec.at(0).position.size();
2353 int valueDimension = inMeshSpec.at(0).value.size();
2371 for (
const auto &v : inMesh->
vertices()) {
2372 auto pos =
std::find_if(shouldTagFirstRound.begin(), shouldTagFirstRound.end(),
2374 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
2376 bool found = pos != shouldTagFirstRound.end();
2377 BOOST_TEST(found >= v.isTagged(),
2378 "FirstRound: Vertex " << v <<
" is tagged, but should not be.");
2379 BOOST_TEST(found <= v.isTagged(),
2380 "FirstRound: Vertex " << v <<
" is not tagged, but should be.");
2385 for (
const auto &v : inMesh->
vertices()) {
2386 auto posFirst =
std::find_if(shouldTagFirstRound.begin(), shouldTagFirstRound.end(),
2388 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
2390 bool foundFirst = posFirst != shouldTagFirstRound.end();
2391 auto posSecond =
std::find_if(shouldTagSecondRound.begin(), shouldTagSecondRound.end(),
2393 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
2395 bool foundSecond = posSecond != shouldTagSecondRound.end();
2396 BOOST_TEST(foundFirst <= v.isTagged(),
"SecondRound: Vertex " << v
2397 <<
" is not tagged, but should be from the first round.");
2398 BOOST_TEST(foundSecond <= v.isTagged(),
"SecondRound: Vertex " << v
2399 <<
" is not tagged, but should be.");
2400 BOOST_TEST((foundSecond or foundFirst) >= v.isTagged(),
"SecondRound: Vertex " << v
2401 <<
" is tagged, but should not be.");
2411 {0, -1, {0, 0}, {0}}};
2413 {0, -1, {-1, 0}, {1}},
2414 {0, -1, {-3, 0}, {1}},
2415 {0, 0, {1, 0}, {1}},
2416 {0, -1, {3, 0}, {1}},
2417 {0, -1, {0, -1}, {1}},
2418 {0, -1, {0, -3}, {1}},
2419 {0, -1, {0, 1}, {1}},
2420 {0, -1, {0, 3}, {1}}
2423 {0, -1, {-1, 0}, {1}},
2424 {0, -1, {1, 0}, {1}},
2425 {0, -1, {0, -1}, {1}},
2426 {0, -1, {0, 1}, {1}}};
2430 testTagging(context, inMeshSpec, outMeshSpec, shouldTagFirstRound, shouldTagSecondRound,
true);
2432 testTagging(context, outMeshSpec, inMeshSpec, shouldTagFirstRound, shouldTagSecondRound,
false);
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
void testTagging(const TestContext &context, MeshSpecification inMeshSpec, MeshSpecification outMeshSpec, MeshSpecification shouldTagFirstRound, MeshSpecification shouldTagSecondRound, bool consistent)
void addGlobalIndex(mesh::PtrMesh &mesh, int offset=0)
void perform2DTestConservativeMappingVector(Mapping &mapping)
void perform3DTestConsistentMappingVector(Mapping &mapping)
void perform2DTestConsistentMappingVector(Mapping &mapping)
void perform2DTestConsistentMapping(Mapping &mapping)
void perform2DTestJustInTimeMappingConservative(Mapping &mapping)
BOOST_AUTO_TEST_CASE(PartitionOfUnityMappingTests)
void perform3DTestConsistentMapping(Mapping &mapping)
void testDistributed(const TestContext &context, Mapping &mapping, MeshSpecification inMeshSpec, MeshSpecification outMeshSpec, ReferenceSpecification referenceSpec, int inGlobalIndexOffset=0, bool meshIsSmaller=false)
double sumComponentWise(const Eigen::VectorXd &vec, int component, int dataDimension)
void perform3DTestConservativeMapping(Mapping &mapping)
void perform3DTestJustInTimeMappingConservative(Mapping &mapping)
void perform2DTestConservativeMapping(Mapping &mapping)
void perform3DTestConservativeMappingVector(Mapping &mapping)
void perform2DTestJustInTimeMappingNoPolynomial(Mapping &mapping)
void perform3DTestJustInTimeMappingWithPolynomial(Mapping &mapping)
void getDistributedMesh(const TestContext &context, MeshSpecification const &vertices, mesh::PtrMesh &mesh, mesh::PtrData &data, int globalIndexOffset=0, bool meshIsSmaller=false)
void performTestConsistentMapDeadAxis(Mapping &mapping, int dim)
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
#define PRECICE_ASSERT(...)
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.
Abstract base class for mapping of data from one mesh to another.
virtual void initializeMappingDataCache(impl::MappingDataCache &cache)
Allocates memory and sets up the data structures inside the MappingDataCache.
Constraint
Specifies additional constraints for a mapping.
virtual void completeJustInTimeMapping(impl::MappingDataCache &cache, Eigen::Ref< Eigen::MatrixXd > result)
Completes a just-in-time mapping for conservative constraints.
virtual void mapConsistentAt(const Eigen::Ref< const Eigen::MatrixXd > &coordinates, const impl::MappingDataCache &cache, Eigen::Ref< Eigen::MatrixXd > values)
Just-in-time mapping variant of mapConsistent.
virtual void clear()=0
Removes a computed mapping.
virtual void updateMappingDataCache(impl::MappingDataCache &cache, const Eigen::Ref< const Eigen::VectorXd > &in)
Allows updating a so-called MappingDataCache for more efficient just-in-time mappings.
void setMeshes(const mesh::PtrMesh &input, const mesh::PtrMesh &output)
Sets input and output meshes carrying data to be mapped.
virtual void mapConservativeAt(const Eigen::Ref< const Eigen::MatrixXd > &coordinates, const Eigen::Ref< const Eigen::MatrixXd > &source, impl::MappingDataCache &cache, Eigen::Ref< Eigen::MatrixXd > target)
Just-in-time mapping variant of mapConservative.
virtual void computeMapping()=0
Computes the mapping coefficients from the in- and output mesh.
bool hasComputedMapping() const
Returns true, if the mapping has been computed.
void map(int inputDataID, int outputDataID)
void tagMeshSecondRound() final override
nothing to do here
void tagMeshFirstRound() final override
tag the vertices required for the mapping
void computeMapping() final override
void clear() final override
Clears a computed mapping by deleting the content of the _clusters vector.
DataID getID() const
Returns the ID of the data set (supposed to be unique).
Eigen::VectorXd & values()
Returns a reference to the data values.
static mesh::PtrMesh getJustInTimeMappingMesh(int dimension)
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.
const query::Index & index() const
Call preprocess() before index() to ensure correct projection handling.
PtrData & createData(const std::string &name, int dimension, DataID id, int waveformDegree=time::Time::DEFAULT_WAVEFORM_DEGREE)
Create only data for vertex.
void computeBoundingBox()
Computes the boundingBox for the vertices.
Vertex & createVertex(const Eigen::Ref< const Eigen::VectorXd > &coords)
Creates and initializes a Vertex object.
void allocateDataValues()
Allocates memory for the vertex data values and corresponding gradient values.
void setCoords(const VECTOR_T &coordinates)
Sets the coordinates of the vertex.
void setOwner(bool owner)
void clear()
Clear the index.
Rank rank
the rank of the current participant
contains data mapping from points to meshes.
constexpr bool equals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares two Eigen::MatrixBase for equality up to tolerance.
provides Mesh, Data and primitives.
contains the testing framework.
Main namespace of the precice library.
Holds rank, owner, position and value of a single vertex.
std::vector< double > value
std::vector< double > position
bool hasDataAtTimeStamp(double time) const
Check, if the current data vector (in inData or the std::vectors) hold data of time time.
void setTimeStamp(double time)
Set the timestamp of the MappingDataCache to the specified time.
void resetData()
Reset all data containers to zero.
void resetTimeStamp()
Reset the time stamp associated with the data.