51 using Eigen::Vector2d;
56 int inDataID = inData->
getID();
75 auto &values = inData->
values();
76 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;
81 int outDataID = outData->
getID();
92 mapping.setMeshes(inMesh, outMesh);
93 BOOST_TEST(mapping.hasComputedMapping() ==
false);
96 mapping.computeMapping();
97 mapping.map(inDataID, outDataID);
98 double value = outData->
values()(0);
99 double value1 = outData->
values()(1);
100 double value2 = outData->
values()(2);
101 BOOST_TEST(mapping.hasComputedMapping() ==
true);
102 BOOST_TEST(value == 1.0);
103 BOOST_TEST(value1 == 4.5);
104 BOOST_TEST(value2 == 3.5);
108 outData->
values().setZero();
109 BOOST_TEST(mapping.hasComputedMapping() ==
false);
110 mapping.computeMapping();
111 mapping.map(inDataID, outDataID);
112 value = outData->
values()(0);
113 BOOST_TEST(mapping.hasComputedMapping() ==
true);
114 BOOST_TEST(value == 1.0);
118 outData->
values().setZero();
119 mapping.computeMapping();
120 mapping.map(inDataID, outDataID);
121 value = outData->
values()(0);
122 BOOST_TEST(mapping.hasComputedMapping() ==
true);
123 BOOST_TEST(value == 1.0);
127 outData->
values().setZero();
128 mapping.computeMapping();
129 mapping.map(inDataID, outDataID);
130 value = outData->
values()(0);
131 BOOST_TEST(mapping.hasComputedMapping() ==
true);
132 BOOST_TEST(value == 2.0);
136 outData->
values().setZero();
137 mapping.computeMapping();
138 mapping.map(inDataID, outDataID);
139 value = outData->
values()(0);
140 BOOST_TEST(mapping.hasComputedMapping() ==
true);
141 BOOST_TEST(value == 2.0);
145 outData->
values().setZero();
146 mapping.computeMapping();
147 mapping.map(inDataID, outDataID);
148 value = outData->
values()(0);
149 BOOST_TEST(mapping.hasComputedMapping() ==
true);
150 BOOST_TEST(value == 2.0);
154 outData->
values().setZero();
155 mapping.computeMapping();
156 mapping.map(inDataID, outDataID);
157 value = outData->
values()(0);
158 BOOST_TEST(mapping.hasComputedMapping() ==
true);
159 BOOST_TEST(value == 1.5);
163 outData->
values().setZero();
164 mapping.computeMapping();
165 mapping.map(inDataID, outDataID);
166 value = outData->
values()(0);
167 BOOST_TEST(mapping.hasComputedMapping() ==
true);
168 BOOST_TEST(value == 1.5);
172 outData->
values().setZero();
173 mapping.computeMapping();
174 mapping.map(inDataID, outDataID);
175 value = outData->
values()(0);
176 BOOST_TEST(mapping.hasComputedMapping() ==
true);
177 BOOST_TEST(value == 1.5);
183 int dataDimensions = dimensions;
184 using Eigen::Vector2d;
189 int inDataID = inData->
getID();
208 auto &values = inData->
values();
210 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;
215 int outDataID = outData->
getID();
231 mapping.
map(inDataID, outDataID);
233 DataID index1 = 1 * dataDimensions;
234 DataID index2 = 2 * dataDimensions;
238 BOOST_TEST(outData->
values()(index1) == 4.5);
239 BOOST_TEST(outData->
values()(index1 + 1) == 9.0);
240 BOOST_TEST(outData->
values()(index2) == 3.5);
241 BOOST_TEST(outData->
values()(index2 + 1) == 7.0);
245 outData->
values().setZero();
247 mapping.
map(inDataID, outDataID);
249 BOOST_TEST(outData->
values()(0) == 1.0);
250 BOOST_TEST(outData->
values()(1) == 2.0);
254 outData->
values().setZero();
256 mapping.
map(inDataID, outDataID);
258 BOOST_TEST(outData->
values()(0) == 1.0);
259 BOOST_TEST(outData->
values()(1) == 2.0);
263 outData->
values().setZero();
265 mapping.
map(inDataID, outDataID);
267 BOOST_TEST(outData->
values()(0) == 2.0);
268 BOOST_TEST(outData->
values()(1) == 4.0);
272 outData->
values().setZero();
274 mapping.
map(inDataID, outDataID);
276 BOOST_TEST(outData->
values()(0) == 2.0);
277 BOOST_TEST(outData->
values()(1) == 4.0);
281 outData->
values().setZero();
283 mapping.
map(inDataID, outDataID);
285 BOOST_TEST(outData->
values()(0) == 2.0);
286 BOOST_TEST(outData->
values()(1) == 4.0);
290 outData->
values().setZero();
292 mapping.
map(inDataID, outDataID);
294 BOOST_TEST(outData->
values()(0) == 1.5);
295 BOOST_TEST(outData->
values()(1) == 3.0);
299 outData->
values().setZero();
301 mapping.
map(inDataID, outDataID);
303 BOOST_TEST(outData->
values()(0) == 1.5);
304 BOOST_TEST(outData->
values()(1) == 3.0);
308 outData->
values().setZero();
310 mapping.
map(inDataID, outDataID);
312 BOOST_TEST(outData->
values()(0) == 1.5);
313 BOOST_TEST(outData->
values()(1) == 3.0);
322 int inDataID = inData->
getID();
325 for (
unsigned int i = 0; i < 20; ++i)
327 inMesh->
createVertex(Eigen::Vector2d(0.0, 0.0 + i * dim));
328 inMesh->
createVertex(Eigen::Vector2d(1e-5, 0.0 + i * dim));
330 inMesh->
createVertex(Eigen::Vector3d(7.0, 7.0, 40 + i * dim));
331 inMesh->
createVertex(Eigen::Vector3d(7.001, 7.001, 40 + i * dim));
337 auto &values = inData->
values();
339 values[v * 2] = v * dim * 1e-5;
340 values[v * 2 + 1] = v * dim * 1e-5 + 2;
346 int outDataID = outData->
getID();
348 for (
unsigned int i = 0; i < 15; ++i) {
350 outMesh->
createVertex(Eigen::Vector2d(.1, 1 + 1 + i * dim));
352 outMesh->
createVertex(Eigen::Vector3d(7.4, 7.4, 41 + i * dim));
363 mapping.
map(inDataID, outDataID);
364 double value = outData->
values()(0);
365 double value1 = outData->
values()(1);
366 double value2 = outData->
values()(2);
369 BOOST_TEST(
math::equals(value, 19935.374757794027, 0.2));
370 BOOST_TEST(
math::equals(value1, 19935.37795225389, 0.2));
371 BOOST_TEST(
math::equals(value2, 19935.35164938603, 0.2));
373 BOOST_TEST(value == 829.28063055069435);
374 BOOST_TEST(value1 == 819.35577218983303);
375 BOOST_TEST(value2 == 829.38388713302811);
479 int dataDimensions = dimensions;
480 using Eigen::Vector2d;
496 auto &values = inData->
values();
498 values << 1.0, 2.0, 2.0, 4.0, 2.0, 4.0, 1.0, 2.0, 3.0, 6.0;
530 mapping.
map(inDataID, outDataID);
535 BOOST_TEST(insumc0 == outsumc0);
541 BOOST_TEST(insumc0 * 2 == insumc1);
542 BOOST_TEST(outsumc0 * 2 == outsumc1);
543 BOOST_TEST(insumc1 == outsumc1);
548 values << 1.0, 0.0, 12.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0;
551 outData->
values().setZero();
553 mapping.
map(inDataID, outDataID);
557 BOOST_TEST(19.0 == outsumc0);
562 BOOST_TEST(0.0 == outsumc1);
567 values << 0.0, 2.0, 0.0, 4.0, 0.0, 8.0, 0.0, 7.0, 0.0, 0.0;
570 outData->
values().setZero();
572 mapping.
map(inDataID, outDataID);
576 BOOST_TEST(0.0 == outsumc0);
581 BOOST_TEST(21.0 == outsumc1);
586 values << 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 27.0;
589 outData->
values().setZero();
591 mapping.
map(inDataID, outDataID);
595 BOOST_TEST(10.0 == outsumc0);
596 BOOST_TEST(outData->
values()(2) == 10);
600 BOOST_TEST(27.0 == outsumc1);
601 BOOST_TEST(outData->
values()(21) == 27);
606 values << 3.0, 6.0, 2.0, 4.0, 12.0, 24.0, 1.0, 2.0, 3.0, 6.0;
609 outData->
values().setZero();
611 mapping.
map(inDataID, outDataID);
613 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
615 double expectedValue = 3.5933508322619825;
617 BOOST_TEST(outData->
values()(12) == expectedValue);
620 BOOST_TEST(outData->
values()(13) == 2 * expectedValue);
626 using Eigen::Vector3d;
631 int inDataID = inData->
getID();
665 auto &values = inData->
values();
667 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;
672 int outDataID = outData->
getID();
685 vertex.
setCoords(Vector3d(0.0, 0.0, 0.0));
687 mapping.
map(inDataID, outDataID);
688 double value = outData->
values()(0);
689 double value1 = outData->
values()(1);
690 double value2 = outData->
values()(2);
692 BOOST_TEST(value == 1.0);
693 BOOST_TEST(value1 == 9.0);
694 BOOST_TEST(value2 == 10.5);
696 vertex.
setCoords(Vector3d(0.0, 0.5, 0.5));
698 outData->
values().setZero();
700 mapping.
map(inDataID, outDataID);
701 value = outData->
values()(0);
703 BOOST_TEST(value == 2.0);
705 vertex.
setCoords(Vector3d(0.0, 1.0, 1.0));
707 outData->
values().setZero();
709 mapping.
map(inDataID, outDataID);
710 value = outData->
values()(0);
712 BOOST_TEST(value == 3.0);
714 vertex.
setCoords(Vector3d(1.0, 0.0, 0.0));
716 outData->
values().setZero();
718 mapping.
map(inDataID, outDataID);
719 value = outData->
values()(0);
721 BOOST_TEST(value == 2.0);
723 vertex.
setCoords(Vector3d(1.0, 0.5, 0.5));
725 outData->
values().setZero();
727 mapping.
map(inDataID, outDataID);
728 value = outData->
values()(0);
730 BOOST_TEST(value == 4.0);
732 vertex.
setCoords(Vector3d(1.0, 1.0, 1.0));
734 outData->
values().setZero();
736 mapping.
map(inDataID, outDataID);
737 value = outData->
values()(0);
739 BOOST_TEST(value == 6.0);
741 vertex.
setCoords(Vector3d(0.5, 0.0, 0.5));
743 outData->
values().setZero();
745 mapping.
map(inDataID, outDataID);
746 value = outData->
values()(0);
748 BOOST_TEST(value == 3.0);
750 vertex.
setCoords(Vector3d(0.5, 0.5, 1.0));
752 outData->
values().setZero();
754 mapping.
map(inDataID, outDataID);
755 value = outData->
values()(0);
757 BOOST_TEST(value == 4.5);
759 vertex.
setCoords(Vector3d(0.5, 1.0, 0.0));
761 outData->
values().setZero();
763 mapping.
map(inDataID, outDataID);
764 value = outData->
values()(0);
766 BOOST_TEST(value == 1.5);
772 int dataDimensions = dimensions;
774 using Eigen::Vector3d;
779 int inDataID = inData->
getID();
816 int outDataID = outData->
getID();
829 for (
unsigned int i = 0; i < inData->
values().size() / dataDimensions; ++i) {
830 inData->
values()(i * dataDimensions) = 7;
831 inData->
values()(i * dataDimensions + 1) = 38;
832 inData->
values()(i * dataDimensions + 2) = 19;
837 mapping.
map(inDataID, outDataID);
839 BOOST_TEST(outData->
values()(0) == 7.0);
840 BOOST_TEST(outData->
values()(1) == 38.0);
841 BOOST_TEST(outData->
values()(2) == 19.0);
842 BOOST_TEST(outData->
values()(9) == 7.0);
843 BOOST_TEST(outData->
values()(10) == 38.0);
844 BOOST_TEST(outData->
values()(11) == 19.0);
847 for (
unsigned int i = 0; i < inData->
values().size() / dataDimensions; ++i) {
848 inData->
values()(i * dataDimensions) =
std::pow(i * dataDimensions, 2);
849 inData->
values()(i * dataDimensions + 1) = 2 *
std::pow(i * dataDimensions, 2);
850 inData->
values()(i * dataDimensions + 2) = 3 *
std::pow(i * dataDimensions, 2);
854 outData->
values().setZero();
856 mapping.
map(inDataID, outDataID);
858 BOOST_TEST(outData->
values()(12) == 3673.7308684337013);
859 BOOST_TEST(outData->
values()(13) == 2 * outData->
values()(12));
860 BOOST_TEST(outData->
values()(14) == 3 * outData->
values()(12));
868 using Eigen::Vector3d;
923 auto &values = inData->
values();
925 values << 1.0, 2.0, 2.0, 1.0, 3.0;
928 mapping.
map(inDataID, outDataID);
930 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
933 values << 12.0, 5.0, 7.0, 8.0, 9.0;
936 outData->
values().setZero();
938 mapping.
map(inDataID, outDataID);
940 const double expectedSum = 41;
941 BOOST_TEST(outData->
values().sum() == expectedSum);
942 BOOST_TEST(outData->
values()(6) == 8);
943 BOOST_TEST(outData->
values()(0) == 12);
946 values << 0.0, 50.0, 107.0, 108.0, 48.0;
949 outData->
values().setZero();
951 mapping.
map(inDataID, outDataID);
953 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
954 BOOST_TEST(outData->
values()(0) == 0.0);
955 BOOST_TEST(outData->
values()(6) > outData->
values()(1));
956 BOOST_TEST(outData->
values()(13) > outData->
values()(9));
959 values << 0.0, 100.0, 0.0, 0.0, 0.0;
962 outData->
values().setZero();
964 mapping.
map(inDataID, outDataID);
966 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
967 BOOST_TEST(outData->
values()(9) == outData->
values()(13));
968 BOOST_TEST(outData->
values()(9) == outData->
values()(10));
969 BOOST_TEST(outData->
values()(16) == outData->
values()(19));
973 BOOST_TEST(outData->
values()(20) == outData->
values()(23));
974 BOOST_TEST(outData->
values()(16) == outData->
values()(20));
975 BOOST_TEST(outData->
values()(9) == 15.470584170385226);
980 const int dimensions = 3;
981 const int dataDimension = dimensions;
982 using Eigen::Vector3d;
1038 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1039 inData->
values()(i * dataDimension) = 7;
1040 inData->
values()(i * dataDimension + 1) = 0;
1041 inData->
values()(i * dataDimension + 2) = 0;
1045 mapping.
map(inDataID, outDataID);
1047 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1048 BOOST_TEST(outData->
values().sum() == 35);
1049 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1050 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 0);
1051 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 0);
1055 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1056 inData->
values()(i * dataDimension) = 0;
1057 inData->
values()(i * dataDimension + 1) = 27;
1058 inData->
values()(i * dataDimension + 2) = 0;
1061 outData->
values().setZero();
1063 mapping.
map(inDataID, outDataID);
1065 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1066 BOOST_TEST(outData->
values().sum() == 135);
1068 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1069 BOOST_TEST(outData->
values()(i * dataDimension) == 0);
1070 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 0);
1074 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1075 inData->
values()(i * dataDimension) = 0;
1076 inData->
values()(i * dataDimension + 1) = 0;
1077 inData->
values()(i * dataDimension + 2) = 3;
1080 outData->
values().setZero();
1082 mapping.
map(inDataID, outDataID);
1084 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1085 BOOST_TEST(outData->
values().sum() == 15);
1087 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1088 BOOST_TEST(outData->
values()(i * dataDimension) == 0);
1089 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 0);
1093 for (
unsigned int i = 0; i < inData->
values().size() / dataDimension; ++i) {
1094 inData->
values()(i * dataDimension) =
std::pow(i * dataDimension, 3);
1095 inData->
values()(i * dataDimension + 1) = 5 *
std::pow(i * dataDimension, 3);
1096 inData->
values()(i * dataDimension + 2) = 10 *
std::pow(i * dataDimension, 3);
1099 outData->
values().setZero();
1101 mapping.
map(inDataID, outDataID);
1103 BOOST_TEST(outData->
values().sum() == inData->
values().sum());
1105 for (
unsigned int i = 0; i < outData->
values().size() / dataDimension; ++i) {
1107 if (outData->
values()(i * dataDimension) > 1e-10) {
1108 BOOST_TEST(outData->
values()(i * dataDimension + 1) == 5 * outData->
values()(i * dataDimension));
1109 BOOST_TEST(outData->
values()(i * dataDimension + 2) == 10 * outData->
values()(i * dataDimension));
1112 BOOST_TEST(outData->
values()(55) == 4087.8100404079933);
1151 using Eigen::Vector3d;
1156 int inDataID = inData->
getID();
1190 auto &values = inData->
values();
1192 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;
1197 int outDataID = outData->
getID();
1210 vertex.
setCoords(Vector3d(0.0, 0.0, 0.0));
1212 mapping.
map(inDataID, outDataID);
1213 double value = outData->
values()(0);
1214 double value1 = outData->
values()(1);
1215 double value2 = outData->
values()(2);
1217 BOOST_TEST(value == 1.0);
1218 BOOST_TEST(value1 == 9.0);
1219 BOOST_TEST(value2 == 10.5);
1221 vertex.
setCoords(Vector3d(0.0, 0.5, 0.5));
1223 outData->
values().setZero();
1225 mapping.
map(inDataID, outDataID);
1226 value = outData->
values()(0);
1228 BOOST_TEST(value == 2.0);
1230 vertex.
setCoords(Vector3d(1.0, 0.0, 0.0));
1232 outData->
values().setZero();
1234 mapping.
map(inDataID, outDataID);
1235 value = outData->
values()(0);
1237 BOOST_TEST(value == 2.0);
1239 vertex.
setCoords(Vector3d(1.0, 0.5, 0.5));
1241 outData->
values().setZero();
1243 mapping.
map(inDataID, outDataID);
1244 value = outData->
values()(0);
1246 BOOST_TEST(value == 4.0);
1248 vertex.
setCoords(Vector3d(0.5, 0.5, 1.0));
1250 outData->
values().setZero();
1252 mapping.
map(inDataID, outDataID);
1253 value = outData->
values()(0);
1255 BOOST_TEST(value > 4.6);
1257 vertex.
setCoords(Vector3d(0.5, 1.0, 0.0));
1259 outData->
values().setZero();
1261 mapping.
map(inDataID, outDataID);
1262 value = outData->
values()(0);
1264 BOOST_TEST(value < 1.4);
1355 int inGlobalIndexOffset = 0,
1356 bool meshIsSmaller =
false)
1358 int meshDimension = inMeshSpec.at(0).position.size();
1359 int valueDimension = inMeshSpec.at(0).value.size();
1363 int inDataID = inData->
getID();
1369 int outDataID = outData->
getID();
1378 mapping.
map(inDataID, outDataID);
1381 for (
auto &referenceVertex : referenceSpec) {
1382 if (referenceVertex.first == context.
rank or referenceVertex.first == -1) {
1383 for (
int dim = 0; dim < valueDimension; ++dim) {
1384 BOOST_TEST_INFO(
"Index of vertex: " <<
index <<
" - Dimension: " << dim);
1385 BOOST_TEST(outData->
values()(
index * valueDimension + dim) == referenceVertex.second.at(dim));
1390 BOOST_TEST(outData->
values().size() ==
index * valueDimension);
1659 int meshDimension = inMeshSpec.at(0).position.size();
1660 int valueDimension = inMeshSpec.at(0).value.size();
1678 for (
const auto &v : inMesh->
vertices()) {
1679 auto pos =
std::find_if(shouldTagFirstRound.begin(), shouldTagFirstRound.end(),
1681 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1683 bool found = pos != shouldTagFirstRound.end();
1684 BOOST_TEST(found >= v.isTagged(),
1685 "FirstRound: Vertex " << v <<
" is tagged, but should not be.");
1686 BOOST_TEST(found <= v.isTagged(),
1687 "FirstRound: Vertex " << v <<
" is not tagged, but should be.");
1692 for (
const auto &v : inMesh->
vertices()) {
1693 auto posFirst =
std::find_if(shouldTagFirstRound.begin(), shouldTagFirstRound.end(),
1695 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1697 bool foundFirst = posFirst != shouldTagFirstRound.end();
1698 auto posSecond =
std::find_if(shouldTagSecondRound.begin(), shouldTagSecondRound.end(),
1700 return std::equal(spec.position.data(), spec.position.data() + meshDimension, v.getCoords().data());
1702 bool foundSecond = posSecond != shouldTagSecondRound.end();
1703 BOOST_TEST(foundFirst <= v.isTagged(),
"SecondRound: Vertex " << v
1704 <<
" is not tagged, but should be from the first round.");
1705 BOOST_TEST(foundSecond <= v.isTagged(),
"SecondRound: Vertex " << v
1706 <<
" is not tagged, but should be.");
1707 BOOST_TEST((foundSecond or foundFirst) >= v.isTagged(),
"SecondRound: Vertex " << v
1708 <<
" is tagged, but should not be.");
Rank rank
the rank of the current participant