diff --git a/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp b/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp index 7e764052706..a6b53e4cf5e 100644 --- a/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp @@ -34,6 +34,8 @@ typedef DT::Vertex_handle Vertex_handle; typedef DT::Simplex Simplex; typedef DT::Segment_simplex_iterator Segment_simplex_iterator; +#include "test_triangulation_simplex_3_debug.h" + // a function to insert without spatial sorting template void insert(DT& dt, Point_it first, Point_it end) { @@ -41,62 +43,6 @@ void insert(DT& dt, Point_it first, Point_it end) { dt.insert(*first); } } -auto display_vert(Vertex_handle v) { - std::stringstream os; - os.precision(17); - if(v->time_stamp() == 0) { - os << "inf"; - } else { - os << '#' << v->time_stamp() << "=(" << v->point() << ")"; - } - return os.str(); -}; - -struct Debug_simplex { - Simplex simplex; - - template - friend - std::basic_ostream& - operator<<(std::basic_ostream& os, const Debug_simplex& d) { - auto&& simplex = d.simplex; - switch(simplex.dimension()) { - case 0: { - os << "- vertex " << display_vert(static_cast(simplex)); - break; - } - case 1: { - const auto [c, index1, index2] = static_cast(simplex); - os << "- edge " - << display_vert(c->vertex(index1)) << " - " - << display_vert(c->vertex(index2)); - break; - } - case 2: { - const auto [c, index] = static_cast(simplex); - os << "- facet " - << display_vert(c->vertex(DT::vertex_triple_index(index, 0))) << " - " - << display_vert(c->vertex(DT::vertex_triple_index(index, 1))) << " - " - << display_vert(c->vertex(DT::vertex_triple_index(index, 2))); - break; - } - case 3: { - const auto c = static_cast(simplex); - os << "- cell " - << display_vert(c->vertex(0)) << " - " - << display_vert(c->vertex(1)) << " - " - << display_vert(c->vertex(2)) << " - " - << display_vert(c->vertex(3)); - break; - } - default: CGAL_assume(false); - } - return os; - }; -}; -auto debug_simplex(Simplex simplex) { - return Debug_simplex{simplex}; -} static const std::vector bbox_points = { diff --git a/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp b/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp index 048581c0d90..506fd81022c 100644 --- a/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp @@ -1,5 +1,7 @@ +// #define CGAL_DEBUG_TRIANGULATION_SEGMENT_TRAVERSER_3 1 #include #include +#include #include #include @@ -17,14 +19,20 @@ typedef Kernel::Vector_3 Vector_3; typedef Kernel::Segment_3 Segment_3; // Define the structure. -typedef CGAL::Delaunay_triangulation_3< Kernel > DT; +typedef CGAL::Base_with_time_stamp> Vb; +typedef CGAL::Delaunay_triangulation_cell_base_3 Cb; +typedef CGAL::Triangulation_data_structure_3 Tds; +typedef CGAL::Delaunay_triangulation_3< Kernel, Tds > DT; typedef DT::Vertex_handle Vertex_handle; typedef DT::Cell_handle Cell_handle; typedef DT::Edge Edge; typedef DT::Facet Facet; +typedef DT::Simplex Simplex; typedef DT::Segment_simplex_iterator Segment_simplex_iterator; +#include "test_triangulation_simplex_3_debug.h" + void test_vertex_edge_vertex(const DT& dt, const std::size_t& nb_tests) { std::cout << "* test_vertex_edge_vertex *" << std::endl; @@ -299,8 +307,8 @@ void test_triangulation_on_a_grid() unsigned int nb_facets = 0, nb_edges = 0, nb_vertex = 0; for (; st != st.end(); ++st) { - std::cout << st->dimension() << " "; - std::cout.flush(); + std::cerr << st->dimension() << " "; + std::cerr << debug_simplex(*st) <<'\n'; if (st->dimension() == 3) { if (dt.is_infinite(Cell_handle(*st))) ++inf; diff --git a/Triangulation_3/test/Triangulation_3/test_triangulation_simplex_3_debug.h b/Triangulation_3/test/Triangulation_3/test_triangulation_simplex_3_debug.h new file mode 100644 index 00000000000..5ea79279b1c --- /dev/null +++ b/Triangulation_3/test/Triangulation_3/test_triangulation_simplex_3_debug.h @@ -0,0 +1,68 @@ +template +auto display_vert(Vertex_handle v) { + std::stringstream os; + os.precision(17); + if(v->time_stamp() == 0) { + os << "inf"; + } else { + os << '#' << v->time_stamp() << "=(" << v->point() << ")"; + } + return os.str(); +}; + +template +struct Debug_simplex { + using Cell_handle = typename DT::Cell_handle; + using Edge = typename DT::Edge; + using Facet = typename DT::Facet; + using Vertex_handle = typename DT::Vertex_handle; + using Simplex = typename DT::Simplex; + + Simplex simplex; + + template + friend + std::basic_ostream& + operator<<(std::basic_ostream& os, const Debug_simplex
& d) { + auto&& simplex = d.simplex; + switch(simplex.dimension()) { + case 0: { + os << "- vertex " << display_vert(static_cast(simplex)); + break; + } + case 1: { + const auto [c, index1, index2] = static_cast(simplex); + os << "- edge " + << display_vert(c->vertex(index1)) << " - " + << display_vert(c->vertex(index2)); + break; + } + case 2: { + const auto [c, index] = static_cast(simplex); + os << "- facet " + << display_vert(c->vertex(DT::vertex_triple_index(index, 0))) << " - " + << display_vert(c->vertex(DT::vertex_triple_index(index, 1))) << " - " + << display_vert(c->vertex(DT::vertex_triple_index(index, 2))); + break; + } + case 3: { + const auto c = static_cast(simplex); + os << "- cell " + << display_vert(c->vertex(0)) << " - " + << display_vert(c->vertex(1)) << " - " + << display_vert(c->vertex(2)) << " - " + << display_vert(c->vertex(3)); + break; + } + default: CGAL_assume(false); + } + return os; + }; +}; + +#include + +template +auto debug_simplex(CGAL::Triangulation_simplex_3 simplex) { + return Debug_simplex{simplex}; +}