LTL
2.0.x
|
Classes | |
class | ltl::IndexIter< T, N > |
Functions | |
template<typename T1 , int N> | |
ExprNode< IndexIterDimExpr< T1, int, N >, N > | ltl::indexPosInt (const MArray< T1, N > &a, const int dim) |
template<typename T1 , int N> | |
ExprNode< IndexIterDimExpr< T1, float, N >, N > | ltl::indexPosFlt (const MArray< T1, N > &a, const int dim) |
template<typename T1 , int N> | |
ExprNode< IndexIterDimExpr< T1, double, N >, N > | ltl::indexPosDbl (const MArray< T1, N > &a, const int dim) |
Iterator object holding vector of index values for each position. In many situations one has to fill arrays with values that are expressed as functions of "coordinates" within the array, or more generally, as functions of the array's indices. Imagine setting up initial conditions for a PDE, e.g. a circular sine wave on a 2-d surface. For this purpose index iterators are provided. They behave much like normal iterators, but instead of returning the array's value they return the indices of the element they currently point to.
An index iterator can be obtained from an MArray
by calling indexBegin()
:
Return an IndexIterator
for the current ltl::MArray
.
An index iterator always iterates over the index ranges of the array it was created from. They are used in the same way as normal iterators, except that they have some additional methods and no operator*
:
Mostly you will prefer to use the 'automatic' version of the index iterators directly in expressions rather than creating an index iterator by hand and writing out the loop, Array Expressions. These look like an ordinary function in the expression. The "function" simply evaluates to the index of the current element during elementwise evaluation of the expression, e.g.
While indexPos()
evaluates to an int
, there are also spcialized versions that return float
and double
values, indexPosFlt()
and indexPosDbl()
, respectively. These are provided for convenience to avoid having to use cast expressions frequently.
|
inline |
and the wrapper... use indexPosInt( A ) in an expression to refer to the current index in MArray A during expression evaluation.
Use indexPosInt( A, i ) in an expression to refer to the i-th dimension's index in MArray A during expression evaluation. The index value is returned as an int
.
References ltl::MArray< T, N >::indexBegin().
Referenced by Gaussian< TPAR, TDAT, 5, 2 >::fillExp(), and ltl::Gnuplot::send().
|
inline |
indexPosFlt() return the index value as a float.
References ltl::MArray< T, N >::indexBegin().
|
inline |
indexPosDbl() returns the index value as a double.
References ltl::MArray< T, N >::indexBegin().
Referenced by Gaussian< TPAR, TDAT, 7, 2 >::fill(), Gaussian< TPAR, TDAT, 5, 2 >::fill(), PolyGaussian< TPAR, TDAT, 5, 2 >::fill(), Moffat< TPAR, TDAT, 10, 2 >::fill(), Moffat< TPAR, TDAT, 8, 2 >::fill(), and PolyGaussian< TPAR, TDAT, 5, 2 >::fillExp().