mirror of https://github.com/CGAL/cgal
Avoid needless containers in TDS3::copy_tds()
This commit is contained in:
parent
1fc3050e0b
commit
8727fd17af
|
|
@ -4039,32 +4039,24 @@ copy_tds(const TDS_src& tds,
|
||||||
|| tds.is_vertex(vert) );
|
|| tds.is_vertex(vert) );
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
size_type n = tds.number_of_vertices();
|
|
||||||
set_dimension(tds.dimension());
|
set_dimension(tds.dimension());
|
||||||
|
|
||||||
if (n == 0) return Vertex_handle();
|
if(tds.number_of_vertices() == 0)
|
||||||
|
return Vertex_handle();
|
||||||
|
|
||||||
// Number of pointers to cell/vertex to copy per cell.
|
// Number of pointers to cell/vertex to copy per cell.
|
||||||
int dim = (std::max)(1, dimension() + 1);
|
const int dim = (std::max)(1, dimension() + 1);
|
||||||
|
|
||||||
// Create the vertices.
|
|
||||||
std::vector<typename TDS_src::Vertex_handle> TV(n);
|
|
||||||
size_type i = 0;
|
|
||||||
|
|
||||||
for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin();
|
|
||||||
vit != tds.vertices_end(); ++vit)
|
|
||||||
TV[i++] = vit;
|
|
||||||
|
|
||||||
CGAL_triangulation_assertion( i == n );
|
|
||||||
|
|
||||||
|
// Initializes maps
|
||||||
Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V;
|
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::Cell_handle,Cell_handle > F;
|
||||||
|
|
||||||
for (i=0; i <= n-1; ++i){
|
// Create the vertices.
|
||||||
Vertex_handle vh=create_vertex( convert_vertex(*TV[i]) );
|
for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin();
|
||||||
V[ TV[i] ] = vh;
|
vit != tds.vertices_end(); ++vit) {
|
||||||
convert_vertex(*TV[i],*vh);
|
Vertex_handle vh = create_vertex( convert_vertex(*vit) );
|
||||||
|
V[vit] = vh;
|
||||||
|
convert_vertex(*vit,*vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the cells.
|
// Create the cells.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue