28 mesh::PtrData ptrFromData = ptrFromMesh->createData(
"MappedData", dimensions, 0_dataID);
30 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
31 ptrFromMesh->createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
32 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 1.0));
36 mesh::PtrData ptrToData = ptrToMesh->createData(
"MappedData", dimensions, 1_dataID);
38 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 0.0));
39 ptrToMesh->createVertex(Eigen::Vector3d(1.0, 0.1, 0.0));
40 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 1.0));
43 toMeshContext.
mesh = ptrToMesh;
48 mappingContext.
fromMeshID = ptrFromMesh->getID();
49 mappingContext.
toMeshID = ptrToMesh->getID();
51 BOOST_TEST(ptrToData->getID() != ptrFromData->getID());
52 BOOST_TEST(ptrToMesh->getID() != ptrFromMesh->getID());
56 BOOST_TEST(dataContext.
getMeshID() == ptrFromMesh->getID());
62 BOOST_TEST(fixture.
getFromDataID(dataContext, 0) == ptrFromData->getID());
63 BOOST_TEST(fixture.
getToDataID(dataContext, 0) == ptrToData->getID());
66 BOOST_TEST(dataContext.
getMeshID() != ptrToMesh->getID());
67 BOOST_TEST(dataContext.
getMeshID() == ptrFromMesh->getID());
84 mesh::PtrData ptrFromData = ptrFromMesh->createData(
"MappedData", dimensions, 0_dataID);
86 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
87 ptrFromMesh->createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
88 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 1.0));
92 mesh::PtrData ptrToData = ptrToMesh->createData(
"MappedData", dimensions, 1_dataID);
94 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 0.0));
95 ptrToMesh->createVertex(Eigen::Vector3d(1.0, 0.1, 0.0));
96 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 1.0));
99 toMeshContext1.
mesh = ptrToMesh;
104 mappingContext.
fromMeshID = ptrFromMesh->getID();
105 mappingContext.
toMeshID = ptrToMesh->getID();
107 BOOST_TEST(ptrToData->getID() != ptrFromData->getID());
108 BOOST_TEST(ptrToMesh->getID() != ptrFromMesh->getID());
112 BOOST_TEST(dataContext.
getMeshID() == ptrFromMesh->getID());
120 mesh::PtrData ptrToData2 = ptrToMesh2->createData(
"MappedData", dimensions, 2_dataID);
122 ptrToMesh2->createVertex(Eigen::Vector3d(0.0, 1.1, 0.0));
123 ptrToMesh2->createVertex(Eigen::Vector3d(2.0, 1.1, 0.0));
124 ptrToMesh2->createVertex(Eigen::Vector3d(0.0, 2.1, 4.0));
127 toMeshContext2.
mesh = ptrToMesh2;
130 mappingContext2.
fromMeshID = ptrFromMesh->getID();
131 mappingContext2.
toMeshID = ptrToMesh2->getID();
140 BOOST_TEST(dataContext.
getMeshID() != ptrToMesh->getID());
141 BOOST_TEST(dataContext.
getMeshID() == ptrFromMesh->getID());
145 BOOST_TEST(fixture.
getFromDataID(dataContext, 0) == ptrFromData->getID());
146 BOOST_TEST(fixture.
getToDataID(dataContext, 0) == ptrToData->getID());
153 BOOST_TEST(dataContext.
getMeshID() != ptrToMesh2->getID());
157 BOOST_TEST(fixture.
getFromDataID(dataContext, 1) == ptrFromData->getID());
158 BOOST_TEST(fixture.
getToDataID(dataContext, 1) == ptrToData2->getID());
172 int dataDimensions = 1;
175 mesh::PtrData ptrData = ptrMesh->createData(
"Data", dataDimensions, 0_dataID);
179 ids[0] = ptrMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 0.0)).getID();
180 ids[1] = ptrMesh->createVertex(Eigen::Vector3d(1.0, 0.0, 0.0)).getID();
181 ids[2] = ptrMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 1.0)).getID();
183 BOOST_TEST(ids[0] == 0);
184 BOOST_TEST(ids[1] == 1);
185 BOOST_TEST(ids[2] == 2);
188 for (
int i = 0; i < nValues; i++) {
196 BOOST_TEST(dataContext.
getMeshID() == ptrMesh->getID());
202 ids.
emplace_back(ptrMesh->createVertex(Eigen::Vector3d(0.0, 1.0, 0.0)).getID());
205 BOOST_TEST(ids[3] == 3);
220 mesh::PtrData ptrToData = ptrToMesh->createData(
"MappedData", dimensions, 0_dataID);
222 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
223 ptrToMesh->createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
224 ptrToMesh->createVertex(Eigen::Vector3d(0.0, 0.0, 1.0));
228 mesh::PtrData ptrFromData = ptrFromMesh->createData(
"MappedData", dimensions, 1_dataID);
230 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 0.0));
231 ptrFromMesh->createVertex(Eigen::Vector3d(1.0, 0.1, 0.0));
232 ptrFromMesh->createVertex(Eigen::Vector3d(0.0, 0.1, 1.0));
235 fromMeshContext.
mesh = ptrFromMesh;
240 mappingContext.
fromMeshID = ptrFromMesh->getID();
241 mappingContext.
toMeshID = ptrToMesh->getID();
243 BOOST_TEST(ptrToData->getID() != ptrFromData->getID());
244 BOOST_TEST(ptrToMesh->getID() != ptrFromMesh->getID());
248 BOOST_TEST(dataContext.
getMeshID() == ptrToMesh->getID());
256 BOOST_TEST(fixture.
getFromDataID(dataContext, 0) == ptrFromData->getID());
257 BOOST_TEST(fixture.
getToDataID(dataContext, 0) == ptrToData->getID());
260 BOOST_TEST(dataContext.
getMeshID() == ptrToMesh->getID());
261 BOOST_TEST(dataContext.
getMeshID() != ptrFromMesh->getID());
BOOST_AUTO_TEST_CASE(testDataContextWriteMapping)
Stores one Data object with related mesh. Context stores data to be read from and potentially provide...
void appendMappingConfiguration(MappingContext &mappingContext, const MeshContext &meshContext) override
Adds a MappingContext and the MeshContext required by the read mapping to the corresponding ReadDataC...
Stores one Data object with related mesh. Context stores data to be written to and potentially provid...
void resizeBufferTo(int size)
void writeValuesIntoDataBuffer(::precice::span< const VertexID > vertices, ::precice::span< const double > values)
Store values in _writeDataBuffer.
void appendMappingConfiguration(MappingContext &mappingContext, const MeshContext &meshContext) override
Adds a MappingContext and the MeshContext required by the write mapping to the corresponding WriteDat...
int getToDataID(precice::impl::DataContext &dataContext, int dataVectorIndex)
int getProvidedDataID(precice::impl::DataContext &dataContext)
bool hasReadMapping(precice::impl::DataContext &dataContext)
int getFromDataID(precice::impl::DataContext &dataContext, int dataVectorIndex)
bool hasWriteMapping(precice::impl::DataContext &dataContext)
bool hasMapping(precice::impl::DataContext &dataContext)
std::vector< impl::MappingContext > mappingContexts(precice::impl::DataContext &dataContext)
Holds a data mapping and related information.
mapping::PtrMapping mapping
Data mapping.
MeshID fromMeshID
id of mesh from which is mapped
MeshID toMeshID
id of mesh to which is mapped
Stores a mesh and related objects and data.
mesh::PtrMesh mesh
Mesh holding the geometry data structure.