diff --git a/libsrc/general/ngarray.hpp b/libsrc/general/ngarray.hpp index 5c599122..213a24c2 100644 --- a/libsrc/general/ngarray.hpp +++ b/libsrc/general/ngarray.hpp @@ -39,7 +39,8 @@ namespace netgen T Size() const { return next-first; } T operator[] (T i) const { return first+i; } bool Contains (T i) const { return ((i >= first) && (i < next)); } - + T_Range Modify (int inc_begin, int inc_end) const + { return T_Range(first+inc_begin, next+inc_end); } ArrayRangeIterator begin() const { return first; } ArrayRangeIterator end() const { return next; } }; @@ -138,6 +139,7 @@ namespace netgen } /// Access array, one-based (old fashioned) + // [[deprecated("Use operator[] instead")]] const T & Get (int i) const { #ifdef DEBUG @@ -531,13 +533,15 @@ namespace netgen IndirectArray (const TA1 & aa, const TA2 & aia) : array(aa), ia(aia) { ; } int Size() const { return ia.Size(); } + [[deprecated("Use *Range().begin() instead")]] int Begin() const { return ia.Begin(); } + [[deprecated("Use *Range().end() instead")]] int End() const { return ia.End(); } const typename TA1::TELEM & operator[] (int i) const { return array[ia[i]]; } auto Range() const { return ia.Range(); } - auto begin() const { return ia.begin(); } - auto end() const { return ia.end(); } + // auto begin() const { return ia.begin(); } + // auto end() const { return ia.end(); } }; diff --git a/libsrc/gprim/geomobjects.hpp b/libsrc/gprim/geomobjects.hpp index 6cdb273f..5b028c99 100644 --- a/libsrc/gprim/geomobjects.hpp +++ b/libsrc/gprim/geomobjects.hpp @@ -278,8 +278,10 @@ namespace netgen template void Set (const IndirectArray & points) { - Set (points[points.Begin()]); - for (int i = points.Begin()+1; i < points.End(); i++) + // Set (points[points.Begin()]); + Set (points[*points.Range().begin()]); + // for (int i = points.Begin()+1; i < points.End(); i++) + for (int i : points.Range().Modify(1,0)) Add (points[i]); } diff --git a/libsrc/meshing/delaunay.cpp b/libsrc/meshing/delaunay.cpp index 1c675f28..9516f28f 100644 --- a/libsrc/meshing/delaunay.cpp +++ b/libsrc/meshing/delaunay.cpp @@ -628,10 +628,12 @@ namespace netgen prim = prims[i]; } - for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) + // for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) + for (PointIndex pi : mesh.Points().Range().Modify(0, -4)) mixed[pi] = PointIndex ( (prim * pi) % np + PointIndex::BASE ); - for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) + // for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) + for (PointIndex pi : mesh.Points().Range().Modify(0, -4)) { if (pi % 1000 == 0) {