MADNESS 0.10.1
madness::IndexIterator Class Reference

#include <indexit.h>

Inheritance diagram for madness::IndexIterator:

Public Member Functions

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

Static Public Member Functions

static void test ()
 this function should also be deprecated

Protected Attributes

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

Private Member Functions

 IndexIterator ()
 Bury the default constructor.

Detailed Description

Facilitates iteration through a multidimensional 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

◆ IndexIterator() [1/4]

◆ IndexIterator() [2/4]

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

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

References d, finished, i, n, and V().

◆ IndexIterator() [3/4]

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

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

References d, finished, i, and n.

◆ IndexIterator() [4/4]

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

Iterates all dimensions from 0 to top-1 inclusive.

References finished, i, and n.

◆ ~IndexIterator()

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

Member Function Documentation

◆ operator bool()

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

References finished.

◆ operator*()

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

References finished, i, and MADNESS_ASSERT.

◆ operator++()

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

this function should be abstracted and deprecated

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

References d, finished, i, and n.

◆ operator[]()

long madness::IndexIterator::operator[] ( int d) const
inline

References d, finished, i, and MADNESS_ASSERT.

◆ reset()

IndexIterator & madness::IndexIterator::reset ( )
inline

References d, finished, i, and n.

◆ test()

void madness::IndexIterator::test ( )
inlinestatic

this function should also be deprecated

References IndexIterator(), n, and madness::print().

Member Data Documentation

◆ finished

◆ i

◆ n

std::vector<long> madness::IndexIterator::n
protected

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