From a6ae3b1ac165c4a9a2a0e45df2e419ae4404d0b6 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 15 Mar 2022 10:34:36 +0100 Subject: [PATCH] Rename and move stuff --- .../include/CGAL/Delaunay_mesh_face_base_2.h | 21 +------ .../Triangulation_2/polygon_triangulation.cpp | 2 +- Triangulation_2/include/CGAL/mark_domains.h | 60 +++++++++++++++---- 3 files changed, 49 insertions(+), 34 deletions(-) diff --git a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h index bb89e2b332d..a3e54124402 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesh_face_base_2.h @@ -19,29 +19,10 @@ #include #include -#include + namespace CGAL { -template -struct In_domain { - - typedef typename CDT::Face_handle key_type; - typedef bool value_type; - typedef bool reference; - typedef boost::read_write_property_map_tag category; - - friend bool get(In_domain, const key_type& k) - { - return k->is_in_domain(); - } - - friend void put(In_domain, const key_type& k, const value_type& v) - { - k->set_in_domain(v); - } -}; - template > diff --git a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp index f8834036d0a..5ee6705fa8e 100644 --- a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp @@ -45,7 +45,7 @@ int main( ) in_domain(in_domain_map); //Mark facets that are inside the domain bounded by the polygon - CGAL::mark_domains(cdt, in_domain); + CGAL::mark_domain_in_triangulation(cdt, in_domain); int count=0; for (Face_handle f : cdt.finite_face_handles()) diff --git a/Triangulation_2/include/CGAL/mark_domains.h b/Triangulation_2/include/CGAL/mark_domains.h index 4cc8c700fe1..030e4422117 100644 --- a/Triangulation_2/include/CGAL/mark_domains.h +++ b/Triangulation_2/include/CGAL/mark_domains.h @@ -9,27 +9,49 @@ // // Author(s) : Andreas Fabri -#ifndef CGAL_MARK_DOMAINS_H -#define CGAL_MARK_DOMAINS_H +#ifndef CGAL_MARK_DOMAIN_IN_TRIANGULATION_H +#define CGAL_MARK_DOMAIN_IN_TRIANGULATION_H #include #include #include +#include + #include namespace CGAL { +namespace internal { - template +template +struct In_domain { + + typedef typename CDT::Face_handle key_type; + typedef bool value_type; + typedef bool reference; + typedef boost::read_write_property_map_tag category; + + friend bool get(In_domain, const key_type& k) + { + return k->is_in_domain(); + } + + friend void put(In_domain, const key_type& k, const value_type& v) + { + k->set_in_domain(v); + } +}; + +template void -mark_domains(CDT& ct, - Unique_hash_map& nesting_level, - typename CDT::Face_handle start, - int index, - std::list& border, - InDomainPmap ipm) +mark_domain_in_triangulation(CDT& ct, + Unique_hash_map& nesting_level, + typename CDT::Face_handle start, + int index, + std::list& border, + InDomainPmap ipm) { typedef typename CDT::Face_handle Face_handle; typedef typename CDT::Edge Edge; @@ -60,6 +82,9 @@ mark_domains(CDT& ct, } } +} // namesapce internal + + //explore set of facets connected with non constrained edges, //and attribute to each such set a nesting level. //We start from facets incident to the infinite vertex, with a nesting @@ -68,7 +93,7 @@ mark_domains(CDT& ct, //Facets in the domain are those with an odd nesting level. template void -mark_domains(CDT& cdt, InDomainPmap ipm) +mark_domain_in_triangulation(CDT& cdt, InDomainPmap ipm) { typedef typename CDT::Face_handle Face_handle; typedef typename CDT::Edge Edge; @@ -80,17 +105,26 @@ mark_domains(CDT& cdt, InDomainPmap ipm) } std::list border; - mark_domains(cdt, nesting_level, cdt.infinite_face(), 0, border, ipm); + internal::mark_domain_in_triangulation(cdt, nesting_level, cdt.infinite_face(), 0, border, ipm); while(! border.empty()){ Edge e = border.front(); border.pop_front(); Face_handle n = e.first->neighbor(e.second); if(nesting_level[n] == -1){ - mark_domains(cdt, nesting_level, n, nesting_level[e.first]+1, border, ipm); + internal::mark_domain_in_triangulation(cdt, nesting_level, n, nesting_level[e.first]+1, border, ipm); } } } + +template +void +mark_domain_in_triangulation(CDT& cdt) +{ + internal::In_domain in_domain; + mark_domain_in_triangulation(cdt, in_domain); +} + } // namespace CGAL -#endif // CGAL_MARK_DOMAINS_H +#endif // CGAL_MARK_DOMAIN_IN_TRIANGULATION_H