From 25cd3ff06921f147c9cb191289f0fbce4e0bda3d Mon Sep 17 00:00:00 2001 From: Matti Pellika <matti.pellikka@tut.fi> Date: Thu, 16 Feb 2012 17:07:26 +0000 Subject: [PATCH] prettier --- Geo/Cell.cpp | 17 +++++------------ Geo/Cell.h | 6 ------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Geo/Cell.cpp b/Geo/Cell.cpp index ae9edf9f98..0c38a43c68 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 da83de9f6c..3d1806762b 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: -- GitLab