FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

An iterator which allows to access each component element type of an array of vectors, or a vector of arrays. More...

#include <Iterator.hpp>

Inheritance diagram for Fiber::ElementIterator< T >:
Fiber::HyperslabParameters Fiber::IteratorBase< vec3 > Fiber::IteratorBase< double > Fiber::IteratorBase< Eagle::FixedArray > Fiber::IteratorBase< T > Fiber::Iterator< vec3 > Fiber::Iterator< double > Fiber::Iterator< Eagle::FixedArray > Fiber::Iterator< T > Fiber::Iterator< Eagle::FixedArray< T, C > > Fiber::CreativeIterator< T > Fiber::MultiArrayBase< N, T > Fiber::MultiArrayBase< 1, T > Fiber::MultiArray< N, T, std::index_sequence< Is... > >

Public Types

typedef Eagle::MetaInfo< T > info_t
 
typedef info_t::element_t element_info_t
 

Public Member Functions

 ElementIterator (index_t Length, T *Data, index_t Stride, index_t Offset)
 Construct an element iterator.
 
 ElementIterator (const ElementIterator &It)
 Copy Constructor.
 
 ElementIterator (const HyperslabParameters &It, T *newData)
 Constructor compatible iterator with new data.
 
 ElementIterator (index_t i, const ElementIterator &It, const Add &)
 Addition Constructor.
 
void SetNewData (T *newData, index_t newLength) throw ()
 Change the stored data chunk to a new location and length.
 
T * ptr (int c=0) const
 Return pointer to data, which is good for C interface, but otherwise, avoid that.
 
T & getElement (index_t i, int c) const
 Element access (no range check!).
 
 operator bool () const
 Implicit conversion to boolean: Check whether this is a valid pointer.
 
- Public Member Functions inherited from Fiber::HyperslabParameters
 HyperslabParameters (index_t Length, index_t Stride, index_t Offset) throw ()
 Simple constructorm sets shift and cropped members to zero.
 
 HyperslabParameters (const HyperslabParameters &H) throw ()
 Copy constructor.
 
 HyperslabParameters (index_t i, const HyperslabParameters &H) throw ()
 Pointer addition constructor (sets the shift member).
 
index_t getLength () const throw ()
 Return the number of elements which can be accessed through this ElementIterator.
 
index_t getOffset () const throw ()
 
index_t getStride () const throw ()
 
index_t getShift () const throw ()
 
index_t getCropped () const throw ()
 
bool isSeparatedCompound () const throw ()
 Tell if the iterator refers to a data set which is built from arrays of structure members, i.e.
 
index_t multiplicity () const throw ()
 Return number of elements which form an entity.
 
index_t maxcount () const throw ()
 Return the number of steps which can be traversed through this ElementIterator.
 
index_t count () const throw ()
 Return the number of steps which can be traversed through this ElementIterator.
 
void setCount (index_t size) throw ()
 Set the maximally allowed count, i.e.
 
index_t getIndex (index_t i, int c) const throw ()
 Given a major and a minor index, compute the overall index in the dataset according to.
 
HyperslabParametersgetHyperslabParameters () throw ()
 
const HyperslabParametersgetHyperslabParameters () const throw ()
 

Protected Member Functions

void incPtr (index_t what)
 

Protected Attributes

index_t length
 The length (number of elements) of the data array.
 
index_t stride
 
index_t offset
 
index_t shift
 
index_t cropped
 
- Protected Attributes inherited from Fiber::HyperslabParameters
index_t length
 The length (number of elements) of the data array.
 
index_t stride
 
index_t offset
 
index_t shift
 
index_t cropped
 

Detailed Description

template<class T>
class Fiber::ElementIterator< T >

An iterator which allows to access each component element type of an array of vectors, or a vector of arrays.

The provided indexing scheme is two-dimensional, for the array index first and then the component.

The iterator works both for arrays of vectors as well as for vectors of arrays. However, manual setup of the right parameters is tedious. The derived Iterator classes provide a more convenient interface to do so.

Note
No range check is performed here! The caller must ensure that the numerical values of the array and component index are valid.

Member Function Documentation

◆ getElement()

template<class T >
T & Fiber::ElementIterator< T >::getElement ( index_t  i,
int  c 
) const
inline

Element access (no range check!).

Each element of the data array is accessed according to

data[ (shift + i)*stride + c*offset]

This indexing scheme works both for arrays of vectors and vectors of arrays.

Parameters
ithe array index
cthe component index

References Fiber::HyperslabParameters::count(), Fiber::HyperslabParameters::getIndex(), and Fiber::HyperslabParameters::getLength().

Referenced by Fiber::Iterator< T >::getValue(), Fiber::MultiArrayBase< 1, T >::operator[](), Fiber::Iterator< T >::operator[](), Fiber::MultiArrayBase< 1, T >::operator[](), and Fiber::Iterator< T >::set().