35 v.setGlobalIndex(v.getID() + offset);
44 for (
int dim = 0; dim < inputIntegral.size(); ++dim) {
45 BOOST_TEST(inputIntegral(dim) == outputIntegral(dim));
53 using Eigen::Vector2d;
58 int inDataID = inData->
getID();
67 auto &values = inData->
values();
68 values << 1.0, 2.0, 2.0, 1.0;
73 int outDataID = outData->
getID();
85 mapping.
map(inDataID, outDataID);
86 double value = outData->
values()(0);
88 BOOST_TEST(value == 1.0);
92 mapping.
map(inDataID, outDataID);
93 value = outData->
values()(0);
95 BOOST_TEST(value == 1.0);
99 mapping.
map(inDataID, outDataID);
100 value = outData->
values()(0);
102 BOOST_TEST(value == 1.0);
106 mapping.
map(inDataID, outDataID);
107 value = outData->
values()(0);
109 BOOST_TEST(value == 2.0);
113 mapping.
map(inDataID, outDataID);
114 value = outData->
values()(0);
116 BOOST_TEST(value == 2.0);
120 mapping.
map(inDataID, outDataID);
121 value = outData->
values()(0);
123 BOOST_TEST(value == 2.0);
127 mapping.
map(inDataID, outDataID);
128 value = outData->
values()(0);
130 BOOST_TEST(value == 1.5);
134 mapping.
map(inDataID, outDataID);
135 value = outData->
values()(0);
137 BOOST_TEST(value == 1.5);
141 mapping.
map(inDataID, outDataID);
142 value = outData->
values()(0);
144 BOOST_TEST(value == 1.5);
150 using Eigen::Vector2d;
155 int inDataID = inData->
getID();
164 auto &values = inData->
values();
165 values << 1.0, 4.0, 2.0, 5.0, 2.0, 5.0, 1.0, 4.0;
170 int outDataID = outData->
getID();
182 mapping.
map(inDataID, outDataID);
183 double value1 = outData->
values()(0);
184 double value2 = outData->
values()(1);
186 BOOST_TEST(value1 == 1.0);
187 BOOST_TEST(value2 == 4.0);
191 mapping.
map(inDataID, outDataID);
192 value1 = outData->
values()(0);
193 value2 = outData->
values()(1);
195 BOOST_TEST(value1 == 1.0);
196 BOOST_TEST(value2 == 4.0);
200 mapping.
map(inDataID, outDataID);
201 value1 = outData->
values()(0);
202 value2 = outData->
values()(1);
204 BOOST_TEST(value1 == 1.0);
205 BOOST_TEST(value2 == 4.0);
209 mapping.
map(inDataID, outDataID);
210 value1 = outData->
values()(0);
211 value2 = outData->
values()(1);
213 BOOST_TEST(value1 == 2.0);
214 BOOST_TEST(value2 == 5.0);
218 mapping.
map(inDataID, outDataID);
219 value1 = outData->
values()(0);
220 value2 = outData->
values()(1);
222 BOOST_TEST(value1 == 2.0);
223 BOOST_TEST(value2 == 5.0);
227 mapping.
map(inDataID, outDataID);
228 value1 = outData->
values()(0);
229 value2 = outData->
values()(1);
231 BOOST_TEST(value1 == 2.0);
232 BOOST_TEST(value2 == 5.0);
236 mapping.
map(inDataID, outDataID);
237 value1 = outData->
values()(0);
238 value2 = outData->
values()(1);
240 BOOST_TEST(value1 == 1.5);
241 BOOST_TEST(value2 == 4.5);
245 mapping.
map(inDataID, outDataID);
246 value1 = outData->
values()(0);
247 value2 = outData->
values()(1);
249 BOOST_TEST(value1 == 1.5);
250 BOOST_TEST(value2 == 4.5);
254 mapping.
map(inDataID, outDataID);
255 value1 = outData->
values()(0);
256 value2 = outData->
values()(1);
258 BOOST_TEST(value1 == 1.5);
259 BOOST_TEST(value2 == 4.5);
269 int inDataID = inData->
getID();
282 auto &values = inData->
values();
283 values << 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0;
288 int outDataID = outData->
getID();
298 vertex.
setCoords(Eigen::Vector3d(0.0, 0.0, 0.0));
300 mapping.
map(inDataID, outDataID);
301 double value = outData->
values()(0);
303 BOOST_TEST(value == 1.0);
305 vertex.
setCoords(Eigen::Vector3d(0.0, 0.5, 0.0));
307 mapping.
map(inDataID, outDataID);
308 value = outData->
values()(0);
310 BOOST_TEST(value == 1.0);
312 vertex.
setCoords(Eigen::Vector3d(0.5, 0.5, 0.0));
314 mapping.
map(inDataID, outDataID);
315 value = outData->
values()(0);
317 BOOST_TEST(value == 1.0);
319 vertex.
setCoords(Eigen::Vector3d(1.0, 0.0, 0.0));
321 mapping.
map(inDataID, outDataID);
322 value = outData->
values()(0);
324 BOOST_TEST(value == 1.0);
326 vertex.
setCoords(Eigen::Vector3d(1.0, 1.0, 0.0));
328 mapping.
map(inDataID, outDataID);
329 value = outData->
values()(0);
331 BOOST_TEST(value == 1.0);
333 vertex.
setCoords(Eigen::Vector3d(0.0, 0.0, 1.0));
335 mapping.
map(inDataID, outDataID);
336 value = outData->
values()(0);
338 BOOST_TEST(value == 2.0);
340 vertex.
setCoords(Eigen::Vector3d(1.0, 0.0, 1.0));
342 mapping.
map(inDataID, outDataID);
343 value = outData->
values()(0);
345 BOOST_TEST(value == 2.0);
347 vertex.
setCoords(Eigen::Vector3d(1.0, 1.0, 1.0));
349 mapping.
map(inDataID, outDataID);
350 value = outData->
values()(0);
352 BOOST_TEST(value == 2.0);
354 vertex.
setCoords(Eigen::Vector3d(0.5, 0.5, 1.0));
356 mapping.
map(inDataID, outDataID);
357 value = outData->
values()(0);
359 BOOST_TEST(value == 2.0);
361 vertex.
setCoords(Eigen::Vector3d(0.0, 0.0, 0.5));
363 mapping.
map(inDataID, outDataID);
364 value = outData->
values()(0);
366 BOOST_TEST(value, 1.5);
368 vertex.
setCoords(Eigen::Vector3d(1.0, 0.0, 0.5));
370 mapping.
map(inDataID, outDataID);
371 value = outData->
values()(0);
373 BOOST_TEST(value == 1.5);
375 vertex.
setCoords(Eigen::Vector3d(0.0, 1.0, 0.5));
377 mapping.
map(inDataID, outDataID);
378 value = outData->
values()(0);
380 BOOST_TEST(value == 1.5);
382 vertex.
setCoords(Eigen::Vector3d(1.0, 1.0, 0.5));
384 mapping.
map(inDataID, outDataID);
385 value = outData->
values()(0);
387 BOOST_TEST(value == 1.5);
389 vertex.
setCoords(Eigen::Vector3d(0.5, 0.5, 0.5));
391 mapping.
map(inDataID, outDataID);
392 value = outData->
values()(0);
394 BOOST_TEST(value == 1.5);
400 using Eigen::Vector2d;
405 int inDataID = inData->
getID();
420 auto &inValues = inData->
values();
421 inValues << 1.0, 2.0, 2.0, 1.0;
426 int outDataID = outData->
getID();
427 auto & outV1 = outMesh->
createVertex(Vector2d(0.0, 0.0));
428 auto & outV2 = outMesh->
createVertex(Vector2d(0.0, 1.0));
429 auto & outV3 = outMesh->
createVertex(Vector2d(1.1, 1.1));
430 auto & outV4 = outMesh->
createVertex(Vector2d(0.1, 1.1));
444 mapping.
map(inDataID, outDataID);
456 int inDataID = inData->
getID();
457 auto & inV1 = inMesh->
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
458 auto & inV2 = inMesh->
createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
459 auto & inV3 = inMesh->
createVertex(Eigen::Vector3d(0.0, 1.0, 0.5));
460 auto & inV4 = inMesh->
createVertex(Eigen::Vector3d(2.0, 0.0, 0.0));
461 auto & inV5 = inMesh->
createVertex(Eigen::Vector3d(0.0, 2.0, 0.0));
462 auto & inV6 = inMesh->
createVertex(Eigen::Vector3d(0.0, 2.0, 1.0));
476 auto &inValues = inData->
values();
477 inValues << 1.0, 2.0, 4.0, 6.0, 8.0, 9.0;
482 int outDataID = outData->
getID();
483 auto & outV1 = outMesh->
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
484 auto & outV2 = outMesh->
createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
485 auto & outV3 = outMesh->
createVertex(Eigen::Vector3d(0.0, 1.1, 0.6));
486 auto & outE1 = outMesh->
createEdge(outV1, outV2);
487 auto & outE2 = outMesh->
createEdge(outV2, outV3);
488 auto & outE3 = outMesh->
createEdge(outV1, outV3);
500 mapping.
map(inDataID, outDataID);
507 const int dimensions = 2;
508 const double tolerance = 1e-6;
509 using Eigen::Vector2d;
514 int inDataID = inData->
getID();
518 inData->
values() << 1.0, 2.0;
525 int outDataID = outData->
getID();
534 auto &values = outData->
values();
542 mapping.
map(inDataID, outDataID);
544 BOOST_TEST(
testing::equals(values, Eigen::Vector4d(0.5, 0.5, 1.0, 1.0), tolerance));
549 mapping.
map(inDataID, outDataID);
551 BOOST_TEST(
testing::equals(values, Eigen::Vector4d(0.5, 1.0, 1.0, 0.5), tolerance));
556 mapping.
map(inDataID, outDataID);
558 BOOST_TEST(
testing::equals(values, Eigen::Vector4d(0.0, 2.0, 0.0, 1.0), tolerance));
563 mapping.
map(inDataID, outDataID);
565 BOOST_TEST(
testing::equals(values, Eigen::Vector4d(1.0, 0.0, 2.0, 0.0), tolerance));
570 mapping.
map(inDataID, outDataID);
572 BOOST_TEST(values.sum() == 3.0);
577 const int dimensions = 2;
578 const double tolerance = 1e-6;
579 using Eigen::Vector2d;
584 int inDataID = inData->
getID();
588 inData->
values() << 1.0, 4.0, 2.0, 5.0;
595 int outDataID = outData->
getID();
604 auto &values = outData->
values();
612 mapping.
map(inDataID, outDataID);
614 Eigen::VectorXd refValues(8);
615 refValues << 0.5, 2, 0.5, 2, 1.0, 2.5, 1.0, 2.5;
621 mapping.
map(inDataID, outDataID);
623 refValues << 0.5, 2, 1.0, 2.5, 1.0, 2.5, 0.5, 2;
629 mapping.
map(inDataID, outDataID);
631 refValues << 0.0, 0.0, 2.0, 5.0, 0.0, 0.0, 1.0, 4.0;
637 mapping.
map(inDataID, outDataID);
639 refValues << 1.0, 4.0, 0.0, 0.0, 2.0, 5.0, 0.0, 0.0;
645 mapping.
map(inDataID, outDataID);
647 BOOST_TEST(values.sum() == 12.0);
652 using Eigen::Vector3d;
658 int inDataID = inData->
getID();
662 inData->
values() << 1.0, 2.0;
669 int outDataID = outData->
getID();
682 auto & values = outData->
values();
683 double expectedSum = inData->
values().sum();
688 vertex0.
setCoords(Vector3d(0.5, 0.0, 0.0));
689 vertex1.
setCoords(Vector3d(0.5, 1.0, 0.0));
691 mapping.
map(inDataID, outDataID);
693 BOOST_TEST(values.sum() == expectedSum);
void addGlobalIndex(mesh::PtrMesh &mesh, int offset=0)
void perform2DTestConservativeMappingVector(Mapping &mapping)
void perform2DTestConsistentMappingVector(Mapping &mapping)
void perform2DTestConsistentMapping(Mapping &mapping)
void perform3DTestConsistentMapping(Mapping &mapping)
void perform3DTestConservativeMapping(Mapping &mapping)
void perform2DTestConservativeMapping(Mapping &mapping)
void perform3DTestScaledConsistentMapping(Mapping &mapping)
void perform2DTestScaledConsistentMapping(Mapping &mapping)
void testSerialScaledConsistent(mesh::PtrMesh inMesh, mesh::PtrMesh outMesh, PtrData inData, PtrData outData)
Abstract base class for mapping of data from one mesh to another.
void setMeshes(const mesh::PtrMesh &input, const mesh::PtrMesh &output)
Sets input and output meshes carrying data to be mapped.
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)
DataID getID() const
Returns the ID of the data set (supposed to be unique).
Eigen::VectorXd & values()
Returns a reference to the data values.
Container and creator for meshes.
Triangle & createTriangle(Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree)
Creates and initializes a Triangle object.
void setGlobalNumberOfVertices(int num)
std::size_t nVertices() const
Returns the number of vertices.
PtrData & createData(const std::string &name, int dimension, DataID id, int waveformDegree=time::Time::DEFAULT_WAVEFORM_DEGREE)
Create only data for vertex.
Edge & createEdge(Vertex &vertexOne, Vertex &vertexTwo)
Creates and initializes an Edge object.
Vertex & createVertex(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.
contains data mapping from points to meshes.
provides Mesh, Data and primitives.
Eigen::VectorXd integrateSurface(const PtrMesh &mesh, const Eigen::VectorXd &input)
Given the data and the mesh, this function returns the surface integral. Assumes no overlap exists fo...
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...
Main namespace of the precice library.