diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 61701f552ae018905e7b1e29ba3f1cf41e761e2b..b8e46a38f0d3cea8e22d8a901d8177da74b57bec 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -96,15 +96,16 @@ void GEdge::resetMeshAttributes() meshAttributes.reverseMesh = false; } -void GEdge::addFace(GFace *e) +void GEdge::addFace(GFace *f) { - if (std::find(l_faces.begin(), l_faces.end(), e) == l_faces.end()) - l_faces.push_back(e); + if(std::find(l_faces.begin(), l_faces.end(), f) == l_faces.end()) + l_faces.push_back(f); } -void GEdge::delFace(GFace *e) +void GEdge::delFace(GFace *f) { - l_faces.erase(std::find(l_faces.begin(), l_faces.end(), e)); + std::list<GFace*>::iterator it = std::find(l_faces.begin(), l_faces.end(), f); + if(it != l_faces.end()) l_faces.erase(it); } SBoundingBox3d GEdge::bounds() const diff --git a/Geo/GFace.h b/Geo/GFace.h index fcaf029cb9b48bef250c8b0a360f6a45bf50c11c..b80a4335f5a0367d28696515612928880c88794d 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -95,8 +95,9 @@ class GFace : public GEntity // edges that bound the face virtual std::list<GEdge*> edges() const { return l_edges; } virtual std::list<int> edgeOrientations() const { return l_dirs; } - inline bool containsEdge (int iEdge) const { - for (std::list<GEdge*>::const_iterator it = l_edges.begin() ; it !=l_edges.end() ; ++it) + inline bool containsEdge (int iEdge) const + { + for (std::list<GEdge*>::const_iterator it = l_edges.begin(); it !=l_edges.end(); ++it) if ((*it)->tag() == iEdge) return true; return false; } diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index 42106a8e5d4a9103ed0d41b144011d5a3547e878..dd434f39732dcfa34555d6f1c85aa08db303e5b8 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -37,12 +37,14 @@ void GVertex::setPosition(GPoint &p) void GVertex::addEdge(GEdge *e) { - l_edges.push_back(e); + if(std::find(l_edges.begin(), l_edges.end(), e) == l_edges.end()) + l_edges.push_back(e); } void GVertex::delEdge(GEdge *e) { - l_edges.erase(std::find(l_edges.begin(), l_edges.end(), e)); + std::list<GEdge*>::iterator it = std::find(l_edges.begin(), l_edges.end(), e); + if(it != l_edges.end()) l_edges.erase(it); } SPoint2 GVertex::reparamOnFace(const GFace *gf, int) const @@ -94,13 +96,13 @@ bool GVertex::isOnSeam(const GFace *gf) const } // faces that bound this entity or that this entity bounds. -std::list<GFace*> GVertex::faces() const +std::list<GFace*> GVertex::faces() const { std::list<GEdge*>::const_iterator it = l_edges.begin(); std::set<GFace*> _f; for ( ; it != l_edges.end() ; ++it){ std::list<GFace*> temp = (*it)->faces(); - _f.insert (temp.begin(), temp.end()); + _f.insert (temp.begin(), temp.end()); } std::list<GFace*> ret; ret.insert (ret.begin(), _f.begin(), _f.end()); @@ -108,14 +110,14 @@ std::list<GFace*> GVertex::faces() const } // regions that bound this entity or that this entity bounds. -std::list<GRegion*> GVertex::regions() const +std::list<GRegion*> GVertex::regions() const { - std::list<GFace*> _faces = faces(); + std::list<GFace*> _faces = faces(); std::list<GFace*>::const_iterator it = _faces.begin(); std::set<GRegion*> _r; for ( ; it != _faces.end() ; ++it){ std::list<GRegion*> temp = (*it)->regions(); - _r.insert (temp.begin(), temp.end()); + _r.insert (temp.begin(), temp.end()); } std::list<GRegion*> ret; ret.insert (ret.begin(), _r.begin(), _r.end());