MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | 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 ()
 
 operator bool () const
 
const std::vector< long > & operator* () const
 
virtual IndexIteratoroperator++ ()
 this function should be abstracted and deprecated More...
 
long operator[] (int d) const
 
IndexIteratorreset ()
 

Static Public Member Functions

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

Protected Attributes

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

Private Member Functions

 IndexIterator ()
 Bury the default constructor. More...
 

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

◆ IndexIterator() [1/4]

madness::IndexIterator::IndexIterator ( )
inlineprivate

Bury the default constructor.

◆ IndexIterator() [2/4]

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

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

References d(), and n.

◆ IndexIterator() [3/4]

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

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

References d(), and n.

◆ IndexIterator() [4/4]

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

Iterates all dimensions from 0 to top-1 inclusive.

◆ ~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::NonstandardIndexIterator, madness::LowDimIndexIterator, and madness::HighDimIndexIterator.

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()

static void madness::IndexIterator::test ( )
inlinestatic

this function should also be deprecated

References n, and madness::print().

Member Data Documentation

◆ finished

bool madness::IndexIterator::finished
protected

◆ i

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

◆ n

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

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