using more range-based loops in occ

This commit is contained in:
Joachim Schoeberl 2021-11-06 11:51:11 +01:00
parent 14f32f73c0
commit fdc04b7276
2 changed files with 23 additions and 11 deletions

View File

@ -391,6 +391,8 @@ namespace netgen
{ {
TopoDS_Face face = TopoDS::Face(geom.fmap(i3)); TopoDS_Face face = TopoDS::Face(geom.fmap(i3));
facenr = geom.fmap.FindIndex (face); // sollte doch immer == i3 sein ??? JS facenr = geom.fmap.FindIndex (face); // sollte doch immer == i3 sein ??? JS
if (facenr != i3)
cout << "info: facenr != i3" << endl;
int solidnr0 = face2solid[0][i3-1]; int solidnr0 = face2solid[0][i3-1];
int solidnr1 = face2solid[1][i3-1]; int solidnr1 = face2solid[1][i3-1];

View File

@ -913,19 +913,19 @@ namespace netgen
// Free Faces // Free Faces
for (auto face : MyExplorer(shape, TopAbs_FACE, TopAbs_SHELL)) for (auto face : MyExplorer(shape, TopAbs_FACE, TopAbs_SHELL))
if (fmap.FindIndex(face) < 1) if (!fmap.Contains(face))
{ {
fmap.Add (face); fmap.Add (face);
for (auto wire : MyExplorer(face, TopAbs_WIRE)) for (auto wire : MyExplorer(face, TopAbs_WIRE))
if (wmap.FindIndex(wire) < 1) if (!wmap.Contains(wire))
{ {
wmap.Add (wire); wmap.Add (wire);
for (auto edge : MyExplorer(wire, TopAbs_EDGE)) for (auto edge : MyExplorer(wire, TopAbs_EDGE))
if (emap.FindIndex(edge) < 1) if (!emap.Contains(edge))
{ {
emap.Add (edge); emap.Add (edge);
for (auto vertex : MyExplorer(edge, TopAbs_VERTEX)) for (auto vertex : MyExplorer(edge, TopAbs_VERTEX))
if (vmap.FindIndex(vertex) < 1) if (!vmap.Contains(vertex))
vmap.Add (vertex); vmap.Add (vertex);
} }
} }
@ -960,7 +960,7 @@ namespace netgen
// Free Edges // Free Edges
/*
for (exp4.Init(shape, TopAbs_EDGE, TopAbs_WIRE); exp4.More(); exp4.Next()) for (exp4.Init(shape, TopAbs_EDGE, TopAbs_WIRE); exp4.More(); exp4.Next())
{ {
TopoDS_Edge edge = TopoDS::Edge(exp4.Current()); TopoDS_Edge edge = TopoDS::Edge(exp4.Current());
@ -975,19 +975,29 @@ namespace netgen
} }
} }
} }
*/
for (auto edge : MyExplorer(shape, TopAbs_EDGE, TopAbs_WIRE))
if (!emap.Contains(edge))
{
emap.Add (edge);
for (auto vertex : MyExplorer(edge, TopAbs_VERTEX))
if (!vmap.Contains(vertex))
vmap.Add (vertex);
}
// Free Vertices // Free Vertices
/*
for (exp5.Init(shape, TopAbs_VERTEX, TopAbs_EDGE); exp5.More(); exp5.Next()) for (exp5.Init(shape, TopAbs_VERTEX, TopAbs_EDGE); exp5.More(); exp5.Next())
{ {
TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current());
if (vmap.FindIndex(vertex) < 1) if (vmap.FindIndex(vertex) < 1)
vmap.Add (vertex); vmap.Add (vertex);
} }
*/
for (auto vertex : MyExplorer(shape, TopAbs_VERTEX, TopAbs_EDGE))
if (!vmap.Contains(vertex))
vmap.Add (vertex);
facemeshstatus.DeleteAll(); facemeshstatus.DeleteAll();
facemeshstatus.SetSize (fmap.Extent()); facemeshstatus.SetSize (fmap.Extent());