casa
5.7.0-16
|
Iterate an Array cursor through another Array. More...
#include <Array.h>
Public Member Functions | |
ArrayIterator (const Array< T > &arr, uInt byDim=1) | |
Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim"). More... | |
ArrayIterator (const Array< T > &arr, const IPosition &axes, Bool axesAreCursor=True) | |
Step through an array using the given axes. More... | |
virtual | ~ArrayIterator () |
virtual void | next () |
Move the cursor to the next position. More... | |
virtual void | set (const IPosition &cursorPos) |
Set the cursor to the given position. More... | |
virtual void | reset () |
Reset the cursor to the beginning. More... | |
Array< T > & | array () |
Return the cursor. More... | |
virtual ArrayBase & | getArray () |
Get the array in the cursor. More... | |
Public Member Functions inherited from casacore::ArrayPositionIterator | |
ArrayPositionIterator (const IPosition &shape, const IPosition &origin, uInt byDim) | |
Define the shape and origin of the volume the cursor will step through. More... | |
ArrayPositionIterator (const IPosition &shape, uInt byDim) | |
ArrayPositionIterator (const IPosition &shape, const IPosition &axes, Bool axesAreCursor=True) | |
Step through an array using the given axes. More... | |
virtual | ~ArrayPositionIterator () |
void | origin () |
Bool | atStart () const |
Returns true of the cursor is at the origin. More... | |
Bool | pastEnd () const |
Returns true if the cursor has moved past the end of its volume. More... | |
const IPosition & | pos () const |
Return the position of the cursor. More... | |
IPosition | endPos () const |
Return the end position of the cursor. More... | |
uInt | ndim () const |
What is the dimensionality of the volume we are iterating through? More... | |
const IPosition & | iterAxes () const |
Return the iteration axes. More... | |
const IPosition & | cursorAxes () const |
Return the cursor axes. More... | |
Protected Attributes | |
Array< T > * | ap_p |
A pointer to the cursor. More... | |
Private Member Functions | |
void | init (const Array< T > &) |
helper function to centralize construction work More... | |
void | apSetPointer (Int stepDim) |
helper function to set the pointer to the new data position in ap after a step in the given dimension. More... | |
ArrayIterator (const ArrayIterator< T > &) | |
ArrayIterator< T > & | operator= (const ArrayIterator< T > &) |
Private Attributes | |
Array< T > | pOriginalArray_p |
IPosition | offset_p |
T * | dataPtr_p |
Additional Inherited Members | |
Protected Member Functions inherited from casacore::ArrayPositionIterator | |
uInt | nextStep () |
Advance cursor to its next position and tell which dimension stepped. More... | |
uInt | dimIter () const |
What is the dimensionality of the "step" the cursor takes, i.e. More... | |
Iterate an Array cursor through another Array.
ArrayIterator steps an array section (the "cursor") through an array. The cursor "refers" to storage in the array, so that changing the values in the cursor changes values in the original array. Like with ArrayPositionIterator, the cursor presently only moves through the array from bottom to top in the obvious way; however one may of course iterate through a slice ("array section"). This class is derived from ArrayPositionIterator since it also has a position (the blc of the cursor) which moves through the array volume.
Tip: The origin of the cursor, i;e; the subarray that moves through the larger array, is always zero;
|
explicit |
Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim").
casacore::ArrayIterator< T >::ArrayIterator | ( | const Array< T > & | arr, |
const IPosition & | axes, | ||
Bool | axesAreCursor = True |
||
) |
Step through an array using the given axes.
The axes can be given in two ways:
E.g. when using iteration axes 2,0 for an array with shape [5,3,7], each iteration step returns a cursor (containing the data of axis 1). During the iteration axis 2 will vary most rapidly (as it was given first).
|
virtual |
|
private |
|
private |
helper function to set the pointer to the new data position in ap after a step in the given dimension.
-1 resets it to the beginning.
|
inline |
Return the cursor.
(Perhaps we should have a fn() that returns a reference to the original array as well?)
Definition at line 118 of file ArrayIter.h.
Referenced by casa::CalStats::stats().
|
virtual |
Get the array in the cursor.
This is only implemented in the derived ArrayIterator class. By default it throws an exception.
Reimplemented from casacore::ArrayPositionIterator.
|
private |
helper function to centralize construction work
|
virtual |
Move the cursor to the next position.
Reimplemented from casacore::ArrayPositionIterator.
Referenced by casa::CalStats::stats(), and casacore::TableExprNodeSet::toArray().
|
private |
|
virtual |
Reset the cursor to the beginning.
Reimplemented from casacore::ArrayPositionIterator.
|
virtual |
Set the cursor to the given position.
The position can only contain the iteration axes or it can be the full position.
In the first case the position must to be given in the order of the iteration axes as given in the constructor. In the latter case the position must be given in natural order (as given by function pos
and only the cursor axes are taken into account.
Reimplemented from casacore::ArrayPositionIterator.
|
protected |
A pointer to the cursor.
Definition at line 125 of file ArrayIter.h.
Referenced by casacore::ArrayIterator< casacore::Bool >::array(), casacore::MatrixIterator< T >::matrix(), and casacore::VectorIterator< T >::vector().
|
private |
Definition at line 136 of file ArrayIter.h.
|
private |
Definition at line 135 of file ArrayIter.h.
|
private |
Definition at line 134 of file ArrayIter.h.