From 87d114137f992a055cd0f51d720c0bec7deed633 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 7 Feb 2021 09:52:45 +0000 Subject: [PATCH 1/2] Calculate indices only when required in check_integrity_and_topological_planarity --- .../include/CGAL/Nef_S2/SM_const_decorator.h | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h index 74b16be98ae..dac5514735f 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h @@ -273,36 +273,51 @@ The macros are then |CGAL_forall_svertices(v,M)|, |CGAL_forall_sfaces(f,M)|, |CGAL_forall_sface_cycles_of(fc,F)| where |M| is a sphere map and |F| is a sface.}*/ +private: +std::string get_svertex_index(SVertex_const_handle) const; +std::string get_shalfedge_index(SHalfedge_const_handle e) const; + }; // SM_const_decorator +template +std::string SM_const_decorator:: +get_svertex_index(SVertex_const_handle v) const +{ + Object_index + VI(svertices_begin(),svertices_end(),'v'); + return VI(v); +} + +template +std::string SM_const_decorator:: +get_shalfedge_index(SHalfedge_const_handle e) const +{ + Object_index + EI(shalfedges_begin(),shalfedges_end(),'e'); + return EI(e); +} + template void SM_const_decorator:: check_integrity_and_topological_planarity(bool faces) const { CGAL_NEF_TRACEN("check_integrity_and_topological_planarity:"); - using CGAL::Object_index; - Object_index - VI(svertices_begin(),svertices_end(),'v'); - Object_index - EI(shalfedges_begin(),shalfedges_end(),'e'); - Object_index - FI(sfaces_begin(),sfaces_end(),'f'); + SVertex_const_handle v; int iso_vert_num=0; /* check the source links of out edges and count isolated vertices */ CGAL_forall_svertices(v,*this) { if ( is_isolated(v) ) { if ( faces ) - CGAL_assertion_msg(v->incident_sface() != SFace_const_handle(), VI(v).c_str()); + CGAL_assertion_msg(v->incident_sface() != SFace_const_handle(), get_svertex_index(v).c_str()); ++iso_vert_num; } else { - CGAL_assertion_msg(first_out_edge(v) != SHalfedge_const_handle(), - VI(v).c_str()); - CGAL_NEF_TRACEN(v->point()<<" "<source() == v, - VI(v).c_str()); + CGAL_assertion_code(SHalfedge_const_handle e=first_out_edge(v)); + CGAL_assertion_msg(e != SHalfedge_const_handle(), get_svertex_index(v).c_str()); + CGAL_NEF_TRACEN(v->point()<<" "<source() == v, get_svertex_index(v).c_str()); } } From 9c6712c3b127478de882577229aec8d1bb2105c2 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Mon, 8 Feb 2021 19:32:33 +0000 Subject: [PATCH 2/2] Calculate indices correctly when trace enabled --- Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h index dac5514735f..fe38af9ab44 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h @@ -275,7 +275,6 @@ where |M| is a sphere map and |F| is a sface.}*/ private: std::string get_svertex_index(SVertex_const_handle) const; -std::string get_shalfedge_index(SHalfedge_const_handle e) const; }; // SM_const_decorator @@ -290,21 +289,15 @@ get_svertex_index(SVertex_const_handle v) const return VI(v); } -template -std::string SM_const_decorator:: -get_shalfedge_index(SHalfedge_const_handle e) const -{ - Object_index - EI(shalfedges_begin(),shalfedges_end(),'e'); - return EI(e); -} - template void SM_const_decorator:: check_integrity_and_topological_planarity(bool faces) const { CGAL_NEF_TRACEN("check_integrity_and_topological_planarity:"); - +#ifdef CGAL_USE_TRACE + Object_index + EI(shalfedges_begin(),shalfedges_end(),'e'); +#endif SVertex_const_handle v; int iso_vert_num=0; /* check the source links of out edges and count isolated vertices */ @@ -316,7 +309,7 @@ check_integrity_and_topological_planarity(bool faces) const } else { CGAL_assertion_code(SHalfedge_const_handle e=first_out_edge(v)); CGAL_assertion_msg(e != SHalfedge_const_handle(), get_svertex_index(v).c_str()); - CGAL_NEF_TRACEN(v->point()<<" "<point()<<" "<source() == v, get_svertex_index(v).c_str()); } }