From fdc04b727603a47b1d622fcbdcd078f769054b7d Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sat, 6 Nov 2021 11:51:11 +0100 Subject: [PATCH] using more range-based loops in occ --- libsrc/occ/occgenmesh.cpp | 4 +++- libsrc/occ/occgeom.cpp | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/libsrc/occ/occgenmesh.cpp b/libsrc/occ/occgenmesh.cpp index f437b5b3..343c1b1f 100644 --- a/libsrc/occ/occgenmesh.cpp +++ b/libsrc/occ/occgenmesh.cpp @@ -391,7 +391,9 @@ namespace netgen { TopoDS_Face face = TopoDS::Face(geom.fmap(i3)); 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 solidnr1 = face2solid[1][i3-1]; diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 0cbf47cf..c39d882b 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -913,19 +913,19 @@ namespace netgen // Free Faces for (auto face : MyExplorer(shape, TopAbs_FACE, TopAbs_SHELL)) - if (fmap.FindIndex(face) < 1) + if (!fmap.Contains(face)) { fmap.Add (face); for (auto wire : MyExplorer(face, TopAbs_WIRE)) - if (wmap.FindIndex(wire) < 1) + if (!wmap.Contains(wire)) { wmap.Add (wire); for (auto edge : MyExplorer(wire, TopAbs_EDGE)) - if (emap.FindIndex(edge) < 1) + if (!emap.Contains(edge)) { emap.Add (edge); for (auto vertex : MyExplorer(edge, TopAbs_VERTEX)) - if (vmap.FindIndex(vertex) < 1) + if (!vmap.Contains(vertex)) vmap.Add (vertex); } } @@ -960,7 +960,7 @@ namespace netgen // Free Edges - + /* for (exp4.Init(shape, TopAbs_EDGE, TopAbs_WIRE); exp4.More(); exp4.Next()) { 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 - + /* for (exp5.Init(shape, TopAbs_VERTEX, TopAbs_EDGE); exp5.More(); exp5.Next()) { TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current()); if (vmap.FindIndex(vertex) < 1) vmap.Add (vertex); } - - - + */ + for (auto vertex : MyExplorer(shape, TopAbs_VERTEX, TopAbs_EDGE)) + if (!vmap.Contains(vertex)) + vmap.Add (vertex); facemeshstatus.DeleteAll(); facemeshstatus.SetSize (fmap.Extent());