diff --git a/Geo/Cell.cpp b/Geo/Cell.cpp index ae9edf9f988dcd1723abbf1e428efc176c8e1ecd..0c38a43c68176a43da350c7d69f070118edfa9db 100755 --- a/Geo/Cell.cpp +++ b/Geo/Cell.cpp @@ -29,12 +29,6 @@ bool Less_Cell::operator()(const Cell* c1, const Cell* c2) const return false; } -bool Less_VertexNumIndex::operator()(const std::pair<MVertex*, int> v1, - const std::pair<MVertex*, int> v2) const -{ - return (v1.first->getNum() < v2.first->getNum()); -} - int Cell::_globalNum = 0; Cell::Cell(MElement* element, int domain) @@ -65,15 +59,14 @@ Cell::Cell(Cell* parent, int i) void Cell::_sortVertexIndices() { - std::vector< std::pair<MVertex*, int> > si; + std::map<MVertex*, int, MVertexLessThanNum> si; for(unsigned int i = 0; i < _v.size(); i++) - si.push_back( std::make_pair(_v[i], i) ); - - std::sort(si.begin(), si.end(), Less_VertexNumIndex()); + si[_v[i]] = i; - for(unsigned int i = 0; i < si.size(); i++) - _si.push_back(si[i].second); + std::map<MVertex*, int, MVertexLessThanNum>::iterator it; + for(it = si.begin(); it != si.end(); it++) + _si.push_back(it->second); } inline int Cell::getSortedVertex(int vertex) const diff --git a/Geo/Cell.h b/Geo/Cell.h index da83de9f6ccd25de3868be2250b705c48ae03fec..3d1806762becbb5224b138b270051d133fbad4a9 100644 --- a/Geo/Cell.h +++ b/Geo/Cell.h @@ -19,12 +19,6 @@ public: bool operator()(const Cell* c1, const Cell* c2) const; }; -class Less_VertexNumIndex { -public: - bool operator()(const std::pair<MVertex*, int> v1, - const std::pair<MVertex*, int> v2) const; -}; - // Class to save cell boundary orientation information class BdInfo { private: