From dade66d8c45d0ea211318e26a25f5f435bf36561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 24 Mar 2025 12:11:27 +0100 Subject: [PATCH] Re-enable a test --- .../test/Isosurfacing_3/test_tmc_csg.cpp | 6 ++-- .../test/Isosurfacing_3/verifier.cpp | 28 +++++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_tmc_csg.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_tmc_csg.cpp index b7e6b940f94..07af88abbf1 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_tmc_csg.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_tmc_csg.cpp @@ -1,7 +1,7 @@ #include "test_util.h" #include -#include +#include #include #include @@ -76,13 +76,13 @@ void test_cube() std::cout << "Output #vertices: " << points.size() << std::endl; std::cout << "Output #polygons: " << polygons.size() << std::endl; - CGAL::IO::write_polygon_soup("MC.off", points, polygons, CGAL::parameters::stream_precision(17)); + CGAL::IO::write_OFF("MC.off", points, polygons, CGAL::parameters::stream_precision(17)); } int main(int, char**) { test_cube >(); - //test_cube(); + test_cube(); std::cout << "Done" << std::endl; diff --git a/Isosurfacing_3/test/Isosurfacing_3/verifier.cpp b/Isosurfacing_3/test/Isosurfacing_3/verifier.cpp index b451f0e787d..4a2f0056236 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/verifier.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/verifier.cpp @@ -103,6 +103,8 @@ void verify_euler() { using Mesh = CGAL::Surface_mesh; + std::cout << " == Verify Euler ==" << std::endl; + const std::size_t num_tests = 10000; for (std::size_t i = 0; i < num_tests; i++) { @@ -110,12 +112,18 @@ void verify_euler() { Values values { grid }; Domain domain { grid, values }; - read_iso_volume("data/MarchingCubes_cases/Grids/" + std::to_string(i) + "-scalar_field.iso", grid, values); + std::string filename = "/path/to/data/MarchingCubes_cases/Grids/" + std::to_string(i) + "-scalar_field.iso"; + + std::cout << "Verify " << filename << "..." << std::endl; + + read_iso_volume(filename, grid, values); Point_range points; Polygon_range triangles; IS::marching_cubes(domain, 0, points, triangles, CGAL::parameters::use_topologically_correct_marching_cubes(true)); + CGAL::IO::write_polygon_soup("last_result.off", points, triangles); + assert(points.size() && triangles.size()); assert(!has_duplicate_points(points, triangles)); assert(!has_duplicate_polygons(points, triangles)); @@ -126,7 +134,7 @@ void verify_euler() { CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, m); const int euler = euler_characteristic(m); - const int solution = read_euler("data/MarchingCubes_cases/Grid_invariants/" + std::to_string(i) + "-euler_number.txt"); + const int solution = read_euler("/path/to/data/MarchingCubes_cases/Grid_invariants/" + std::to_string(i) + "-euler_number.txt"); if (euler != solution) std::cout << "error in test " << i << ": euler " << euler << " != " << solution << std::endl; @@ -149,6 +157,8 @@ void verify_betti() { using Mesh = CGAL::Surface_mesh; + std::cout << " == Verify Betti ==" << std::endl; + const std::size_t num_tests = 10000; for (std::size_t i = 0; i < num_tests; i++) { @@ -157,12 +167,18 @@ void verify_betti() { Values values { grid }; Domain domain { grid, values }; - read_iso_volume("data/Closed_Surfaces/Grids/" + std::to_string(i) + "-scalar_field.iso", grid, values); + std::string filename = "/path/to/data/Closed_Surfaces/Grids/" + std::to_string(i) + "-scalar_field.iso"; + + std::cout << "Verify " << filename << "..." << std::endl; + + read_iso_volume(filename, grid, values); Point_range points; Polygon_range triangles; IS::marching_cubes(domain, 0, points, triangles, CGAL::parameters::use_topologically_correct_marching_cubes(true)); + CGAL::IO::write_polygon_soup("last_result.off", points, triangles); + assert(points.size() && triangles.size()); assert(!has_duplicate_points(points, triangles)); assert(!has_duplicate_polygons(points, triangles)); @@ -174,7 +190,7 @@ void verify_betti() { const int b0 = betti_0(m); const int b1 = betti_1(m); - const auto solution = read_betti("data/Closed_Surfaces/InvariantsGrid/" + std::to_string(i) + "-invariant_grid.txt"); + const auto solution = read_betti("/path/to/data/Closed_Surfaces/InvariantsGrid/" + std::to_string(i) + "-invariant_grid.txt"); if (b0 != solution[0]) std::cout << "error in test " << i << ": b0 " << b0 << " != " << solution[0] << std::endl; @@ -232,6 +248,6 @@ int main(int, char**) verify_euler(); verify_betti(); - //compare_to_reference("data/MarchingCubes_cases/Grids/" + std::to_string(100) + "-scalar_field.iso"); - // compare_to_reference("data/Closed_Surfaces/Grids/" + std::to_string(0) + "-scalar_field.iso"); + //compare_to_reference("/path/to/data/MarchingCubes_cases/Grids/" + std::to_string(100) + "-scalar_field.iso"); + // compare_to_reference("/path/to/data/Closed_Surfaces/Grids/" + std::to_string(0) + "-scalar_field.iso"); } \ No newline at end of file