Re-enable a test

This commit is contained in:
Mael Rouxel-Labbé 2025-03-24 12:11:27 +01:00
parent 9e2a59ee6a
commit dade66d8c4
2 changed files with 25 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#include "test_util.h"
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Isosurfacing_3/internal/implicit_shapes_helper.h>
@ -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<CGAL::Simple_cartesian<double> >();
//test_cube<CGAL::Epeck >();
test_cube<CGAL::Exact_predicates_inexact_constructions_kernel>();
std::cout << "Done" << std::endl;

View File

@ -103,6 +103,8 @@ void verify_euler() {
using Mesh = CGAL::Surface_mesh<Point>;
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<CGAL::Sequential_tag>(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<Point>;
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<CGAL::Sequential_tag>(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<K>();
verify_betti<K>();
//compare_to_reference<K>("data/MarchingCubes_cases/Grids/" + std::to_string(100) + "-scalar_field.iso");
// compare_to_reference<K>("data/Closed_Surfaces/Grids/" + std::to_string(0) + "-scalar_field.iso");
//compare_to_reference<K>("/path/to/data/MarchingCubes_cases/Grids/" + std::to_string(100) + "-scalar_field.iso");
// compare_to_reference<K>("/path/to/data/Closed_Surfaces/Grids/" + std::to_string(0) + "-scalar_field.iso");
}