From 42c8dd02d3d3d41324901ea57cd8c4177cf80567 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Fri, 26 Jun 2020 00:23:33 +0200 Subject: [PATCH] Update calls to changed getValueBounds(). --- MeshLib/convertMeshToGeo.cpp | 3 +-- .../HydroMechanics/HydroMechanicsProcess.cpp | 2 +- Tests/FileIO/TestGmsInterface.cpp | 4 +-- Tests/FileIO/TestTetGenInterface.cpp | 9 +++---- Tests/FileIO_SWMM/TestSwmmInterface.cpp | 4 +-- Tests/MeshLib/TestRasterToMesh.cpp | 25 ++++++++----------- 6 files changed, 20 insertions(+), 27 deletions(-) diff --git a/MeshLib/convertMeshToGeo.cpp b/MeshLib/convertMeshToGeo.cpp index 6e9ee80d8bc..0c69489f147 100644 --- a/MeshLib/convertMeshToGeo.cpp +++ b/MeshLib/convertMeshToGeo.cpp @@ -97,8 +97,7 @@ bool convertMeshToGeo(const MeshLib::Mesh& mesh, return std::make_tuple(nullptr, std::make_pair(0, 0)); } - auto const bounds = - MeshInformation::getValueBounds<int>(mesh, "MaterialIDs"); + auto const bounds = MeshInformation::getValueBounds(*materialIds); if (!bounds) { OGS_FATAL( diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 48b16643e5d..75f2dac295c 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -102,7 +102,7 @@ HydroMechanicsProcess<GlobalDim>::HydroMechanicsProcess( else { auto const range = - MeshLib::MeshInformation::getValueBounds<int>(mesh, "MaterialIDs"); + MeshLib::MeshInformation::getValueBounds(*materialIDs(mesh)); if (!range) { OGS_FATAL( diff --git a/Tests/FileIO/TestGmsInterface.cpp b/Tests/FileIO/TestGmsInterface.cpp index 0a8553838fb..ea8bd2a44b3 100644 --- a/Tests/FileIO/TestGmsInterface.cpp +++ b/Tests/FileIO/TestGmsInterface.cpp @@ -31,8 +31,8 @@ TEST(FileIO, TestGmsInterface) ASSERT_EQ(1355, types.at(MeshLib::MeshElemType::PYRAMID)); // pyramids ASSERT_EQ(17074, types.at(MeshLib::MeshElemType::PRISM)); // prism auto const& bounds = - MeshLib::MeshInformation::getValueBounds<int>(*mesh, "MaterialIDs"); - ASSERT_TRUE(boost::none != bounds); + MeshLib::MeshInformation::getValueBounds(*materialIDs(*mesh)); + ASSERT_TRUE(bounds.has_value()); ASSERT_EQ(1, bounds->first); ASSERT_EQ(63, bounds->second); } diff --git a/Tests/FileIO/TestTetGenInterface.cpp b/Tests/FileIO/TestTetGenInterface.cpp index ca06839b071..772bf2d2dc2 100644 --- a/Tests/FileIO/TestTetGenInterface.cpp +++ b/Tests/FileIO/TestTetGenInterface.cpp @@ -101,9 +101,10 @@ TEST(FileIO, TetGenMeshReaderWithMaterials) ASSERT_EQ(1378, mesh->getNumberOfNodes()); ASSERT_EQ(5114, mesh->getNumberOfElements()); + ASSERT_NE(nullptr, materialIDs(*mesh)); auto const& bounds = - MeshLib::MeshInformation::getValueBounds<int>(*mesh, "MaterialIDs"); - ASSERT_TRUE(boost::none != bounds); + MeshLib::MeshInformation::getValueBounds(*materialIDs(*mesh)); + ASSERT_TRUE(bounds.has_value()); ASSERT_EQ(-20, bounds->first); ASSERT_EQ(-10, bounds->second); } @@ -119,7 +120,5 @@ TEST(FileIO, TetGenMeshReaderWithoutMaterials) ASSERT_EQ(202, mesh->getNumberOfNodes()); ASSERT_EQ(650, mesh->getNumberOfElements()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<int>(*mesh, "MaterialIDs"); - ASSERT_TRUE(boost::none == bounds); + ASSERT_EQ(nullptr, materialIDs(*mesh)); } diff --git a/Tests/FileIO_SWMM/TestSwmmInterface.cpp b/Tests/FileIO_SWMM/TestSwmmInterface.cpp index bfb92f234ed..1a5f7200d46 100644 --- a/Tests/FileIO_SWMM/TestSwmmInterface.cpp +++ b/Tests/FileIO_SWMM/TestSwmmInterface.cpp @@ -70,8 +70,8 @@ TEST(FileIO, TestSwmmInterface) ASSERT_EQ(n_elems, types.at(MeshLib::MeshElemType::LINE)); // all elems are lines auto const bounds = - MeshLib::MeshInformation::getValueBounds<int>(mesh, "MaterialIDs"); - ASSERT_TRUE(boost::none != bounds); + MeshLib::MeshInformation::getValueBounds(*materialIDs(mesh)); + ASSERT_TRUE(bounds.has_value()); ASSERT_EQ(0, bounds->first); ASSERT_EQ(0, bounds->second); diff --git a/Tests/MeshLib/TestRasterToMesh.cpp b/Tests/MeshLib/TestRasterToMesh.cpp index cc5ec97156d..a5308f27e30 100644 --- a/Tests/MeshLib/TestRasterToMesh.cpp +++ b/Tests/MeshLib/TestRasterToMesh.cpp @@ -121,9 +121,8 @@ TEST_F(RasterToMeshTest, convertRasterToTriMeshValue) ASSERT_TRUE(prop != nullptr); ASSERT_EQ(2 * _n_pix, prop->size()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<double>(*mesh, "test"); - ASSERT_TRUE(boost::none != bounds); + auto const& bounds = MeshLib::MeshInformation::getValueBounds(*prop); + ASSERT_TRUE(bounds.has_value()); ASSERT_NEAR(0, bounds->first, std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.07, bounds->second, std::numeric_limits<double>::epsilon()); @@ -153,9 +152,8 @@ TEST_F(RasterToMeshTest, convertRasterToQuadMeshValue) ASSERT_TRUE(prop != nullptr); ASSERT_EQ(_n_pix, prop->size()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<double>(*mesh, "test"); - ASSERT_TRUE(boost::none != bounds); + auto const& bounds = MeshLib::MeshInformation::getValueBounds(*prop); + ASSERT_TRUE(bounds.has_value()); ASSERT_NEAR(0, bounds->first, std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.07, bounds->second, std::numeric_limits<double>::epsilon()); @@ -185,9 +183,8 @@ TEST_F(RasterToMeshTest, convertRasterToPrismMeshValue) ASSERT_TRUE(prop != nullptr); ASSERT_EQ(2 * _n_pix, prop->size()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<double>(*mesh, "test"); - ASSERT_TRUE(boost::none != bounds); + auto const& bounds = MeshLib::MeshInformation::getValueBounds(*prop); + ASSERT_TRUE(bounds.has_value()); ASSERT_NEAR(0, bounds->first, std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.07, bounds->second, std::numeric_limits<double>::epsilon()); @@ -217,9 +214,8 @@ TEST_F(RasterToMeshTest, convertRasterToHexMeshValue) ASSERT_TRUE(prop != nullptr); ASSERT_EQ(_n_pix, prop->size()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<int>(*mesh, "MaterialIDs"); - ASSERT_TRUE(boost::none != bounds); + auto const& bounds = MeshLib::MeshInformation::getValueBounds(*prop); + ASSERT_TRUE(bounds.has_value()); ASSERT_NEAR(0, bounds->first, std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0, bounds->second, std::numeric_limits<double>::epsilon()); @@ -276,9 +272,8 @@ TEST_F(RasterToMeshTest, vtkImage) ASSERT_TRUE(prop != nullptr); ASSERT_EQ(2 * _n_pix, prop->size()); - auto const& bounds = - MeshLib::MeshInformation::getValueBounds<double>(*mesh, "test"); - ASSERT_TRUE(boost::none != bounds); + auto const& bounds = MeshLib::MeshInformation::getValueBounds(*prop); + ASSERT_TRUE(bounds.has_value()); ASSERT_NEAR(0, bounds->first, std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.07, bounds->second, std::numeric_limits<float>::epsilon()); -- GitLab