From aa9e7cf34d217de7e53fe9fbefdcacbb72ab97dc Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Thu, 10 Mar 2022 18:24:07 +0000 Subject: [PATCH] Reserve hashtable size in polygon_mesh_to_nef_3 --- Nef_3/include/CGAL/Nef_3/SNC_simplify.h | 2 ++ Nef_3/include/CGAL/Nef_3/SNC_structure.h | 4 ++++ Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_simplify.h b/Nef_3/include/CGAL/Nef_3/SNC_simplify.h index 1b882bf5717..20e09259dce 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_simplify.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_simplify.h @@ -545,6 +545,8 @@ class SNC_simplify_base : public SNC_decorator { Unique_hash_map< SFace_handle, UFH_sface>& hash, Union_find< SFace_handle>& uf ) { Unique_hash_map< SHalfedge_handle, bool> linked(false, this->sncp()->number_of_shalfedges()); + this->sncp()->reserve_sm_boundary_items(this->sncp()->number_of_sfaces()); + SNC_decorator D(*this->sncp()); SHalfedge_iterator e; CGAL_forall_shalfedges(e, *this->sncp()) { diff --git a/Nef_3/include/CGAL/Nef_3/SNC_structure.h b/Nef_3/include/CGAL/Nef_3/SNC_structure.h index 4c58e22fbed..ee6be285256 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_structure.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_structure.h @@ -462,6 +462,10 @@ public: return *this; } + void reserve_sm_boundary_items(Size_type n) { + sm_boundary_item_.reserve(n); + } + void clear_boundary() { boundary_item_.clear(boost::none); sm_boundary_item_.clear(boost::none); diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index dea41f6eb00..b32a885e90d 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -205,7 +205,7 @@ void polygon_mesh_to_nef_3(PolygonMesh& P, SNC_structure& S, FaceIndexMap fimap, Face_graph_index_adder index_adder(P,himap); - + S.reserve_sm_boundary_items(num_vertices(P)); for(vertex_descriptor pv : vertices(P) ) { typename boost::property_traits::reference npv = get(pmap,pv);