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

check topology of input 1D mesh; if it has a boundary, abort

parent f702dfc3
No related branches found
No related tags found
No related merge requests found
...@@ -543,7 +543,8 @@ static bool recoverEdge(BDS_Mesh *m, GEdge *ge, ...@@ -543,7 +543,8 @@ static bool recoverEdge(BDS_Mesh *m, GEdge *ge,
return true; return true;
} }
void BDS2GMSH(BDS_Mesh *m, GFace *gf, std::map<BDS_Point*, MVertex*, PointLessThan> &recoverMap) void BDS2GMSH(BDS_Mesh *m, GFace *gf,
std::map<BDS_Point*, MVertex*, PointLessThan> &recoverMap)
{ {
{ {
std::set<BDS_Point*,PointLessThan>::iterator itp = m->points.begin(); std::set<BDS_Point*,PointLessThan>::iterator itp = m->points.begin();
...@@ -585,7 +586,6 @@ void BDS2GMSH(BDS_Mesh *m, GFace *gf, std::map<BDS_Point*, MVertex*, PointLessTh ...@@ -585,7 +586,6 @@ void BDS2GMSH(BDS_Mesh *m, GFace *gf, std::map<BDS_Point*, MVertex*, PointLessTh
} }
} }
static void addOrRemove(MVertex *v1, MVertex *v2, std::set<MEdge,Less_Edge> & bedges) static void addOrRemove(MVertex *v1, MVertex *v2, std::set<MEdge,Less_Edge> & bedges)
{ {
MEdge e(v1,v2); MEdge e(v1,v2);
...@@ -933,7 +933,7 @@ bool meshGenerator(GFace *gf, int RECUR_ITER, ...@@ -933,7 +933,7 @@ bool meshGenerator(GFace *gf, int RECUR_ITER,
} }
// build a set with all points of the boundaries // build a set with all points of the boundaries
std::set<MVertex*> all_vertices; std::set<MVertex*> all_vertices, boundary;
std::list<GEdge*>::iterator ite = edges.begin(); std::list<GEdge*>::iterator ite = edges.begin();
while(ite != edges.end()){ while(ite != edges.end()){
if((*ite)->isSeam(gf)) return false; if((*ite)->isSeam(gf)) return false;
...@@ -943,6 +943,14 @@ bool meshGenerator(GFace *gf, int RECUR_ITER, ...@@ -943,6 +943,14 @@ bool meshGenerator(GFace *gf, int RECUR_ITER,
MVertex *v2 = (*ite)->lines[i]->getVertex(1); MVertex *v2 = (*ite)->lines[i]->getVertex(1);
all_vertices.insert(v1); all_vertices.insert(v1);
all_vertices.insert(v2); all_vertices.insert(v2);
if(boundary.find(v1) == boundary.end())
boundary.insert(v1);
else
boundary.erase(v1);
if(boundary.find(v2) == boundary.end())
boundary.insert(v2);
else
boundary.erase(v2);
} }
} }
else else
...@@ -950,6 +958,12 @@ bool meshGenerator(GFace *gf, int RECUR_ITER, ...@@ -950,6 +958,12 @@ bool meshGenerator(GFace *gf, int RECUR_ITER,
++ite; ++ite;
} }
if(boundary.size()){
Msg::Error("The 1D mesh seems not to be forming a closed loop");
gf->meshStatistics.status = GFace::FAILED;
return false;
}
std::list<GEdge*> emb_edges = gf->embeddedEdges(); std::list<GEdge*> emb_edges = gf->embeddedEdges();
ite = emb_edges.begin(); ite = emb_edges.begin();
while(ite != emb_edges.end()){ while(ite != emb_edges.end()){
...@@ -980,7 +994,7 @@ bool meshGenerator(GFace *gf, int RECUR_ITER, ...@@ -980,7 +994,7 @@ bool meshGenerator(GFace *gf, int RECUR_ITER,
if(all_vertices.size() < 3){ if(all_vertices.size() < 3){
Msg::Warning("Mesh Generation of Model Face %d Skipped: " Msg::Warning("Mesh Generation of Model Face %d Skipped: "
"Only %d Mesh Vertices on The Contours", "Only %d mesh vertices on the contours",
gf->tag(), all_vertices.size()); gf->tag(), all_vertices.size());
gf->meshStatistics.status = GFace::DONE; gf->meshStatistics.status = GFace::DONE;
return true; return true;
...@@ -1802,7 +1816,7 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true) ...@@ -1802,7 +1816,7 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true)
} }
if(!ok){ if(!ok){
gf->meshStatistics.status = GFace::FAILED; gf->meshStatistics.status = GFace::FAILED;
Msg::Error("The 1D Mesh seems not to be forming a closed loop"); Msg::Error("The 1D mesh seems not to be forming a closed loop");
delete m; delete m;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment