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

improve removeDuplicateMeshVertices

parent ef5e8b10
No related branches found
No related tags found
No related merge requests found
......@@ -1029,11 +1029,18 @@ int GModel::removeDuplicateMeshVertices(double tolerance)
for(int k = 0; k < e->getNumVertices(); k++){
MVertex *v = e->getVertex(k);
std::set<MVertex*, MVertexLessThanLexicographic>::iterator it = pos.find(v);
if(it != pos.end())
if(it == pos.end()){
Msg::Info("Linear search for (%.16g, %.16g, %.16g)", v->x(), v->y(), v->z());
it = v->linearSearch(pos);
if(it == pos.end()){
Msg::Error("Could not find unique vertex (%.16g, %.16g, %.16g)",
v->x(), v->y(), v->z());
break;
}
}
verts.push_back(*it);
else
Msg::Error("Could not find unique vertex (%g,%g,%g)", v->x(), v->y(), v->z());
}
if(verts.size() == e->getNumVertices()){
MElementFactory factory;
MElement *e2 = factory.create(e->getTypeForMSH(), verts, e->getNum(),
e->getPartition());
......@@ -1048,7 +1055,7 @@ int GModel::removeDuplicateMeshVertices(double tolerance)
case TYPE_PYR: elements[7][entities[i]->tag()].push_back(e2); break;
case TYPE_POLYG: elements[8][entities[i]->tag()].push_back(e2); break;
case TYPE_POLYH: elements[9][entities[i]->tag()].push_back(e2); break;
}
}
}
}
......@@ -1068,7 +1075,7 @@ int GModel::removeDuplicateMeshVertices(double tolerance)
MVertexLessThanLexicographic::tolerance = old_tol;
Msg::Info("Removed %d duplicate mesh vertices", diff);
Msg::Info("Removed %d duplicate mesh %s", diff, diff > 1 ? "vertices" : "vertex");
return diff;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment