mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
range-based for for TopExp_Explorer
This commit is contained in:
parent
64e40a25e0
commit
14f32f73c0
@ -779,7 +779,6 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCGeometry :: BuildFMap()
|
void OCCGeometry :: BuildFMap()
|
||||||
{
|
{
|
||||||
somap.Clear();
|
somap.Clear();
|
||||||
@ -913,39 +912,24 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
// Free Faces
|
// Free Faces
|
||||||
|
for (auto face : MyExplorer(shape, TopAbs_FACE, TopAbs_SHELL))
|
||||||
for (exp2.Init(shape, TopAbs_FACE, TopAbs_SHELL); exp2.More(); exp2.Next())
|
|
||||||
{
|
|
||||||
TopoDS_Face face = TopoDS::Face(exp2.Current());
|
|
||||||
if (fmap.FindIndex(face) < 1)
|
if (fmap.FindIndex(face) < 1)
|
||||||
{
|
{
|
||||||
fmap.Add (face);
|
fmap.Add (face);
|
||||||
|
for (auto wire : MyExplorer(face, TopAbs_WIRE))
|
||||||
for (exp3.Init(exp2.Current(), TopAbs_WIRE); exp3.More(); exp3.Next())
|
|
||||||
{
|
|
||||||
TopoDS_Wire wire = TopoDS::Wire (exp3.Current());
|
|
||||||
if (wmap.FindIndex(wire) < 1)
|
if (wmap.FindIndex(wire) < 1)
|
||||||
{
|
{
|
||||||
wmap.Add (wire);
|
wmap.Add (wire);
|
||||||
|
for (auto edge : MyExplorer(wire, TopAbs_EDGE))
|
||||||
for (exp4.Init(exp3.Current(), TopAbs_EDGE); exp4.More(); exp4.Next())
|
|
||||||
{
|
|
||||||
TopoDS_Edge edge = TopoDS::Edge(exp4.Current());
|
|
||||||
if (emap.FindIndex(edge) < 1)
|
if (emap.FindIndex(edge) < 1)
|
||||||
{
|
{
|
||||||
emap.Add (edge);
|
emap.Add (edge);
|
||||||
for (exp5.Init(exp4.Current(), TopAbs_VERTEX); exp5.More(); exp5.Next())
|
for (auto vertex : MyExplorer(edge, TopAbs_VERTEX))
|
||||||
{
|
|
||||||
TopoDS_Vertex vertex = TopoDS::Vertex(exp5.Current());
|
|
||||||
if (vmap.FindIndex(vertex) < 1)
|
if (vmap.FindIndex(vertex) < 1)
|
||||||
vmap.Add (vertex);
|
vmap.Add (vertex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Free Wires
|
// Free Wires
|
||||||
|
@ -244,6 +244,32 @@ namespace netgen
|
|||||||
string name;
|
string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class MyExplorer
|
||||||
|
{
|
||||||
|
class Iterator
|
||||||
|
{
|
||||||
|
TopExp_Explorer exp;
|
||||||
|
public:
|
||||||
|
Iterator (TopoDS_Shape ashape, TopAbs_ShapeEnum atoFind, TopAbs_ShapeEnum atoAvoid)
|
||||||
|
: exp(ashape, atoFind, atoAvoid) { }
|
||||||
|
auto operator*() { return exp.Current(); }
|
||||||
|
Iterator & operator++() { exp.Next(); return *this; }
|
||||||
|
bool operator!= (nullptr_t nu) { return exp.More(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
TopoDS_Shape shape;
|
||||||
|
TopAbs_ShapeEnum toFind;
|
||||||
|
TopAbs_ShapeEnum toAvoid;
|
||||||
|
MyExplorer (TopoDS_Shape ashape, TopAbs_ShapeEnum atoFind, TopAbs_ShapeEnum atoAvoid = TopAbs_SHAPE)
|
||||||
|
: shape(ashape), toFind(atoFind), toAvoid(atoAvoid) { ; }
|
||||||
|
Iterator begin() { return Iterator(shape, toFind, toAvoid); }
|
||||||
|
auto end() { return nullptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DLL_HEADER OCCGeometry : public NetgenGeometry
|
class DLL_HEADER OCCGeometry : public NetgenGeometry
|
||||||
{
|
{
|
||||||
Point<3> center;
|
Point<3> center;
|
||||||
|
Loading…
Reference in New Issue
Block a user