mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
added IndexMapIterator
This commit is contained in:
parent
bd564931f8
commit
6ae645ce33
@ -374,12 +374,20 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
int total = 0;
|
||||
for (int i3 = 1; i3 <= geom.fmap.Extent(); i3++)
|
||||
for (TopExp_Explorer exp2(geom.fmap(i3), TopAbs_WIRE); exp2.More(); exp2.Next())
|
||||
for (TopExp_Explorer exp3(exp2.Current(), TopAbs_EDGE); exp3.More(); exp3.Next())
|
||||
total++;
|
||||
|
||||
*/
|
||||
int total = 0;
|
||||
for (auto [i3, face] : Enumerate(geom.fmap))
|
||||
for (auto wire : Explore(face, TopAbs_WIRE))
|
||||
for (auto edge : Explore(wire, TopAbs_EDGE))
|
||||
total++;
|
||||
|
||||
|
||||
|
||||
int facenr = 0;
|
||||
// int edgenr = mesh.GetNSeg();
|
||||
|
@ -268,7 +268,38 @@ namespace netgen
|
||||
auto end() { return nullptr; }
|
||||
};
|
||||
|
||||
inline auto Explore (TopoDS_Shape shape, TopAbs_ShapeEnum toFind, TopAbs_ShapeEnum toAvoid = TopAbs_SHAPE)
|
||||
{
|
||||
return MyExplorer (shape, toFind, toAvoid);
|
||||
}
|
||||
|
||||
|
||||
class IndexMapIterator
|
||||
{
|
||||
class Iterator
|
||||
{
|
||||
const TopTools_IndexedMapOfShape & indmap;
|
||||
int i;
|
||||
public:
|
||||
Iterator (const TopTools_IndexedMapOfShape & aindmap, int ai)
|
||||
: indmap(aindmap), i(ai) { ; }
|
||||
auto operator*() { return tuple(i, indmap(i)); }
|
||||
Iterator & operator++() { i++; return *this; }
|
||||
bool operator!= (const Iterator & i2) { return i != i2.i; }
|
||||
};
|
||||
|
||||
public:
|
||||
const TopTools_IndexedMapOfShape & indmap;
|
||||
IndexMapIterator (const TopTools_IndexedMapOfShape & aindmap) : indmap(aindmap) { }
|
||||
Iterator begin() { return Iterator(indmap, 1); }
|
||||
Iterator end() { return Iterator(indmap, indmap.Extent()); }
|
||||
};
|
||||
|
||||
inline auto Enumerate (const TopTools_IndexedMapOfShape & indmap)
|
||||
{
|
||||
return IndexMapIterator(indmap);
|
||||
}
|
||||
|
||||
|
||||
class DLL_HEADER OCCGeometry : public NetgenGeometry
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user