TEST(MeshValidation, DetectHolesHex) { auto mesh = std::unique_ptr<MeshLib::Mesh>{ MeshLib::MeshGenerator::generateRegularHexMesh( 5,4,4,1.0,1.0,1.0,GeoLib::ORIGIN, "mesh")}; ASSERT_EQ(0, MeshLib::MeshValidation::detectHoles(*mesh)); detectHoles(*mesh, {27}, 1); detectHoles(*mesh, {28, 27}, 1); detectHoles(*mesh, {29, 27}, 1); }
TEST(MeshValidation, DetectHolesTri) { std::array<double, 12> pix = {{0,0.1,0.2,0.1,0,0,0.1,0,0,0,-0.1,0}}; GeoLib::Raster raster(4,3,0,0,1,pix.begin(), pix.end()); MeshLib::ConvertRasterToMesh conv(raster, MeshLib::MeshElemType::TRIANGLE, MeshLib::UseIntensityAs::ELEVATION); auto mesh = std::unique_ptr<MeshLib::Mesh>{conv.execute()}; ASSERT_EQ(0, MeshLib::MeshValidation::detectHoles(*mesh)); detectHoles(*mesh, {12}, 1); detectHoles(*mesh, {11, 11}, 1); detectHoles(*mesh, {10, 12}, 2); }
TEST(MeshValidation, DetectHolesTri) { std::array<double, 12> pix = {{0,0.1,0.2,0.1,0,0,0.1,0,0,0,-0.1,0}}; GeoLib::RasterHeader const header = {4,3,MathLib::Point3d(std::array<double,3>{{0,0,0}}),1,-9999}; GeoLib::Raster const raster(header ,pix.begin(), pix.end()); std::unique_ptr<MeshLib::Mesh> mesh (MeshLib::RasterToMesh::convert( raster, MeshLib::MeshElemType::TRIANGLE, MeshLib::UseIntensityAs::ELEVATION)); ASSERT_EQ(0, MeshLib::MeshValidation::detectHoles(*mesh)); detectHoles(*mesh, {12}, 1); detectHoles(*mesh, {11, 11}, 1); detectHoles(*mesh, {10, 12}, 2); }