From b9c1843071470f00ef623fdf253692cd702ca392 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 3 Mar 2017 07:43:16 +0000 Subject: [PATCH] order the set for CombinedBoundary as we did it before in Geo.cpp --- Geo/GModel.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 25aa269c9a..d1673690f6 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -437,6 +437,15 @@ void GModel::getEntitiesInBox(std::vector<GEntity*> &entities, SBoundingBox3d bo } } +class AbsIntLessThan{ + public: + bool operator()(const int &i1, const int &i2) const + { + if(std::abs(i1) < std::abs(i2)) return true; + return false; + } +}; + void GModel::getBoundaryTags(const std::vector<std::pair<int, int> > &inDimTags, std::vector<std::pair<int, int> > &outDimTags, bool combined, bool oriented) @@ -495,18 +504,16 @@ void GModel::getBoundaryTags(const std::vector<std::pair<int, int> > &inDimTags, if(combined){ // compute boundary of the combined shapes - std::set<int> c[3]; + std::set<int, AbsIntLessThan> c[3]; for(unsigned int i = 0; i < outDimTags.size(); i++){ int dim = outDimTags[i].first; int tag = outDimTags[i].second; if(dim >= 0 && dim < 3){ std::set<int>::iterator it = c[dim].find(tag); - std::set<int>::iterator itr = (oriented ? c[dim].find(-tag) : c[dim].end()); - if(it == c[dim].end() && itr == c[dim].end()) + if(it == c[dim].end()) c[dim].insert(tag); else{ - if(it != c[dim].end()) c[dim].erase(it); - if(oriented && itr != c[dim].end()) c[dim].erase(itr); + c[dim].erase(it); } } } -- GitLab