32 PtrData sourceData1 = mesh->createData(
"SourceData1", dimensions, 0_dataID);
33 PtrData sourceData2 = mesh->createData(
"SourceData2", dimensions, 1_dataID);
34 PtrData sourceData3 = mesh->createData(
"SourceData3", dimensions, 2_dataID);
35 PtrData targetData = mesh->createData(
"TargetData", dimensions, 3_dataID);
36 std::vector<int> sourceDataIDs{sourceData1->getID(), sourceData2->getID(), sourceData3->getID()};
37 int targetDataID = targetData->getID();
38 mesh->createVertex(Eigen::Vector3d::Constant(0.0));
39 mesh->createVertex(Eigen::Vector3d::Constant(1.0));
40 mesh->createVertex(Eigen::Vector3d::Constant(2.0));
42 mesh->allocateDataValues();
44 Eigen::VectorXd v1(3), v2(3), v3(3);
48 sourceData1->setSampleAtTime(0,
time::Sample{dimensions, v1});
49 sourceData2->setSampleAtTime(0,
time::Sample{dimensions, v2});
50 sourceData3->setSampleAtTime(0,
time::Sample{dimensions, v3});
54 action::SummationAction::WRITE_MAPPING_POST, sourceDataIDs, targetDataID, mesh);
58 const auto &sourceValues1 = sourceData1->values();
59 const auto &sourceValues2 = sourceData2->values();
60 const auto &sourceValues3 = sourceData3->values();
61 const auto &targetValues = targetData->values();
62 BOOST_TEST(sourceValues1(0) == 2.0);
63 BOOST_TEST(sourceValues1(1) == 3.0);
64 BOOST_TEST(sourceValues1(2) == 4.0);
65 BOOST_TEST(sourceValues2(0) == 1.0);
66 BOOST_TEST(sourceValues2(1) == 2.0);
67 BOOST_TEST(sourceValues2(2) == 3.0);
68 BOOST_TEST(sourceValues3(0) == 2.0);
69 BOOST_TEST(sourceValues3(1) == 3.0);
70 BOOST_TEST(sourceValues3(2) == 4.0);
71 BOOST_TEST(targetValues(0) == 5.0);
72 BOOST_TEST(targetValues(1) == 8.0);
73 BOOST_TEST(targetValues(2) == 11.0);
82 PtrData sourceData1 = mesh->createData(
"SourceData1", dimensions, 0_dataID);
83 PtrData sourceData2 = mesh->createData(
"SourceData2", dimensions, 1_dataID);
84 PtrData targetData = mesh->createData(
"TargetData", dimensions, 2_dataID);
86 int targetDataID = targetData->getID();
87 mesh->createVertex(Eigen::Vector3d::Constant(0.0));
88 mesh->createVertex(Eigen::Vector3d::Constant(1.0));
89 mesh->createVertex(Eigen::Vector3d::Constant(2.0));
90 mesh->allocateDataValues();
92 Eigen::VectorXd v1(9), v2(9);
93 v1 << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0;
94 v2 << 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0;
96 sourceData1->setSampleAtTime(0,
time::Sample{dimensions, v1});
97 sourceData2->setSampleAtTime(0,
time::Sample{dimensions, v2});
101 action::SummationAction::WRITE_MAPPING_POST, sourceDataIDs, targetDataID, mesh);
105 const auto &sourceValues1 = sourceData1->values();
106 const auto &sourceValues2 = sourceData2->values();
107 const auto &targetValues = targetData->values();
108 BOOST_TEST(sourceValues1(0) == 1.0);
109 BOOST_TEST(sourceValues2(0) == 2.0);
110 BOOST_TEST(targetValues(0) == 3.0);
112 BOOST_TEST(sourceValues1(1) == 2.0);
113 BOOST_TEST(sourceValues2(1) == 3.0);
114 BOOST_TEST(targetValues(1) == 5.0);
116 BOOST_TEST(sourceValues1(2) == 3.0);
117 BOOST_TEST(sourceValues2(2) == 4.0);
118 BOOST_TEST(targetValues(2) == 7.0);
120 BOOST_TEST(sourceValues1(3) == 4.0);
121 BOOST_TEST(sourceValues2(3) == 5.0);
122 BOOST_TEST(targetValues(3) == 9.0);
124 BOOST_TEST(sourceValues1(4) == 5.0);
125 BOOST_TEST(sourceValues2(4) == 6.0);
126 BOOST_TEST(targetValues(4) == 11.0);
128 BOOST_TEST(sourceValues1(5) == 6.0);
129 BOOST_TEST(sourceValues2(5) == 7.0);
130 BOOST_TEST(targetValues(5) == 13.0);
132 BOOST_TEST(sourceValues1(6) == 7.0);
133 BOOST_TEST(sourceValues2(6) == 8.0);
134 BOOST_TEST(targetValues(6) == 15.0);
136 BOOST_TEST(sourceValues1(7) == 8.0);
137 BOOST_TEST(sourceValues2(7) == 9.0);
138 BOOST_TEST(targetValues(7) == 17.0);
140 BOOST_TEST(sourceValues1(8) == 9.0);
141 BOOST_TEST(sourceValues2(8) == 10.0);
142 BOOST_TEST(targetValues(8) == 19.0);
148 using namespace mesh;
151 PtrData sourceData1 = mesh->createData(
"SourceData1", dimensions, 0_dataID);
152 PtrData sourceData2 = mesh->createData(
"SourceData2", dimensions, 1_dataID);
153 PtrData targetData = mesh->createData(
"TargetData", dimensions, 2_dataID);
155 int targetDataID = targetData->getID();
156 mesh->createVertex(Eigen::Vector3d::Constant(0.0));
157 mesh->createVertex(Eigen::Vector3d::Constant(1.0));
158 mesh->createVertex(Eigen::Vector3d::Constant(2.0));
159 mesh->allocateDataValues();
161 Eigen::VectorXd v1_05(9), v2_05(9), v1_1(9), v2_1(9);
162 v1_05 << 11.0, 22.0, 33.0, 44.0, 55.0, 66.0, 77.0, 88.0, 99.0;
163 v2_05 << 12.0, 23.0, 34.0, 45.0, 56.0, 67.0, 78.0, 89.0, 910.0;
164 v1_1 << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0;
165 v2_1 << 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0;
167 sourceData1->setSampleAtTime(0.5,
time::Sample{dimensions, v1_05});
168 sourceData2->setSampleAtTime(0.5,
time::Sample{dimensions, v2_05});
169 sourceData1->setSampleAtTime(1.0,
time::Sample{dimensions, v1_1});
170 sourceData2->setSampleAtTime(1.0,
time::Sample{dimensions, v2_1});
173 action::SummationAction::WRITE_MAPPING_POST, sourceDataIDs, targetDataID, mesh);
177 const auto &sourceValues1 = sourceData1->values();
178 const auto &sourceValues2 = sourceData2->values();
179 const auto &targetValues = targetData->values();
180 BOOST_TEST(sourceValues1(0) == 1.0);
181 BOOST_TEST(sourceValues2(0) == 2.0);
182 BOOST_TEST(targetValues(0) == 3.0);
184 BOOST_TEST(sourceValues1(1) == 2.0);
185 BOOST_TEST(sourceValues2(1) == 3.0);
186 BOOST_TEST(targetValues(1) == 5.0);
188 BOOST_TEST(sourceValues1(2) == 3.0);
189 BOOST_TEST(sourceValues2(2) == 4.0);
190 BOOST_TEST(targetValues(2) == 7.0);
192 BOOST_TEST(sourceValues1(3) == 4.0);
193 BOOST_TEST(sourceValues2(3) == 5.0);
194 BOOST_TEST(targetValues(3) == 9.0);
196 BOOST_TEST(sourceValues1(4) == 5.0);
197 BOOST_TEST(sourceValues2(4) == 6.0);
198 BOOST_TEST(targetValues(4) == 11.0);
200 BOOST_TEST(sourceValues1(5) == 6.0);
201 BOOST_TEST(sourceValues2(5) == 7.0);
202 BOOST_TEST(targetValues(5) == 13.0);
204 BOOST_TEST(sourceValues1(6) == 7.0);
205 BOOST_TEST(sourceValues2(6) == 8.0);
206 BOOST_TEST(targetValues(6) == 15.0);
208 BOOST_TEST(sourceValues1(7) == 8.0);
209 BOOST_TEST(sourceValues2(7) == 9.0);
210 BOOST_TEST(targetValues(7) == 17.0);
212 BOOST_TEST(sourceValues1(8) == 9.0);
213 BOOST_TEST(sourceValues2(8) == 10.0);
214 BOOST_TEST(targetValues(8) == 19.0);
218 auto &loadedStample1 = sourceData1->stamples().front();
219 BOOST_TEST(loadedStample1.timestamp == 0.5);
220 sourceData1->values() = loadedStample1.sample.values;
222 auto &loadedStample2 = sourceData2->stamples().front();
223 BOOST_TEST(loadedStample2.timestamp == 0.5);
224 sourceData2->values() = loadedStample2.sample.values;
226 auto &loadedStample3 = targetData->stamples().front();
227 BOOST_TEST(loadedStample3.timestamp == 0.5);
228 targetData->values() = loadedStample3.sample.values;
230 BOOST_TEST(sourceValues1(0) == 11.0);
231 BOOST_TEST(sourceValues2(0) == 12.0);
232 BOOST_TEST(targetValues(0) == 23.0);
234 BOOST_TEST(sourceValues1(1) == 22.0);
235 BOOST_TEST(sourceValues2(1) == 23.0);
236 BOOST_TEST(targetValues(1) == 45.0);
238 BOOST_TEST(sourceValues1(2) == 33.0);
239 BOOST_TEST(sourceValues2(2) == 34.0);
240 BOOST_TEST(targetValues(2) == 67.0);
242 BOOST_TEST(sourceValues1(3) == 44.0);
243 BOOST_TEST(sourceValues2(3) == 45.0);
244 BOOST_TEST(targetValues(3) == 89.0);
246 BOOST_TEST(sourceValues1(4) == 55.0);
247 BOOST_TEST(sourceValues2(4) == 56.0);
248 BOOST_TEST(targetValues(4) == 111.0);
250 BOOST_TEST(sourceValues1(5) == 66.0);
251 BOOST_TEST(sourceValues2(5) == 67.0);
252 BOOST_TEST(targetValues(5) == 133.0);
254 BOOST_TEST(sourceValues1(6) == 77.0);
255 BOOST_TEST(sourceValues2(6) == 78.0);
256 BOOST_TEST(targetValues(6) == 155.0);
258 BOOST_TEST(sourceValues1(7) == 88.0);
259 BOOST_TEST(sourceValues2(7) == 89.0);
260 BOOST_TEST(targetValues(7) == 177.0);
262 BOOST_TEST(sourceValues1(8) == 99.0);
263 BOOST_TEST(sourceValues2(8) == 910.0);
264 BOOST_TEST(targetValues(8) == 1009.0);