Loading Unstructured_mesh/Unstructured_mesh.pro +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ CONFIG -= qt INCLUDEPATH += $$PWD/../src/ SOURCES += \ ../src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp \ main.cpp \ HEADERS += \ Loading Loading @@ -62,6 +61,7 @@ DISTFILES += \ ../src/UnitTests/Traits/ArithmeticTraitsTest.cpp \ ../src/UnitTests/Traits/TraitsTest.cpp \ ../src/UnitTests/UnstructuredMesh/MeshDataContainerTest.cpp \ ../src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp \ ../README.md \ ../src/GTMesh/Debug/README.md \ ../src/GTMesh/Traits/TraitsAlgorithm/README.md \ Loading Unstructured_mesh/main.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1055,7 +1055,7 @@ void testFPMA_poly(){ } /* int main() { //meshSize(); Loading @@ -1071,5 +1071,5 @@ int main() //testFPMA_poly(); }*/ } src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp +27 −16 Original line number Diff line number Diff line Loading @@ -254,6 +254,7 @@ TEST( UnstructuredMesh3D_Functions_Test, 3DMeshTest ) // center distance auto dist = computeCellsDistance(mesh); std::vector<double> expectCellDist = { 0.5, 0.5, 0.372678, 0.372678, 0.372678, 0.372678, 0.5, 0.5, 0.471405 }; EXPECT_TRUE(floatArrayCompare(dist.getDataByPos<0>(), expectCellDist)); // Mesh connections Loading Loading @@ -318,12 +319,12 @@ TEST( MeshRefineTest, 3DMeshTest ) { mesh.clear(); MeshDataContainer<CellData<3>, 3> cellDataLoad(mesh); VTKMeshReader<3> reader; std::ifstream ifst("mesh_refine_0.vtk"); std::ifstream ifst("mesh_refine_0.vtk", std::ios::binary | std::ios::in); EXPECT_TRUE(bool(ifst)); reader.loadFromStream(ifst, mesh); MeshDataContainer<CellData<3>, 3> cellDataLoad(mesh); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoad); ifst.close(); Loading Loading @@ -355,26 +356,36 @@ TEST( MeshRefineTest, 3DMeshTest ) { VTKMeshWriter<3, size_t, double> writer1; out3D.open("mesh_refine_1.vtk"); EXPECT_TRUE(bool(out3D)); writer.writeHeader(out3D, "test data"); writer.writeToStream(out3D, mesh, types1); writer1.writeHeader(out3D, "test data"); writer1.writeToStream(out3D, mesh, types1); VTKMeshDataWriter<3>::writeToStream(out3D, cellData, writer1); out3D.close(); UnstructuredMesh<3, size_t, double, 6> meshRefined; ifst.open("mesh_refine_1.vtk"); ifst.open("mesh_refine_1.vtk", std::ios::binary | std::ios::in); EXPECT_TRUE(bool(ifst)); reader.loadFromStream(ifst, meshRefined); MeshDataContainer<CellData<3>, 3> cellDataLoadRefined(mesh); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoad); MeshDataContainer<CellData<3>, 3> cellDataLoadRefined(meshRefined); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoadRefined); ifst.close(); for (auto& cell : meshRefined.getCells()){ EXPECT_EQ(cellDataLoad[cell].color, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].color); EXPECT_TRUE(floatArrayCompare( cellDataLoad[cell].center, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].center)); EXPECT_EQ(cellDataLoadRefined[cell].color, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].color); EXPECT_TRUE(floatArrayCompare( cellDataLoadRefined[cell].center, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].center)); } } #endif //#ifndef HAVE_GTEST //int main(){ // UnstructuredMesh2D_Functions_Test(); // UnstructuredMesh2DReadWrite(); // UnstructuredMesh3D_Functions_Test(); // MeshRefineTest(); //} //#else #include "UnitTests/main.h" //#endif Loading
Unstructured_mesh/Unstructured_mesh.pro +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ CONFIG -= qt INCLUDEPATH += $$PWD/../src/ SOURCES += \ ../src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp \ main.cpp \ HEADERS += \ Loading Loading @@ -62,6 +61,7 @@ DISTFILES += \ ../src/UnitTests/Traits/ArithmeticTraitsTest.cpp \ ../src/UnitTests/Traits/TraitsTest.cpp \ ../src/UnitTests/UnstructuredMesh/MeshDataContainerTest.cpp \ ../src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp \ ../README.md \ ../src/GTMesh/Debug/README.md \ ../src/GTMesh/Traits/TraitsAlgorithm/README.md \ Loading
Unstructured_mesh/main.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1055,7 +1055,7 @@ void testFPMA_poly(){ } /* int main() { //meshSize(); Loading @@ -1071,5 +1071,5 @@ int main() //testFPMA_poly(); }*/ }
src/UnitTests/UnstructuredMesh/UnstructuredMeshTest.cpp +27 −16 Original line number Diff line number Diff line Loading @@ -254,6 +254,7 @@ TEST( UnstructuredMesh3D_Functions_Test, 3DMeshTest ) // center distance auto dist = computeCellsDistance(mesh); std::vector<double> expectCellDist = { 0.5, 0.5, 0.372678, 0.372678, 0.372678, 0.372678, 0.5, 0.5, 0.471405 }; EXPECT_TRUE(floatArrayCompare(dist.getDataByPos<0>(), expectCellDist)); // Mesh connections Loading Loading @@ -318,12 +319,12 @@ TEST( MeshRefineTest, 3DMeshTest ) { mesh.clear(); MeshDataContainer<CellData<3>, 3> cellDataLoad(mesh); VTKMeshReader<3> reader; std::ifstream ifst("mesh_refine_0.vtk"); std::ifstream ifst("mesh_refine_0.vtk", std::ios::binary | std::ios::in); EXPECT_TRUE(bool(ifst)); reader.loadFromStream(ifst, mesh); MeshDataContainer<CellData<3>, 3> cellDataLoad(mesh); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoad); ifst.close(); Loading Loading @@ -355,26 +356,36 @@ TEST( MeshRefineTest, 3DMeshTest ) { VTKMeshWriter<3, size_t, double> writer1; out3D.open("mesh_refine_1.vtk"); EXPECT_TRUE(bool(out3D)); writer.writeHeader(out3D, "test data"); writer.writeToStream(out3D, mesh, types1); writer1.writeHeader(out3D, "test data"); writer1.writeToStream(out3D, mesh, types1); VTKMeshDataWriter<3>::writeToStream(out3D, cellData, writer1); out3D.close(); UnstructuredMesh<3, size_t, double, 6> meshRefined; ifst.open("mesh_refine_1.vtk"); ifst.open("mesh_refine_1.vtk", std::ios::binary | std::ios::in); EXPECT_TRUE(bool(ifst)); reader.loadFromStream(ifst, meshRefined); MeshDataContainer<CellData<3>, 3> cellDataLoadRefined(mesh); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoad); MeshDataContainer<CellData<3>, 3> cellDataLoadRefined(meshRefined); VTKMeshDataReader<3, size_t>::readFromStream(ifst, cellDataLoadRefined); ifst.close(); for (auto& cell : meshRefined.getCells()){ EXPECT_EQ(cellDataLoad[cell].color, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].color); EXPECT_TRUE(floatArrayCompare( cellDataLoad[cell].center, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].center)); EXPECT_EQ(cellDataLoadRefined[cell].color, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].color); EXPECT_TRUE(floatArrayCompare( cellDataLoadRefined[cell].center, cellData.getDataByPos<0>()[writer1.backwardCellIndexMapping[cell.getIndex()]].center)); } } #endif //#ifndef HAVE_GTEST //int main(){ // UnstructuredMesh2D_Functions_Test(); // UnstructuredMesh2DReadWrite(); // UnstructuredMesh3D_Functions_Test(); // MeshRefineTest(); //} //#else #include "UnitTests/main.h" //#endif