Initialize the size of Unique_hash_map

This commit is contained in:
Andreas Fabri 2022-03-09 11:34:12 +00:00
parent e27855980a
commit cdbf0d7d9a
4 changed files with 14 additions and 13 deletions

View File

@ -4164,7 +4164,7 @@ Periodic_2_triangulation_2<Gt, Tds>::save(std::ostream& os) const
return os; return os;
// write the vertices // write the vertices
Unique_hash_map<Vertex_handle, std::size_t > V; Unique_hash_map<Vertex_handle, std::size_t > V(0, number_of_vertices());
std::size_t i = 0; std::size_t i = 0;
if (is_1_cover()) if (is_1_cover())
{ {
@ -4208,7 +4208,7 @@ Periodic_2_triangulation_2<Gt, Tds>::save(std::ostream& os) const
} }
CGAL_triangulation_postcondition(i == _cover[0]*_cover[1]*n); CGAL_triangulation_postcondition(i == _cover[0]*_cover[1]*n);
Unique_hash_map<Face_handle, std::size_t> F; Unique_hash_map<Face_handle, std::size_t> F(0, _tds.number_of_faces());
int inum = 0; int inum = 0;
// asks the tds for the combinatorial information // asks the tds for the combinatorial information
// vertices of the faces // vertices of the faces

View File

@ -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 // in Euclidean space and make a map from the vertices in remover.tmp
// towards the vertices in *this // towards the vertices in *this
Unique_hash_map<VertexE_handle,Vertex_handle> vmap; Unique_hash_map<VertexE_handle,Vertex_handle> vmap(Vertex_handle(), vertices_size());
CellE_handle ch; CellE_handle ch;
remover.tmp.clear(); remover.tmp.clear();
@ -4145,7 +4145,7 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3<GT,TDS>& tr)
return os; return os;
// write the vertices // write the vertices
Unique_hash_map<Vertex_handle, std::size_t > V; Unique_hash_map<Vertex_handle, std::size_t > V(0, tr.number_of_vertices());
std::size_t i=0; std::size_t i=0;
if(tr.is_1_cover()) { if(tr.is_1_cover()) {
for(Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { for(Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {

View File

@ -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) // Number of neighbors to set in each face (dim -1 has a single face)
const int nn = (std::max)(0, dimension() + 1); const int nn = (std::max)(0, dimension() + 1);
std::cout << "in copy_tds" << std::endl;
//initializes maps //initializes maps
Unique_hash_map<typename TDS_src::Vertex_handle,Vertex_handle> vmap; Unique_hash_map<typename TDS_src::Vertex_handle,Vertex_handle> vmap(Vertex_handle(), tds_src.number_of_vertices());
Unique_hash_map<typename TDS_src::Face_handle,Face_handle> fmap; Unique_hash_map<typename TDS_src::Face_handle,Face_handle> fmap(Face_handle(), tds_src.number_of_faces());
// create vertices // create vertices
typename TDS_src::Vertex_iterator vit1 = tds_src.vertices_begin(); 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(); else os << n << m << dimension();
if (n==0) return; if (n==0) return;
Unique_hash_map<Vertex_handle,int> V; Unique_hash_map<Vertex_handle,int> V(-1, number_of_vertices());
Unique_hash_map<Face_handle,int> F; Unique_hash_map<Face_handle,int> F(-1, number_of_faces());
// first vertex // 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\tcoord Coordinate {" << std::endl;
os << "\t\t\tpoint [" << std::endl; os << "\t\t\tpoint [" << std::endl;
Unique_hash_map<Vertex_handle,int> vmap; Unique_hash_map<Vertex_handle,int> vmap(-1, number_of_vertices());
Vertex_iterator vit; Vertex_iterator vit;
Face_iterator fit; Face_iterator fit;

View File

@ -2001,7 +2001,7 @@ operator<<(std::ostream& os, const Triangulation_data_structure_3<Vb,Cb,Ct> &tds
typedef typename Tds::Vertex_iterator Vertex_iterator; typedef typename Tds::Vertex_iterator Vertex_iterator;
Unique_hash_map<Vertex_handle, size_type> V; Unique_hash_map<Vertex_handle, size_type> V(0, tds.number_of_vertices());
// outputs dimension and number of vertices // outputs dimension and number of vertices
size_type n = tds.number_of_vertices(); size_type n = tds.number_of_vertices();
@ -2589,7 +2589,7 @@ void
Triangulation_data_structure_3<Vb,Cb,Ct>:: Triangulation_data_structure_3<Vb,Cb,Ct>::
print_cells(std::ostream& os, const Unique_hash_map<Vertex_handle, std::size_t> &V ) const print_cells(std::ostream& os, const Unique_hash_map<Vertex_handle, std::size_t> &V ) const
{ {
Unique_hash_map<Cell_handle, std::size_t > C; Unique_hash_map<Cell_handle, std::size_t > C(0, number_of_cells());
std::size_t i = 0; std::size_t i = 0;
switch ( dimension() ) { switch ( dimension() ) {
@ -4053,8 +4053,8 @@ copy_tds(const TDS_src& tds,
const int nn = (std::max)(0, dimension() + 1); const int nn = (std::max)(0, dimension() + 1);
// Initializes maps // Initializes maps
Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V; 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; Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F(Cell_handle(), tds.number_of_cells());
// Create the vertices. // Create the vertices.
for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin(); for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin();