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

don't exit if edges are not ordered in addPlanarSurface but only issue a warning

(this way we can use it with a geo obtained from createTopologyFromMesh, which does
not currently reorder line loops)
parent f37aadd3
No related branches found
No related tags found
No related merge requests found
...@@ -61,15 +61,18 @@ GEdge *GeoFactory::addLine(GModel *gm, GVertex *start, GVertex *end) ...@@ -61,15 +61,18 @@ GEdge *GeoFactory::addLine(GModel *gm, GVertex *start, GVertex *end)
GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> > edges) GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> > edges)
{ {
//create line loops // create line loops
// FIXME: having non-ordered lines in the loop triggers a warning; we should
// eventually return an error, but createTopolpgyFromMesh() does not currently
// sort edges in loops; once it does, we can be stricter here.
std::vector<EdgeLoop *> vecLoops; std::vector<EdgeLoop *> vecLoops;
int nLoops = edges.size(); int nLoops = edges.size();
for (int i=0; i< nLoops; i++){ for (int i = 0; i< nLoops; i++){
int numl = gm->getMaxElementaryNumber(1) + i; int numl = gm->getMaxElementaryNumber(1) + i;
while (FindEdgeLoop(numl)){ while (FindEdgeLoop(numl)){
numl++; numl++;
} }
int nl=(int)edges[i].size(); int nl = (int)edges[i].size();
const GEdge &e0 = *edges[i][0]; const GEdge &e0 = *edges[i][0];
const GVertex *frontV = e0.getBeginVertex(); const GVertex *frontV = e0.getBeginVertex();
List_T *iListl = List_Create(nl, nl, sizeof(int)); List_T *iListl = List_Create(nl, nl, sizeof(int));
...@@ -78,8 +81,8 @@ GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> > ...@@ -78,8 +81,8 @@ GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> >
if (e0.getEndVertex() != e1.getBeginVertex() && e0.getEndVertex() != e1.getEndVertex()) { if (e0.getEndVertex() != e1.getBeginVertex() && e0.getEndVertex() != e1.getEndVertex()) {
frontV = e0.getEndVertex(); frontV = e0.getEndVertex();
if (e0.getBeginVertex() != e1.getBeginVertex() && e0.getBeginVertex() != e1.getEndVertex()) { if (e0.getBeginVertex() != e1.getBeginVertex() && e0.getBeginVertex() != e1.getEndVertex()) {
Msg::Error("Invalid line loop"); Msg::Warning("Edges 0 and 1 not consecutive in line loop %d", i);
return NULL; //return NULL;
} }
} }
} }
...@@ -89,20 +92,22 @@ GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> > ...@@ -89,20 +92,22 @@ GFace *GeoFactory::addPlanarFace(GModel *gm, std::vector< std::vector<GEdge *> >
int numEdge = e.tag(); int numEdge = e.tag();
if (frontV == e.getBeginVertex()) { if (frontV == e.getBeginVertex()) {
frontV = e.getEndVertex(); frontV = e.getEndVertex();
} else if (frontV == e.getEndVertex()){ }
else if (frontV == e.getEndVertex()){
frontV = e.getBeginVertex(); frontV = e.getBeginVertex();
numEdge = -numEdge; numEdge = -numEdge;
} else { }
Msg::Error("Invalid line loop"); else {
List_Delete(iListl); Msg::Warning("Edge %d out of order in line loop %d", j, i);
return NULL; //List_Delete(iListl);
//return NULL;
} }
List_Add(iListl, &numEdge); List_Add(iListl, &numEdge);
} }
if (firstV != frontV) { if (firstV != frontV) {
Msg::Error("Invalid line loop"); Msg::Warning("Unordered line loop %d", i);
List_Delete(iListl); //List_Delete(iListl);
return NULL; //return NULL;
} }
EdgeLoop *l = Create_EdgeLoop(numl, iListl); EdgeLoop *l = Create_EdgeLoop(numl, iListl);
vecLoops.push_back(l); vecLoops.push_back(l);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment