more use of ElementIndex, T_Range<T>(size_t) is now explicit

This commit is contained in:
Joachim Schoeberl 2024-12-29 21:36:37 +01:00
parent bb37ae1987
commit 4a9188da61
12 changed files with 123 additions and 84 deletions

View File

@ -278,7 +278,8 @@ namespace ngcore
T first, next; T first, next;
public: public:
NETGEN_INLINE T_Range () { ; } NETGEN_INLINE T_Range () { ; }
NETGEN_INLINE T_Range (T n) : first(0), next(n) {;} // NETGEN_INLINE T_Range (T n) : first(0), next(n) {;}
NETGEN_INLINE explicit T_Range (size_t n) : first(IndexBASE<T>()), next(IndexBASE<T>()+n) {;}
NETGEN_INLINE T_Range (T f, T n) : first(f), next(n) {;} NETGEN_INLINE T_Range (T f, T n) : first(f), next(n) {;}
template <typename T2> template <typename T2>
NETGEN_INLINE T_Range(T_Range<T2> r2) : first(r2.First()), next(r2.Next()) { ; } NETGEN_INLINE T_Range(T_Range<T2> r2) : first(r2.First()), next(r2.Next()) { ; }

View File

@ -317,6 +317,7 @@ namespace ngcore
public: public:
SharedLoop (IntRange ar) : r(ar) { cnt = r.begin(); } SharedLoop (IntRange ar) : r(ar) { cnt = r.begin(); }
SharedLoop (size_t s) : SharedLoop (IntRange{s}) { ; }
SharedIterator begin() { return SharedIterator (cnt, r.end(), true); } SharedIterator begin() { return SharedIterator (cnt, r.end(), true); }
SharedIterator end() { return SharedIterator (cnt, r.end(), false); } SharedIterator end() { return SharedIterator (cnt, r.end(), false); }
}; };
@ -623,6 +624,8 @@ public:
Reset (r); Reset (r);
} }
SharedLoop2 (size_t s) : SharedLoop2 (IntRange{s}) { }
void Reset (IntRange r) void Reset (IntRange r)
{ {
for (size_t i = 0; i < ranges.Size(); i++) for (size_t i = 0; i < ranges.Size(); i++)
@ -633,6 +636,9 @@ public:
processed.store(0, std::memory_order_release); processed.store(0, std::memory_order_release);
} }
void Reset (size_t s) { Reset(IntRange{s}); }
SharedIterator begin() SharedIterator begin()
{ {
/* /*

View File

@ -970,7 +970,7 @@ public:
Leaf *leaf1 = (Leaf*) ball_leaves.Alloc(); new (leaf1) Leaf(); Leaf *leaf1 = (Leaf*) ball_leaves.Alloc(); new (leaf1) Leaf();
Leaf *leaf2 = (Leaf*) ball_leaves.Alloc(); new (leaf2) Leaf(); Leaf *leaf2 = (Leaf*) ball_leaves.Alloc(); new (leaf2) Leaf();
for (auto i : order.Range(isplit)) for (auto i : order.Range(0, isplit))
leaf1->Add(leaf_index, leaf->p[i], leaf->index[i] ); leaf1->Add(leaf_index, leaf->p[i], leaf->index[i] );
for (auto i : order.Range(isplit, N)) for (auto i : order.Range(isplit, N))
leaf2->Add(leaf_index, leaf->p[i], leaf->index[i] ); leaf2->Add(leaf_index, leaf->p[i], leaf->index[i] );
@ -1334,7 +1334,7 @@ public:
leaves.Append(leaf2); leaves.Append(leaf2);
leaves[leaf1->nr] = leaf1; leaves[leaf1->nr] = leaf1;
for (auto i : order.Range(isplit)) for (auto i : order.Range(0,isplit))
leaf1->Add(leaves, leaf_index, leaf->p[i], leaf->index[i] ); leaf1->Add(leaves, leaf_index, leaf->p[i], leaf->index[i] );
for (auto i : order.Range(isplit, N)) for (auto i : order.Range(isplit, N))
leaf2->Add(leaves, leaf_index, leaf->p[i], leaf->index[i] ); leaf2->Add(leaves, leaf_index, leaf->p[i], leaf->index[i] );

View File

@ -1118,15 +1118,16 @@ namespace netgen
for (int step = 1; step <= 2; step++) for (int step = 1; step <= 2; step++)
{ {
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
for (ElementIndex ei : mtets.Range())
{ {
double h = 0; double h = 0;
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
for (int k = j+1; k < 4; k++) for (int k = j+1; k < 4; k++)
{ {
const Point<3> & p1 = mesh.Point (mtets[i-1].pnums[j]); const Point<3> & p1 = mesh.Point (mtets[ei].pnums[j]);
const Point<3> & p2 = mesh.Point (mtets[i-1].pnums[k]); const Point<3> & p2 = mesh.Point (mtets[ei].pnums[k]);
double hh = Dist2 (p1, p2); double hh = Dist2 (p1, p2);
if (hh > h) h = hh; if (hh > h) h = hh;
} }
@ -1135,7 +1136,7 @@ namespace netgen
double hshould = 1e10; double hshould = 1e10;
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
double hi = hv (mtets[i-1].pnums[j]-IndexBASE<PointIndex>()); double hi = hv (mtets[ei].pnums[j]-IndexBASE<PointIndex>());
if (hi < hshould) if (hi < hshould)
hshould = hi; hshould = hi;
} }
@ -1150,13 +1151,12 @@ namespace netgen
{ {
if (h > hshould * hfac) if (h > hshould * hfac)
{ {
mtets[i-1].marked = 1; mtets[ei].marked = 1;
marked = 1; marked = 1;
} }
else else
mtets[i-1].marked = 0; mtets[ei].marked = 0;
} }
} }
for (int i = 1; i <= mprisms.Size(); i++) for (int i = 1; i <= mprisms.Size(); i++)
{ {
@ -1701,13 +1701,15 @@ namespace netgen
int hanging = 0; int hanging = 0;
// for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
ParallelForRange ngcore::ParallelForRange
(tm, mtets.Size(), [&] (size_t begin, size_t end) // (tm, mtets.Size(), [&] (size_t begin, size_t end)
(mtets.Range(), [&] (auto myrange)
{ {
bool my_hanging = false; bool my_hanging = false;
for (size_t i = begin; i < end; i++) // for (size_t i = begin; i < end; i++)
for (auto ei : myrange)
{ {
MarkedTet & teti = mtets[i]; MarkedTet & teti = mtets[ei];
if (teti.marked) if (teti.marked)
{ {
@ -1894,8 +1896,8 @@ namespace netgen
const auto& mtris = *mesh.bisectioninfo.mtris; const auto& mtris = *mesh.bisectioninfo.mtris;
const auto& mquads = *mesh.bisectioninfo.mquads; const auto& mquads = *mesh.bisectioninfo.mquads;
ost << mtets.Size() << "\n"; ost << mtets.Size() << "\n";
for(int i=0; i<mtets.Size(); i++) for(auto ei : mtets.Range())
ost << mtets[i]; ost << mtets[ei];
ost << mprisms.Size() << "\n"; ost << mprisms.Size() << "\n";
for(int i=0; i<mprisms.Size(); i++) for(int i=0; i<mprisms.Size(); i++)
@ -1941,13 +1943,14 @@ namespace netgen
ist >> size; ist >> size;
mtets.SetSize(size); mtets.SetSize(size);
constexpr auto PI0 = IndexBASE<PointIndex>(); constexpr auto PI0 = IndexBASE<PointIndex>();
for(int i=0; i<size; i++) // for(int i=0; i<size; i++)
for (auto ei : ngcore::T_Range<ElementIndex>(size) )
{ {
ist >> mtets[i]; ist >> mtets[ei];
if(mtets[i].pnums[0] >= PI0+mesh.GetNV() || if(mtets[ei].pnums[0] >= PI0+mesh.GetNV() ||
mtets[i].pnums[1] >= PI0+mesh.GetNV() || mtets[ei].pnums[1] >= PI0+mesh.GetNV() ||
mtets[i].pnums[2] >= PI0+mesh.GetNV() || mtets[ei].pnums[2] >= PI0+mesh.GetNV() ||
mtets[i].pnums[3] >= PI0+mesh.GetNV()) mtets[ei].pnums[3] >= PI0+mesh.GetNV())
return false; return false;
} }
@ -2530,9 +2533,10 @@ namespace netgen
int maxnum = BTSortEdges (mesh, idmaps, edgenumber); int maxnum = BTSortEdges (mesh, idmaps, edgenumber);
for(int m = 0; m < mtets_old.Size(); m++) // for(int m = 0; m < mtets_old.Size(); m++)
for (auto mi : mtets_old.Range())
{ {
MarkedTet & mt = mtets_old[m]; MarkedTet & mt = mtets_old[mi];
//(*testout) << "old mt " << mt; //(*testout) << "old mt " << mt;
@ -2926,8 +2930,12 @@ namespace netgen
if(st == "refinementinfo") if(st == "refinementinfo")
// new version // new version
{ {
/*
for(int i=1; i<=mtets.Size(); i++) for(int i=1; i<=mtets.Size(); i++)
mtets[i-1].marked = 0; mtets[i-1].marked = 0;
*/
for(auto ei : mtets.Range())
mtets[ei].marked = 0;
for(int i=1; i<=mprisms.Size(); i++) for(int i=1; i<=mprisms.Size(); i++)
mprisms.Elem(i).marked = 0; mprisms.Elem(i).marked = 0;
for(int i=1; i<=mtris.Size(); i++) for(int i=1; i<=mtris.Size(); i++)
@ -2968,7 +2976,8 @@ namespace netgen
while(inf && isint) while(inf && isint)
{ {
mtets[atoi(st.c_str())-1].marked = 3; // mtets[atoi(st.c_str())-1].marked = 3;
mtets[IndexBASE<ElementIndex>()+(atoi(st.c_str())-1)].marked = 3;
marked = 1; marked = 1;
inf >> st; inf >> st;
@ -3056,12 +3065,13 @@ namespace netgen
inf.open(opt.refinementfilename); inf.open(opt.refinementfilename);
char ch; char ch;
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
for (auto ei : mtets.Range())
{ {
inf >> ch; inf >> ch;
if(!inf) if(!inf)
throw NgException("something wrong with refinementinfo file (old format)"); throw NgException("something wrong with refinementinfo file (old format)");
mtets[i-1].marked = (ch == '1'); mtets[ei].marked = (ch == '1');
} }
marked = 1; marked = 1;
} }
@ -3075,18 +3085,18 @@ namespace netgen
// all in one ! // all in one !
if (mprisms.Size()) if (mprisms.Size())
{ {
int cnttet = 0; ElementIndex cnttet = IndexBASE<ElementIndex>();
int cntprism = 0; int cntprism = 0;
for (int i = 1; i <= mesh.GetNE(); i++) for (int i = 1; i <= mesh.GetNE(); i++)
{ {
if (mesh.VolumeElement(i).GetType() == TET || if (mesh.VolumeElement(i).GetType() == TET ||
mesh.VolumeElement(i).GetType() == TET10) mesh.VolumeElement(i).GetType() == TET10)
{ {
cnttet++; mtets[cnttet].marked =
mtets[cnttet-1].marked =
(opt.onlyonce ? 3 : 1) * mesh.VolumeElement(i).TestRefinementFlag(); (opt.onlyonce ? 3 : 1) * mesh.VolumeElement(i).TestRefinementFlag();
if (mtets[cnttet-1].marked) if (mtets[cnttet].marked)
cntm++; cntm++;
cnttet++;
} }
else else
{ {
@ -3100,11 +3110,12 @@ namespace netgen
} }
} }
else else
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
for (auto ei : mtets.Range())
{ {
mtets[i-1].marked = mtets[ei].marked =
(opt.onlyonce ? 1 : 3) * mesh.VolumeElement(i).TestRefinementFlag(); (opt.onlyonce ? 1 : 3) * mesh.VolumeElement(ei).TestRefinementFlag();
if (mtets[i-1].marked) if (mtets[ei].marked)
cntm++; cntm++;
} }
@ -3202,12 +3213,12 @@ namespace netgen
{ {
PrintMessage(3,"refine p"); PrintMessage(3,"refine p");
for (int i = 1; i <= mtets.Size(); i++) for (auto ei : mtets.Range())
mtets[i-1].incorder = mtets[i-1].marked ? 1 : 0; mtets[ei].incorder = mtets[ei].marked ? 1 : 0;
for (int i = 1; i <= mtets.Size(); i++) for (auto ei : mtets.Range())
if (mtets[i-1].incorder) if (mtets[ei].incorder)
mtets[i-1].marked = 0; mtets[ei].marked = 0;
for (int i = 1; i <= mprisms.Size(); i++) for (int i = 1; i <= mprisms.Size(); i++)
@ -3272,19 +3283,22 @@ namespace netgen
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
mtets[i-1].incorder = 1; for (auto ei : mtets.Range())
for (int i = 1; i <= mtets.Size(); i++) mtets[ei].incorder = 1;
// for (int i = 1; i <= mtets.Size(); i++)
for (auto ei : mtets.Range())
{ {
if (!mtets[i-1].marked) if (!mtets[ei].marked)
mtets[i-1].incorder = 0; mtets[ei].incorder = 0;
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
if (singv.Test (mtets[i-1].pnums[j])) if (singv.Test (mtets[ei].pnums[j]))
mtets[i-1].incorder = 0; mtets[ei].incorder = 0;
} }
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
if (mtets[i-1].incorder) for (auto ei : mtets.Range())
mtets[i-1].marked = 0; if (mtets[ei].incorder)
mtets[ei].marked = 0;
for (int i = 1; i <= mprisms.Size(); i++) for (int i = 1; i <= mprisms.Size(); i++)
@ -3335,10 +3349,11 @@ namespace netgen
NgProfiler::StartTimer (timer_bisecttet); NgProfiler::StartTimer (timer_bisecttet);
(*opt.tracer)("bisecttet", false); (*opt.tracer)("bisecttet", false);
size_t nel = mtets.Size(); size_t nel = mtets.Size();
for (size_t i = 0; i < nel; i++) // for (size_t i = 0; i < nel; i++)
if (mtets[i].marked) for (auto ei : ngcore::T_Range<ElementIndex>(nel))
if (mtets[ei].marked)
{ {
MarkedTet oldtet = mtets[i]; MarkedTet oldtet = mtets[ei];
SortedPointIndices<2> edge(oldtet.pnums[oldtet.tetedge1], SortedPointIndices<2> edge(oldtet.pnums[oldtet.tetedge1],
oldtet.pnums[oldtet.tetedge2]); oldtet.pnums[oldtet.tetedge2]);
@ -3358,9 +3373,9 @@ namespace netgen
MarkedTet newtet1, newtet2; MarkedTet newtet1, newtet2;
BTBisectTet (oldtet, newp, newtet1, newtet2); BTBisectTet (oldtet, newp, newtet1, newtet2);
mtets[i] = newtet1; mtets[ei] = newtet1;
mtets.Append (newtet2); mtets.Append (newtet2);
mesh.mlparentelement.Append (i+1); mesh.mlparentelement.Append (ei-IndexBASE<ElementIndex>()+1);
} }
NgProfiler::StopTimer (timer_bisecttet); NgProfiler::StopTimer (timer_bisecttet);
(*opt.tracer)("bisecttet", true); (*opt.tracer)("bisecttet", true);
@ -3673,18 +3688,21 @@ namespace netgen
v_order = 0; v_order = 0;
if (mesh.GetDimension() == 3) if (mesh.GetDimension() == 3)
{ {
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
if (mtets[i-1].incorder) for (auto ei : mtets.Range())
mtets[i-1].order++; if (mtets[ei].incorder)
mtets[ei].order++;
for (int i = 0; i < mtets.Size(); i++) // for (int i = 0; i < mtets.Size(); i++)
for (auto ei : mtets.Range())
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
if (int(mtets[i].order) > v_order[mtets[i].pnums[j]]) if (int(mtets[ei].order) > v_order[mtets[ei].pnums[j]])
v_order[mtets[i].pnums[j]] = mtets[i].order; v_order[mtets[ei].pnums[j]] = mtets[ei].order;
for (int i = 0; i < mtets.Size(); i++) // for (int i = 0; i < mtets.Size(); i++)
for (auto ei : mtets.Range())
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
if (int(mtets[i].order) < v_order[mtets[i].pnums[j]]-1) if (int(mtets[ei].order) < v_order[mtets[ei].pnums[j]]-1)
mtets[i].order = v_order[mtets[i].pnums[j]]-1; mtets[ei].order = v_order[mtets[ei].pnums[j]]-1;
} }
else else
{ {
@ -3732,19 +3750,19 @@ namespace netgen
mesh.AddVolumeElement (el); mesh.AddVolumeElement (el);
} }
*/ */
ParallelForRange ngcore::ParallelForRange
(opt.task_manager, mtets.Size(), [&] (size_t begin, size_t end) (mtets.Range(), [&] (auto myrange)
{ {
for (size_t i = begin; i < end; i++) for (auto ei : myrange)
{ {
Element el(TET); Element el(TET);
auto & tet = mtets[i]; auto & tet = mtets[ei];
el.SetIndex (tet.matindex); el.SetIndex (tet.matindex);
el.SetOrder (tet.order); el.SetOrder (tet.order);
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
el[j] = tet.pnums[j]; el[j] = tet.pnums[j];
el.NewestVertex() = tet.newest_vertex; el.NewestVertex() = tet.newest_vertex;
mesh.SetVolumeElement (ElementIndex(i), el); mesh.SetVolumeElement (ei, el);
} }
}); });

View File

@ -707,7 +707,7 @@ void BoundaryLayerTool ::InsertNewElements(
s[0] = p0; s[0] = p0;
s[1] = p1; s[1] = p1;
s[2] = PointIndex::INVALID; s[2] = PointIndex::INVALID;
auto pair = [[maybe_unused]] auto pair =
s[0] < s[1] ? make_pair(s[0], s[1]) : make_pair(s[1], s[0]); s[0] < s[1] ? make_pair(s[0], s[1]) : make_pair(s[1], s[0]);
if (extra_edge_nr) if (extra_edge_nr)
s.edgenr = ++edge_nr; s.edgenr = ++edge_nr;

View File

@ -282,7 +282,7 @@ void BoundaryLayerTool ::InterpolateSurfaceGrowthVectors()
RegionTimer rtall(tall); RegionTimer rtall(tall);
static Timer tsmooth("InterpolateSurfaceGrowthVectors-Smoothing"); static Timer tsmooth("InterpolateSurfaceGrowthVectors-Smoothing");
auto np_old = this->np; auto np_old = this->np;
auto np = mesh.GetNP(); [[maybe_unused]] auto np = mesh.GetNP();
auto hasMoved = [&] (PointIndex pi) { auto hasMoved = [&] (PointIndex pi) {
return (pi - IndexBASE<PointIndex>() >= np_old) || mapto[pi].Size() > 0 || special_boundary_points.count(pi); return (pi - IndexBASE<PointIndex>() >= np_old) || mapto[pi].Size() > 0 || special_boundary_points.count(pi);
@ -380,8 +380,8 @@ void BoundaryLayerTool ::FixSurfaceElements()
{ {
static Timer tall("FixSurfaceElements"); static Timer tall("FixSurfaceElements");
RegionTimer rtall(tall); RegionTimer rtall(tall);
auto np_old = this->np; [[maybe_unused]] auto np_old = this->np;
auto np = mesh.GetNP(); [[maybe_unused]] auto np = mesh.GetNP();
non_bl_growth_vectors.clear(); non_bl_growth_vectors.clear();

View File

@ -738,7 +738,7 @@ struct GrowthVectorLimiter
LimitBoundaryLayer(safety); LimitBoundaryLayer(safety);
CheckLimits(__LINE__); CheckLimits(__LINE__);
for (auto i : Range(10)) for ([[maybe_unused]] auto i : Range(10))
EqualizeLimits(smoothing_factors[i_pass]); EqualizeLimits(smoothing_factors[i_pass]);
CheckLimits(__LINE__); CheckLimits(__LINE__);

View File

@ -614,7 +614,7 @@ namespace netgen
if (aorder <= 1) if (aorder <= 1)
{ {
for (ElementIndex ei = 0; ei < mesh.GetNE(); ei++) for (ElementIndex ei : mesh.VolumeElements().Range())
if (mesh[ei].GetType() == TET10) if (mesh[ei].GetType() == TET10)
ishighorder = 1; ishighorder = 1;
return; return;

View File

@ -353,7 +353,7 @@ namespace netgen
improvement_candidates[cnt++]= std::make_pair(t1,o1); improvement_candidates[cnt++]= std::make_pair(t1,o1);
}); });
auto elements_with_improvement = improvement_candidates.Range(cnt.load()); auto elements_with_improvement = improvement_candidates.Range(0, cnt.load());
QuickSort(elements_with_improvement); QuickSort(elements_with_improvement);
for (auto [t1,o1] : elements_with_improvement) for (auto [t1,o1] : elements_with_improvement)

View File

@ -42,7 +42,7 @@ namespace netgen
class MarkedTri; class MarkedTri;
class MarkedQuad; class MarkedQuad;
typedef Array<MarkedTet> T_MTETS; typedef Array<MarkedTet,ElementIndex> T_MTETS;
typedef NgArray<MarkedPrism> T_MPRISMS; typedef NgArray<MarkedPrism> T_MPRISMS;
typedef NgArray<MarkedIdentification> T_MIDS; typedef NgArray<MarkedIdentification> T_MIDS;
typedef NgArray<MarkedTri> T_MTRIS; typedef NgArray<MarkedTri> T_MTRIS;

View File

@ -468,14 +468,11 @@ namespace netgen
int i; int i;
public: public:
ElementIndex () = default; ElementIndex () = default;
// private: constexpr /* explicit */ ElementIndex (int ai) : i(ai) { ; }
constexpr ElementIndex (int ai) : i(ai) { ; }
public:
ElementIndex & operator= (const ElementIndex & ai) { i = ai.i; return *this; } ElementIndex & operator= (const ElementIndex & ai) { i = ai.i; return *this; }
ElementIndex & operator= (int ai) { i = ai; return *this; } ElementIndex & operator= (int ai) { i = ai; return *this; }
// private:
constexpr operator int () const { return i; } constexpr /* explicit */ operator int () const { return i; }
public:
ElementIndex operator++ (int) { return ElementIndex(i++); } ElementIndex operator++ (int) { return ElementIndex(i++); }
ElementIndex operator-- (int) { return ElementIndex(i--); } ElementIndex operator-- (int) { return ElementIndex(i--); }
ElementIndex & operator++ () { ++i; return *this; } ElementIndex & operator++ () { ++i; return *this; }
@ -495,6 +492,23 @@ namespace netgen
return (ost << ei-IndexBASE<ElementIndex>()); return (ost << ei-IndexBASE<ElementIndex>());
} }
inline ElementIndex operator+ (ElementIndex ei, int i) { return ElementIndex { int(ei) + i }; }
inline ElementIndex operator+ (size_t s, ElementIndex ei) { return ElementIndex(int(ei) + s); }
inline ElementIndex operator+ (ElementIndex ei, size_t s) { return ElementIndex(int(ei) + s); }
inline bool operator== (ElementIndex ei1, ElementIndex ei2) { return int(ei1) == int(ei2); };
inline bool operator!= (ElementIndex ei1, ElementIndex ei2) { return int(ei1) != int(ei2); };
inline bool operator< (ElementIndex ei1, ElementIndex ei2) { return int(ei1) < int(ei2); };
inline bool operator> (ElementIndex ei1, ElementIndex ei2) { return int(ei1) > int(ei2); };
inline bool operator>= (ElementIndex ei1, ElementIndex ei2) { return int(ei1) >= int(ei2); };
inline bool operator<= (ElementIndex ei1, ElementIndex ei2) { return int(ei1) <= int(ei2); };
// these should not be needed:
inline bool operator== (ElementIndex ei1, int ei2) { return int(ei1) == int(ei2); };
inline bool operator< (size_t s, ElementIndex ei2) { return int(s) < int(ei2); };
inline bool operator< (ElementIndex ei1, size_t s) { return int(ei1) < int(s); }; // should not need
inline bool operator< (ElementIndex ei1, int s) { return int(ei1) < int(s); }; // should not need
inline bool operator>= (size_t s, ElementIndex ei2) { return int(s) >= int(ei2); };
class SurfaceElementIndex class SurfaceElementIndex
{ {

View File

@ -4442,7 +4442,7 @@ namespace netgen
for (int i = 0; i < trigs.Size(); i++) for (int i = 0; i < trigs.Size(); i++)
{ {
const ClipPlaneTrig & trig = trigs[i]; const ClipPlaneTrig & trig = trigs[i];
if (trig.elnr != lastelnr) if (trig.elnr != ElementIndex(lastelnr))
{ {
lastelnr = trig.elnr; lastelnr = trig.elnr;
nlp = -1; nlp = -1;