Fixed pending VC8 STL iterator issues

This commit is contained in:
Fernando Cacciola 2007-02-06 14:14:16 +00:00
parent 70c736d388
commit f91efc4810
5 changed files with 88 additions and 69 deletions

View File

@ -1958,15 +1958,26 @@ public:
CGAL_NEF_TRACEN("");
}
std::vector<Vertex_iterator> vertices_to_delete ;
Vertex_iterator v;
CGAL_forall_vertices(v, *this->sncp())
if(erase_vertex[v]) {
{
if(erase_vertex[v])
{
CGAL_NEF_TRACEN("erase " << v->point());
if(Infi_box::is_infibox_corner(v->point()))
recreate.push_back(v->point());
this->sncp()->delete_vertex(v);
vertices_to_delete.push_back(v);
res = true;
}
}
for( typename std::vector<Vertex_iterator>::iterator vit = vertices_to_delete.begin()
; vit != vertices_to_delete.end()
; ++ vit
)
this->sncp()->delete_vertex(*vit);
typename std::list<Point_3>::const_iterator pi;
for(pi = recreate.begin(); pi != recreate.end(); ++pi)

View File

@ -1459,8 +1459,8 @@ class SNC_decorator : public SNC_const_decorator<Map> {
Shell_entry_iterator si;
CGAL_forall_shells_of(si,voli) {
valid = valid && (si != Shell_entry_iterator() &&
SFace_handle(si) != SFace_handle() &&
//valid = valid && (si != Shell_entry_iterator() &&
valid = valid && (SFace_handle(si) != SFace_handle() &&
SFace_handle(si) != NULL);
valid = valid && (++count <= max);
}

View File

@ -1079,13 +1079,13 @@ void SNC_io_parser<EW>::read()
addInfiBox = (kernel_type == "standard" && Infi_box::extended_kernel());
if(addInfiBox) {
Vertex_of.reserve(vn+8);
Edge_of.reserve(en+24);
Halffacet_of.reserve(fn+12);
Volume_of.reserve(cn+1);
SEdge_of.reserve(sen+48);
SLoop_of.reserve(sln);
SFace_of.reserve(sfn+16);
Vertex_of.resize(vn+8);
Edge_of.resize(en+24);
Halffacet_of.resize(fn+12);
Volume_of.resize(cn+1);
SEdge_of.resize(sen+48);
SLoop_of.resize(sln);
SFace_of.resize(sfn+16);
for(i=0; i<vn+8; ++i) Vertex_of[i] = this->sncp()->new_vertex_only();
for(i=0; i<en+24; ++i) Edge_of[i] = this->sncp()->new_halfedge_only();
for(i=0; i<fn+12; ++i) Halffacet_of[i] = this->sncp()->new_halffacet_only();
@ -1095,13 +1095,13 @@ void SNC_io_parser<EW>::read()
for(i=0; i<sfn+16; ++i) SFace_of[i] = this->sncp()->new_sface_only();
}
else {
Vertex_of.reserve(vn);
Edge_of.reserve(en);
Halffacet_of.reserve(fn);
Volume_of.reserve(cn);
SEdge_of.reserve(sen);
SLoop_of.reserve(sln);
SFace_of.reserve(sfn);
Vertex_of.resize(vn);
Edge_of.resize(en);
Halffacet_of.resize(fn);
Volume_of.resize(cn);
SEdge_of.resize(sen);
SLoop_of.resize(sln);
SFace_of.resize(sfn);
for(i=0; i<vn; ++i) Vertex_of[i] = this->sncp()->new_vertex_only();
for(i=0; i<en; ++i) Edge_of[i] = this->sncp()->new_halfedge_only();
for(i=0; i<fn; ++i) Halffacet_of[i] = this->sncp()->new_halffacet_only();

View File

@ -156,7 +156,13 @@ class SNC_simplify : public SNC_decorator<SNC_structure> {
if(fc.is_shalfedge() ) {
SHalfedge_handle e(fc);
SHalfedge_around_facet_circulator u(e), eend(e);
CGAL_For_all(u, eend) {
//CGAL_For_all(u, eend) {
for ( bool _circ_loop_flag = ! ::CGAL::is_empty_range( u, eend);
_circ_loop_flag; \
_circ_loop_flag = ( u != eend )
)
{
SFace_handle fu = u->incident_sface(), ftu = u->twin()->incident_sface();
CGAL_NEF_TRACEN("sfUNION of "<<IO->index(fu)<<" & "<<IO->index(ftu));
merge_sets( fu, ftu, hash, uf);
@ -169,14 +175,15 @@ class SNC_simplify : public SNC_decorator<SNC_structure> {
SD.set_face( tgt, fu);
/* TO VERIFY: does is_closed_at_source(u) imply is_isolated(src)?
if it is true, the svertex face update is not necesary. */
SHalfedge_around_facet_circulator next = u ;
++ next ;
SD.delete_edge_pair(u);
if( SD.is_isolated(src))
// SD.delete_vertex_only(src);
SD.set_face(src,fu);
SM_decorator SD2(&*tgt->source());
if( SD2.is_isolated(tgt))
// SD.delete_vertex_only(tgt);
SD2.set_face(tgt,fu);
u = next ;
/* TO VERIFY: can both svertices be isolated at the same time? */
}
}
@ -458,9 +465,10 @@ class SNC_simplify : public SNC_decorator<SNC_structure> {
CGAL_NEF_TRACEN("s2 = " << IO->index(s2));
if( s1 == s2) {
CGAL_NEF_TRACEN(IO->index(s1)<<'('<<IO->index(s2->twin())<<") to sloop");
Halffacet_handle facet = s1->facet();
SD.convert_edge_to_loop(s1);
CGAL_assertion(SD.shalfloop() != SHalfloop_handle());
D.add_sloop_to_facet( SD.shalfloop(), s1->facet());
D.add_sloop_to_facet( SD.shalfloop(), facet);
CGAL_NEF_TRACEN(IO->index(s2)<<" removed");
}
else {

View File

@ -40,6 +40,9 @@
#include <CGAL/Nef_2/debug.h>
#include <CGAL/Nef_2/Object_index.h>
#include <boost/optional.hpp>
#include <boost/none.hpp>
CGAL_BEGIN_NAMESPACE
template <typename HE>
@ -691,13 +694,13 @@ public:
expensive operation.}*/
SNC_structure() :
boundary_item_(undef_), sm_boundary_item_(undef_),
boundary_item_(boost::none), sm_boundary_item_(boost::none),
vertices_(), halfedges_(), halffacets_(), volumes_(),
shalfedges_(), shalfloops_(), sfaces_() {}
~SNC_structure() { CGAL_NEF_TRACEN("~SNC_structure: clearing "<<this); clear(); }
SNC_structure(const Self& D) :
boundary_item_(undef_), sm_boundary_item_(undef_),
boundary_item_(boost::none), sm_boundary_item_(boost::none),
vertices_(D.vertices_), halfedges_(D.halfedges_),
halffacets_(D.halffacets_), volumes_(D.volumes_),
shalfedges_(D.shalfedges_), shalfloops_(D.shalfloops_),
@ -708,8 +711,8 @@ public:
if ( this == &D )
return *this;
clear();
boundary_item_.clear(undef_);
sm_boundary_item_.clear(undef_);
boundary_item_.clear(boost::none);
sm_boundary_item_.clear(boost::none);
vertices_ = D.vertices_;
halfedges_ = D.halfedges_;
halffacets_ = D.halffacets_;
@ -722,17 +725,17 @@ public:
}
void clear_boundary() {
boundary_item_.clear(undef_);
sm_boundary_item_.clear(undef_);
boundary_item_.clear(boost::none);
sm_boundary_item_.clear(boost::none);
}
void clear_snc_boundary() {
boundary_item_.clear(undef_);
boundary_item_.clear(boost::none);
}
void clear() {
boundary_item_.clear(undef_);
sm_boundary_item_.clear(undef_);
boundary_item_.clear(boost::none);
sm_boundary_item_.clear(boost::none);
vertices_.destroy();
halfedges_.destroy();
halffacets_.destroy();
@ -744,17 +747,17 @@ public:
template <typename H>
bool is_boundary_object(H h)
{ return boundary_item_[h]!=undef_; }
{ return boundary_item_[h]!=boost::none; }
template <typename H>
bool is_sm_boundary_object(H h)
{ return sm_boundary_item_[h]!=undef_; }
{ return sm_boundary_item_[h]!=boost::none; }
template <typename H>
Object_iterator& boundary_item(H h)
{ return boundary_item_[h]; }
{ return *boundary_item_[h]; }
template <typename H>
Object_iterator& sm_boundary_item(H h)
{ return sm_boundary_item_[h]; }
{ return *sm_boundary_item_[h]; }
template <typename H>
void store_boundary_item(H h, Object_iterator o)
@ -765,12 +768,12 @@ public:
template <typename H>
void undef_boundary_item(H h)
{ CGAL_assertion(boundary_item_[h]!=undef_);
boundary_item_[h] = undef_; }
{ CGAL_assertion(boundary_item_[h]!=boost::none);
boundary_item_[h] = boost::none; }
template <typename H>
void undef_sm_boundary_item(H h)
{ CGAL_assertion(sm_boundary_item_[h]!=undef_);
sm_boundary_item_[h] = undef_; }
{ CGAL_assertion(sm_boundary_item_[h]!=boost::none);
sm_boundary_item_[h] = boost::none; }
void reset_iterator_hash(Object_iterator it)
{ SVertex_handle sv;
@ -1335,9 +1338,11 @@ public:
protected:
void pointer_update(const Self& D);
static Object_iterator undef_;
Generic_handle_map<Object_iterator> boundary_item_;
Generic_handle_map<Object_iterator> sm_boundary_item_;
typedef boost::optional<Object_iterator> Optional_object_iterator ;
Generic_handle_map<Optional_object_iterator> boundary_item_;
Generic_handle_map<Optional_object_iterator> sm_boundary_item_;
Vertex_list vertices_;
Halfedge_list halfedges_;
@ -1483,10 +1488,5 @@ pointer_update(const SNC_structure<Kernel,Items,Mark>& D)
}
}
template <typename Kernel, typename Items, typename Mark>
typename SNC_structure<Kernel, Items, Mark>::Object_iterator
SNC_structure<Kernel,Items,Mark>::undef_;
CGAL_END_NAMESPACE
#endif // CGAL_SNC_STRUCTURE_H