From a04aebc766676aaaf97c7a0795070bb1588bfd9c Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 6 Apr 2020 17:33:24 +0200 Subject: [PATCH] Add a test for shortest cycle non contractible. --- .../test/Surface_mesh_topology/CMakeLists.txt | 1 + .../test_shortest_cycle_non_contractible.cpp | 144 ++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 Surface_mesh_topology/test/Surface_mesh_topology/test_shortest_cycle_non_contractible.cpp diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt index 3c0566d65bc..b01a228b068 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt @@ -36,6 +36,7 @@ set(SOURCE_FILES test_homotopy.cpp test_homotopy_with_polygonal_schema.cpp tests_path_on_surface.cpp + test_shortest_cycle_non_contractible.cpp ) foreach(cppfile ${SOURCE_FILES}) diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/test_shortest_cycle_non_contractible.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/test_shortest_cycle_non_contractible.cpp new file mode 100644 index 00000000000..48dbef23306 --- /dev/null +++ b/Surface_mesh_topology/test/Surface_mesh_topology/test_shortest_cycle_non_contractible.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace CGAL::Surface_mesh_topology; + +typedef CGAL::Surface_mesh::Point_3> SM; +typedef CGAL::Linear_cell_complex_for_combinatorial_map<2, 3> LCC_CM; +typedef CGAL::Linear_cell_complex_for_generalized_map<2, 3> LCC_GM; +typedef CGAL::Polyhedron_3 Poly; + +template +void load_lcc(LCC& lcc, const std::string& filename) +{ + std::ifstream inp(filename); + if (inp.fail()) + { + std::cout<<"Cannot read file '"< +void load_sm(SM& sm, const std::string& filename) +{ + std::ifstream inp(filename); + if (inp.fail()) + { + std::cout<<"Cannot read file '"<>sm; +} + +template +bool test_one_data_structure(const Mesh& mesh, std::size_t nbedges, double length) +{ + bool res=true; + + CGAL::Surface_mesh_topology::Euclidean_length_weight_functor wf(mesh); + CGAL::Surface_mesh_topology::Curves_on_surface_topology cst(mesh); + + std::cout<<"."< cycle=cst.compute_edgewidth(); + if (cycle.length()!=nbedges) + { + std::cout<<"[ERROR]: number of edges for the cycle is not minimal ("<"<length) + { + std::cout<<"[ERROR] length of the cycle is not minimal. ("<"<