Skip to content
Snippets Groups Projects
Commit 9f1560d5 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

faster GFace::vertices() (3x speedup for eFFi test case)

parent fd5cd02b
Branches
Tags
No related merge requests found
...@@ -261,18 +261,17 @@ surface_params GFace::getSurfaceParams() const ...@@ -261,18 +261,17 @@ surface_params GFace::getSurfaceParams() const
std::list<GVertex*> GFace::vertices() const std::list<GVertex*> GFace::vertices() const
{ {
std::list<GEdge*>::const_iterator it = l_edges.begin(); std::set<GVertex*> v;
std::list<GVertex*>ret; for(std::list<GEdge*>::const_iterator it = l_edges.begin();
while (it != l_edges.end()){ it != l_edges.end(); ++it){
GVertex *v1 = (*it)->getBeginVertex(); GVertex *v1 = (*it)->getBeginVertex();
if(v1) v.insert(v1);
GVertex *v2 = (*it)->getEndVertex(); GVertex *v2 = (*it)->getEndVertex();
if(v1 && std::find(ret.begin(), ret.end(), v1) == ret.end()) if(v2) v.insert(v2);
ret.push_back(v1);
if(v2 && std::find(ret.begin(), ret.end(), v2) == ret.end())
ret.push_back(v2);
++it;
} }
return ret; std::list<GVertex*> res;
res.insert(res.begin(), v.begin(), v.end());
return res;
} }
void GFace::setVisibility(char val, bool recursive) void GFace::setVisibility(char val, bool recursive)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment