From cdbf0d7d9a12ca290813adfe5c1a039c2e8516fc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 11:34:12 +0000 Subject: [PATCH 1/6] Initialize the size of Unique_hash_map --- .../include/CGAL/Periodic_2_triangulation_2.h | 4 ++-- .../include/CGAL/Periodic_3_triangulation_3.h | 4 ++-- TDS_2/include/CGAL/Triangulation_data_structure_2.h | 11 ++++++----- TDS_3/include/CGAL/Triangulation_data_structure_3.h | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h index 542fcb98d3d..4104f5d9923 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h @@ -4164,7 +4164,7 @@ Periodic_2_triangulation_2::save(std::ostream& os) const return os; // write the vertices - Unique_hash_map V; + Unique_hash_map V(0, number_of_vertices()); std::size_t i = 0; if (is_1_cover()) { @@ -4208,7 +4208,7 @@ Periodic_2_triangulation_2::save(std::ostream& os) const } CGAL_triangulation_postcondition(i == _cover[0]*_cover[1]*n); - Unique_hash_map F; + Unique_hash_map F(0, _tds.number_of_faces()); int inum = 0; // asks the tds for the combinatorial information // vertices of the faces diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index a80c3995d5c..c5bfcff1431 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -3205,7 +3205,7 @@ periodic_remove(Vertex_handle v, PointRemover& remover, CoverManager& cover_mana // in Euclidean space and make a map from the vertices in remover.tmp // towards the vertices in *this - Unique_hash_map vmap; + Unique_hash_map vmap(Vertex_handle(), vertices_size()); CellE_handle ch; remover.tmp.clear(); @@ -4145,7 +4145,7 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3& tr) return os; // write the vertices - Unique_hash_map V; + Unique_hash_map V(0, tr.number_of_vertices()); std::size_t i=0; if(tr.is_1_cover()) { for(Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { diff --git a/TDS_2/include/CGAL/Triangulation_data_structure_2.h b/TDS_2/include/CGAL/Triangulation_data_structure_2.h index e9aea5691c9..77f58af1644 100644 --- a/TDS_2/include/CGAL/Triangulation_data_structure_2.h +++ b/TDS_2/include/CGAL/Triangulation_data_structure_2.h @@ -2008,9 +2008,10 @@ copy_tds(const TDS_src& tds_src, // Number of neighbors to set in each face (dim -1 has a single face) const int nn = (std::max)(0, dimension() + 1); + std::cout << "in copy_tds" << std::endl; //initializes maps - Unique_hash_map vmap; - Unique_hash_map fmap; + Unique_hash_map vmap(Vertex_handle(), tds_src.number_of_vertices()); + Unique_hash_map fmap(Face_handle(), tds_src.number_of_faces()); // create vertices typename TDS_src::Vertex_iterator vit1 = tds_src.vertices_begin(); @@ -2120,8 +2121,8 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const else os << n << m << dimension(); if (n==0) return; - Unique_hash_map V; - Unique_hash_map F; + Unique_hash_map V(-1, number_of_vertices()); + Unique_hash_map F(-1, number_of_faces()); // first vertex @@ -2257,7 +2258,7 @@ vrml_output( std::ostream& os, Vertex_handle v, bool skip_infinite) const os << "\t\tcoord Coordinate {" << std::endl; os << "\t\t\tpoint [" << std::endl; - Unique_hash_map vmap; + Unique_hash_map vmap(-1, number_of_vertices()); Vertex_iterator vit; Face_iterator fit; diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 9b164cb726a..89e237cc0d4 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -2001,7 +2001,7 @@ operator<<(std::ostream& os, const Triangulation_data_structure_3 &tds typedef typename Tds::Vertex_iterator Vertex_iterator; - Unique_hash_map V; + Unique_hash_map V(0, tds.number_of_vertices()); // outputs dimension and number of vertices size_type n = tds.number_of_vertices(); @@ -2589,7 +2589,7 @@ void Triangulation_data_structure_3:: print_cells(std::ostream& os, const Unique_hash_map &V ) const { - Unique_hash_map C; + Unique_hash_map C(0, number_of_cells()); std::size_t i = 0; switch ( dimension() ) { @@ -4053,8 +4053,8 @@ copy_tds(const TDS_src& tds, const int nn = (std::max)(0, dimension() + 1); // Initializes maps - Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V; - Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F; + Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V(Vertex_handle(), tds.number_of_vertices()); + Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F(Cell_handle(), tds.number_of_cells()); // Create the vertices. for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin(); From 4eac47f27445ac7eeae0f6fcd521f81fabe5e04d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 12:57:23 +0000 Subject: [PATCH 2/6] fix typo --- .../include/CGAL/Periodic_3_triangulation_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index c5bfcff1431..6c9e6936070 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -3205,7 +3205,7 @@ periodic_remove(Vertex_handle v, PointRemover& remover, CoverManager& cover_mana // in Euclidean space and make a map from the vertices in remover.tmp // towards the vertices in *this - Unique_hash_map vmap(Vertex_handle(), vertices_size()); + Unique_hash_map vmap(Vertex_handle(), vertices.size()); CellE_handle ch; remover.tmp.clear(); From 7a1aaa40b4d8ddefeb30004cd583aa0a76a9a065 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 13:11:19 +0000 Subject: [PATCH 3/6] Clean up Skin_surface as Unique_hash_map is not used at all --- Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h | 7 ------- Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h | 6 ------ 2 files changed, 13 deletions(-) diff --git a/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h b/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h index 92bfb84c326..0acd869717c 100644 --- a/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h +++ b/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h @@ -15,7 +15,6 @@ #include -// #include #include #include @@ -254,12 +253,6 @@ private: struct Index_c4 { Tmc_Vertex_handle V[4]; }; struct Index_c6 { Tmc_Vertex_handle V[6]; }; struct Index_c44 { Tmc_Vertex_handle V[4][4]; }; - struct Index_v { - Unique_hash_map < Rt_Vertex_handle, Tmc_Vertex_handle > V; - }; - - // index to vertex - Unique_hash_map < Rt_Cell_handle, Index_c4 > index_03; Union_find_anchor anchor_del_uf, anchor_vor_uf; Simplex_UF_map anchor_del_map, anchor_vor_map; diff --git a/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h b/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h index a08af55b822..1dd5909d648 100644 --- a/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h +++ b/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h @@ -209,12 +209,6 @@ private: struct Index_c4 { Tmc_Vertex_handle V[4]; }; struct Index_c6 { Tmc_Vertex_handle V[6]; }; struct Index_c44 { Tmc_Vertex_handle V[4][4]; }; - struct Index_v { - Unique_hash_map < Rt_Vertex_handle, Tmc_Vertex_handle > V; - }; - - // index to vertex - Unique_hash_map < Rt_Cell_handle, Index_c4 > index_03; Union_find_anchor anchor_vor_uf; Simplex_UF_map anchor_vor_map; From 2a513a01955c28e3ee503868960a7a9fb8075bb3 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 13:23:07 +0000 Subject: [PATCH 4/6] Clean up Straight_skeleton as Unique_hash_map is not used at all --- .../CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h index 6d15298d618..c2abf5e77ca 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h @@ -15,7 +15,6 @@ #include #include -#include #include #include From 48c462bf7283bd0f33370d04738420577e655f2b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 13:46:55 +0000 Subject: [PATCH 5/6] Change in CDTplus --- Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index 95e0b4befc7..fe11801fddd 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -633,7 +633,7 @@ public: file_output(std::ostream& os) const { os << static_cast(*this); - Unique_hash_map V; + Unique_hash_map V(0, number_of_vertices()); int inum = 0; for(Vertex_iterator vit = vertices_begin(); vit != vertices_end() ; ++vit){ if(! is_infinite(vit)){ From f3db661acb231852de74da2c23e28445a086c894 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Mar 2022 14:13:31 +0000 Subject: [PATCH 6/6] Deal a little bit with Linear_cell_complex and Combinatorial_map --- Combinatorial_map/include/CGAL/Combinatorial_map.h | 2 +- .../properties_Linear_cell_complex_for_combinatorial_map.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 32ea6e66ad5..5c40289dcfd 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -3376,7 +3376,7 @@ namespace CGAL { CGAL_assertion( is_without_boundary(dimension) ); CGAL::Unique_hash_map< Dart_handle, Dart_handle, - typename Self::Hash_function > dual; + typename Self::Hash_function > dual(Dart_handle(), darts().size()); Dart_handle d, d2, res = amap.null_handle; // We clear amap. TODO return a new amap ? diff --git a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h index e69acbd8354..2689f86253c 100644 --- a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h @@ -16,7 +16,6 @@ #include #include -#include #include