mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Range::Modify()
This commit is contained in:
parent
b580de4d25
commit
234d441a90
@ -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<T> begin() const { return first; }
|
||||
ArrayRangeIterator<T> 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(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -278,8 +278,10 @@ namespace netgen
|
||||
template <typename T1, typename T2>
|
||||
void Set (const IndirectArray<T1, T2> & 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]);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user