diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 5716f928..8bab46e8 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -479,8 +479,8 @@ namespace netgen mp.sloppy = 5; meshing.GenerateMesh (mesh, mp); - for (ElementIndex ei = oldne; ei < mesh.GetNE(); ei++) - mesh[ei].SetIndex (domain); + for (auto & el : mesh.VolumeElements().Range(oldne, END)) + el.SetIndex (domain); mesh.CalcSurfacesOfNode(); diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index f8243c82..422d8416 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -202,15 +202,15 @@ namespace netgen template constexpr inline auto operator- (Index pi, int i) -> TIndex { return TIndex(pi.i-i); } template - constexpr inline int operator- (Index pa, Index pb) { return pa.i-pb.i; } + constexpr inline auto operator- (Index pa, Index pb) { return pa.i-pb.i; } template - inline bool operator< (Index a, Index b) { return a.i-b.i < 0; } + inline bool operator< (Index a, Index b) { return a-b < 0; } template - inline bool operator> (Index a, Index b) { return a.i-b.i > 0; } + inline bool operator> (Index a, Index b) { return a-b > 0; } template - inline bool operator>= (Index a, Index b) { return a.i-b.i >= 0; } + inline bool operator>= (Index a, Index b) { return a-b >= 0; } template - inline bool operator<= (Index a, Index b) { return a.i-b.i <= 0; } + inline bool operator<= (Index a, Index b) { return a-b <= 0; } template inline bool operator== (Index a, Index b) { return a.i == b.i; } template @@ -421,27 +421,28 @@ namespace netgen class ElementIndex : public Index { public: - using Index::Index; + using Index::Index; // ::Index; }; - inline istream & operator>> (istream & ist, ElementIndex & pi) + inline istream & operator>> (istream & ist, ElementIndex & ei) { - int i; ist >> i; pi = i; return ist; + int i; ist >> i; ei = ElementIndex::Base()+i; return ist; } inline ostream & operator<< (ostream & ost, const ElementIndex & ei) { - return (ost << ei-IndexBASE()); + return ost << int(ei-ElementIndex::Base()); } - + + /* // these should not be needed soon inline bool operator== (Index ei1, int ei2) { return int(ei1) == int(ei2); }; inline bool operator< (size_t s, Index ei2) { return int(s) < int(ei2); }; inline bool operator< ( Index ei1, size_t s) { return int(ei1) < int(s); }; // should not need inline bool operator< ( Index ei1, int s) { return int(ei1) < int(s); }; // should not need inline bool operator>= (size_t s, Index ei2) { return int(s) >= int(ei2); }; - + */ class SurfaceElementIndex : public Index { @@ -451,6 +452,7 @@ namespace netgen // these should not be needed soon + /* inline bool operator== (Index ei1, int ei2) { return int(ei1) == int(ei2); }; inline bool operator== (int ei2, Index ei1) { return int(ei1) == int(ei2); }; inline bool operator!= (Index ei1, int ei2) { return int(ei1) != int(ei2); }; @@ -459,7 +461,7 @@ namespace netgen inline bool operator< (Index ei1, int s) { return int(ei1) < int(s); }; // should not need inline bool operator>= (size_t s, Index ei2) { return int(s) >= int(ei2); }; inline bool operator>= (Index ei1, int s) { return int(ei1) >= int(s); }; - + */ inline void SetInvalid (SurfaceElementIndex & id) { id = -1; } inline bool IsInvalid (SurfaceElementIndex & id) { return id == -1; } @@ -481,11 +483,13 @@ namespace netgen using Index::Index; }; - // these should not be needed soon + // these should not be needed soon + /* inline bool operator== (Index ei1, int ei2) { return int(ei1) == int(ei2); }; inline bool operator< (size_t s, Index ei2) { return int(s) < int(ei2); }; inline bool operator< (Index ei1, size_t s) { return int(ei1) < int(s); }; inline bool operator< (Index ei1, int s) { return int(ei1) < int(s); }; + */ inline void SetInvalid (SegmentIndex & id) { id = -1; } inline bool IsInvalid (SegmentIndex & id) { return id == -1; }