mirror of https://github.com/CGAL/cgal
Merge /branches/features/Triangulation_23-speedup_copy_tds-afabri
"Use Unique_has_map instead of std::map (patch from Andreas Fabri)"
This commit is contained in:
commit
73583823bf
|
|
@ -3583,7 +3583,7 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3<GT,TDS> &tr)
|
|||
return os;
|
||||
|
||||
// write the vertices
|
||||
std::map<Vertex_handle, std::size_t > V;
|
||||
Unique_hash_map<Vertex_handle, std::size_t > V;
|
||||
std::size_t i=0;
|
||||
if (tr.is_1_cover()) {
|
||||
for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <algorithm>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_utils_2.h>
|
||||
|
||||
|
|
@ -286,7 +287,7 @@ public:
|
|||
Face_handle f1,
|
||||
Face_handle f2,
|
||||
Face_handle f3);
|
||||
void set_adjacency(Face_handle f0, int i0, Face_handle f1, int i1) const;
|
||||
void set_adjacency(Face_handle f0, int i0, Face_handle f1, int i1) const;
|
||||
void delete_face(Face_handle);
|
||||
void delete_vertex(Vertex_handle);
|
||||
|
||||
|
|
@ -1772,8 +1773,8 @@ copy_tds(const Tds &tds, Vertex_handle vh)
|
|||
if(n == 0) {return Vertex_handle();}
|
||||
|
||||
//initializes maps
|
||||
std::map<Vertex_handle,Vertex_handle> vmap;
|
||||
std::map<Face_handle,Face_handle> fmap;
|
||||
Unique_hash_map<Vertex_handle,Vertex_handle> vmap;
|
||||
Unique_hash_map<Face_handle,Face_handle> fmap;
|
||||
|
||||
// create vertices
|
||||
Vertex_iterator vit1 = tds.vertices_begin();
|
||||
|
|
@ -1825,8 +1826,9 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
|||
else os << n << m << dimension();
|
||||
if (n==0) return;
|
||||
|
||||
std::map<Vertex_handle,int> V;
|
||||
std::map<Face_handle,int> F;
|
||||
Unique_hash_map<Vertex_handle,int> V;
|
||||
Unique_hash_map<Face_handle,int> F;
|
||||
|
||||
|
||||
// first vertex
|
||||
int inum = 0;
|
||||
|
|
@ -1961,7 +1963,8 @@ vrml_output( std::ostream& os, Vertex_handle v, bool skip_infinite) const
|
|||
os << "\t\tcoord Coordinate {" << std::endl;
|
||||
os << "\t\t\tpoint [" << std::endl;
|
||||
|
||||
std::map<Vertex_handle,int> vmap;
|
||||
Unique_hash_map<Vertex_handle,int> vmap;
|
||||
|
||||
Vertex_iterator vit;
|
||||
Face_iterator fit;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <utility>
|
||||
#include <stack>
|
||||
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_utils_3.h>
|
||||
|
||||
|
|
@ -1571,7 +1572,7 @@ operator<< (std::ostream& os, const Triangulation_3<GT, Tds> &tr)
|
|||
CGAL_triangulation_assertion( i == n+1 );
|
||||
CGAL_triangulation_assertion( tr.is_infinite(TV[0]) );
|
||||
|
||||
std::map<Vertex_handle, std::size_t > V;
|
||||
Unique_hash_map<Vertex_handle, std::size_t > V;
|
||||
|
||||
V[tr.infinite_vertex()] = 0;
|
||||
for (i=1; i <= n; i++) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <CGAL/utility.h>
|
||||
#include <CGAL/iterator.h>
|
||||
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/Triangulation_utils_3.h>
|
||||
|
||||
|
|
@ -303,7 +304,7 @@ public:
|
|||
std::size_t & m, std::map< std::size_t, Cell_handle > &C );
|
||||
// not documented
|
||||
void print_cells(std::ostream& os,
|
||||
const std::map<Vertex_handle, std::size_t> &V ) const;
|
||||
const Unique_hash_map<Vertex_handle, std::size_t> &V ) const;
|
||||
|
||||
// ACCESS FUNCTIONS
|
||||
|
||||
|
|
@ -1332,7 +1333,8 @@ operator<<(std::ostream& os, const Triangulation_data_structure_3<Vb,Cb> &tds)
|
|||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Vertex_iterator Vertex_iterator;
|
||||
|
||||
std::map<Vertex_handle, size_type> V;
|
||||
|
||||
Unique_hash_map<Vertex_handle, size_type> V;
|
||||
|
||||
// outputs dimension and number of vertices
|
||||
size_type n = tds.number_of_vertices();
|
||||
|
|
@ -1915,7 +1917,7 @@ read_cells(std::istream& is, std::map< std::size_t, Vertex_handle > &V,
|
|||
template < class Vb, class Cb>
|
||||
void
|
||||
Triangulation_data_structure_3<Vb,Cb>::
|
||||
print_cells(std::ostream& os, const std::map<Vertex_handle, std::size_t> &V ) const
|
||||
print_cells(std::ostream& os, const Unique_hash_map<Vertex_handle, std::size_t> &V ) const
|
||||
{
|
||||
std::map<Cell_handle, std::size_t > C;
|
||||
std::size_t i = 0;
|
||||
|
|
@ -1935,14 +1937,14 @@ print_cells(std::ostream& os, const std::map<Vertex_handle, std::size_t> &V ) co
|
|||
C[it] = i++;
|
||||
for(int j = 0; j < 4; j++){
|
||||
if(is_ascii(os)) {
|
||||
os << V.find(it->vertex(j))->second;
|
||||
os << V[it->vertex(j)];
|
||||
if ( j==3 )
|
||||
os << std::endl;
|
||||
else
|
||||
os << ' ';
|
||||
}
|
||||
else
|
||||
write(os, V.find(it->vertex(j))->second);
|
||||
write(os, V[it->vertex(j)]);
|
||||
}
|
||||
}
|
||||
CGAL_triangulation_assertion( i == m );
|
||||
|
|
@ -1977,14 +1979,14 @@ print_cells(std::ostream& os, const std::map<Vertex_handle, std::size_t> &V ) co
|
|||
C[(*it).first] = i++;
|
||||
for(int j = 0; j < 3; j++){
|
||||
if(is_ascii(os)) {
|
||||
os << V.find((*it).first->vertex(j))->second;
|
||||
os << V[(*it).first->vertex(j)];
|
||||
if ( j==2 )
|
||||
os << std::endl;
|
||||
else
|
||||
os << ' ';
|
||||
}
|
||||
else {
|
||||
write(os, V.find((*it).first->vertex(j))->second);
|
||||
write(os, V[(*it).first->vertex(j)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2020,14 +2022,14 @@ print_cells(std::ostream& os, const std::map<Vertex_handle, std::size_t> &V ) co
|
|||
C[(*it).first] = i++;
|
||||
for(int j = 0; j < 2; j++){
|
||||
if(is_ascii(os)) {
|
||||
os << V.find((*it).first->vertex(j))->second;
|
||||
os << V[(*it).first->vertex(j)];
|
||||
if ( j==1 )
|
||||
os << std::endl;
|
||||
else
|
||||
os << ' ';
|
||||
}
|
||||
else {
|
||||
write(os, V.find((*it).first->vertex(j))->second);
|
||||
write(os, V[(*it).first->vertex(j)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3337,8 +3339,8 @@ copy_tds(const Tds & tds, Vertex_handle vert )
|
|||
|
||||
CGAL_triangulation_assertion( i == n );
|
||||
|
||||
std::map< Vertex_handle, Vertex_handle > V;
|
||||
std::map< Cell_handle, Cell_handle > F;
|
||||
Unique_hash_map<Vertex_handle, Vertex_handle> V;
|
||||
Unique_hash_map<Cell_handle, Cell_handle > F;
|
||||
|
||||
for (size_type i=0; i <= n-1; ++i)
|
||||
V[ TV[i] ] = create_vertex(TV[i]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue