MADNESS  version 0.9
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
madness::IndexIterator Class Reference

#include <indexit.h>

Inheritance diagram for madness::IndexIterator:
Inheritance graph
[legend]

Public Member Functions

template<typename V >
 IndexIterator (const V &limits)
 Iterates dimension d from 0 to limts[d]-1 inclusive. More...
 
 IndexIterator (int ndim, const long limits[])
 Iterates dimension d from 0 to limts[d]-1 inclusive. More...
 
 IndexIterator (int ndim, long top)
 Iterates all dimensions from 0 to top-1 inclusive. More...
 
virtual ~IndexIterator ()
 
IndexIteratorreset ()
 
long operator[] (int d) const
 
const std::vector< long > & operator* () const
 
 operator bool () const
 
virtual IndexIteratoroperator++ ()
 this function should be abstracted and deprecated More...
 

Static Public Member Functions

static void test ()
 this function should also be deprecated More...
 

Protected Attributes

std::vector< long > n
 User specified upper limits for each dimension. More...
 
std::vector< long > i
 Current index. More...
 
bool finished
 

Detailed Description

Facilitates iteration through a multidimension index space. Since there are multiple ways for navigating index space (column- vs. row-major, etc.), this class should be abstract, with an abstract ++ operator. The original IndexIterator assumed the highest dimension (NDIM-1) would be iterated quickest (this index changes each time ++ is called), however, sometimes a different order is desired.

For legacy purposes, operator++ is thus NOT abstract, but has the implementation of the HighDimIndexIterator defined below. Eventually, the IndexIterator::operator++ should be deprecated, and such instances of IndexIterator replaced with HighDimIndexIterator.

Constructor & Destructor Documentation

template<typename V >
madness::IndexIterator::IndexIterator ( const V limits)
inline

Iterates dimension d from 0 to limts[d]-1 inclusive.

madness::IndexIterator::IndexIterator ( int  ndim,
const long  limits[] 
)
inline

Iterates dimension d from 0 to limts[d]-1 inclusive.

madness::IndexIterator::IndexIterator ( int  ndim,
long  top 
)
inline

Iterates all dimensions from 0 to top-1 inclusive.

virtual madness::IndexIterator::~IndexIterator ( )
inlinevirtual

Member Function Documentation

madness::IndexIterator::operator bool ( ) const
inline

References finished.

const std::vector<long>& madness::IndexIterator::operator* ( ) const
inline

References i.

virtual IndexIterator& madness::IndexIterator::operator++ ( )
inlinevirtual

this function should be abstracted and deprecated

Reimplemented in madness::NonstandardIndexIterator, madness::LowDimIndexIterator, and madness::HighDimIndexIterator.

long madness::IndexIterator::operator[] ( int  d) const
inline
IndexIterator& madness::IndexIterator::reset ( )
inline
static void madness::IndexIterator::test ( )
inlinestatic

this function should also be deprecated

References n, and madness::print().

Member Data Documentation

bool madness::IndexIterator::finished
protected
std::vector<long> madness::IndexIterator::i
protected
std::vector<long> madness::IndexIterator::n
protected

The documentation for this class was generated from the following file: