Proto  3.2
Public Member Functions | Protected Attributes | List of all members
Proto::DataIterator< P > Class Template Reference

Distributed Data Iterator. More...

#include <Proto_DataIndex.H>

Public Member Functions

 DataIterator (std::shared_ptr< P > a_partition)
 Manual Constructor. More...
 
DataIterator< P > & begin ()
 Set To Start. More...
 
DataIterator< P > & end ()
 Set To End. More...
 
bool ok () const
 Continue Query. More...
 
unsigned int localSize () const
 Size. More...
 
DataIterator< P > & operator++ ()
 Increment. More...
 
bool operator== (const DataIterator< P > &a_rhs) const
 Equality. More...
 
bool operator== (const DataIndex< P > &a_rhs) const
 Equality. More...
 
bool operator!= (const DataIterator< P > &a_rhs) const
 Inquality. More...
 
bool operator!= (const DataIndex< P > &a_rhs) const
 Inquality. More...
 
const DataIndex< P > operator[] (unsigned int a_index) const
 Integer Dereference (code is in implem file) More...
 
const DataIndex< P > & operator* () const
 Dereference. More...
 
bool compatible (const P &a_partition) const
 
bool compatible (const DataIndex< P > &a_index) const
 
bool compatible (const DataIterator< P > &a_iter) const
 

Protected Attributes

std::shared_ptr< P > m_partition
 
DataIndex< P > m_current
 
DataIndex< P > m_end
 

Detailed Description

template<typename P>
class Proto::DataIterator< P >

Distributed Data Iterator.

Iterate through the local contents of a data layout specified by the template class P. Unlike normal iterators, DataIterator

dereferences into a DataIndex

which can be used to index into various data holders that are specifically designed to work in tandem with it.

Supported objects: DisjointBoxLayout (P = BoxPartition) LevelBoxData (P = BoxPartition)

Proto objects are specifically designed to use STL-like iteration syntax which makes the specific implementation of DataIterator (and it's template argument) invisible to the end user. See the code below for sample usage:

DisjointBoxLayout layout(...);
LevelBoxData<double> data(layout, ...);
for (auto iter : layout)
{
// iter is a DataIndex object which can be used to index into data holders
Box b = layout[iter];
BoxData<double>& patch = data[iter];
// etc
}

Constructor & Destructor Documentation

◆ DataIterator()

template<typename P >
Proto::DataIterator< P >::DataIterator ( std::shared_ptr< P >  a_partition)
inline

Manual Constructor.

Construct a DataIterator from an existing DisjointBoxLayout. This constructor is mostly used internally. Users can rely on the STL style iteration syntax of container objects (e.g. LevelBoxData or DisjointBoxLayout)

Referenced by Proto::DataIterator< P >::operator++().

Member Function Documentation

◆ begin()

template<typename P >
DataIterator< P > & Proto::DataIterator< P >::begin ( )
inline

Set To Start.

Modifies the *this and returns it

Referenced by Proto::CoarseFineBoundary< P >::CoarseFineBoundary().

◆ end()

template<typename P >
DataIterator< P > & Proto::DataIterator< P >::end ( )
inline

Set To End.

modifies *this and returns it

Referenced by Proto::CoarseFineBoundary< P >::CoarseFineBoundary().

◆ ok()

template<typename P >
bool Proto::DataIterator< P >::ok ( ) const
inline

Continue Query.

Shortcut to check if *this has reached its end.

◆ localSize()

template<typename P >
unsigned int Proto::DataIterator< P >::localSize ( ) const
inline

Size.

Number of iterates on this processor

◆ operator++()

template<typename P >
DataIterator< P > & Proto::DataIterator< P >::operator++ ( )
inline

◆ operator==() [1/2]

template<typename P>
bool Proto::DataIterator< P >::operator== ( const DataIterator< P > &  a_rhs) const
inline

Equality.

◆ operator==() [2/2]

template<typename P>
bool Proto::DataIterator< P >::operator== ( const DataIndex< P > &  a_rhs) const
inline

Equality.

References Proto::DataIterator< P >::m_current.

◆ operator!=() [1/2]

template<typename P>
bool Proto::DataIterator< P >::operator!= ( const DataIterator< P > &  a_rhs) const
inline

Inquality.

References Proto::DataIterator< P >::m_current.

◆ operator!=() [2/2]

template<typename P>
bool Proto::DataIterator< P >::operator!= ( const DataIndex< P > &  a_rhs) const
inline

Inquality.

References Proto::DataIterator< P >::m_current.

◆ operator[]()

template<typename P >
const DataIndex< P > Proto::DataIterator< P >::operator[] ( unsigned int  a_index) const
inline

Integer Dereference (code is in implem file)

◆ operator*()

template<typename P >
const DataIndex< P > & Proto::DataIterator< P >::operator* ( ) const
inline

Dereference.

Unlike normal iterators, dereferencing a DataIterator returns a DataIndex. DataIndex is accepted by all "level scope" data holders (e.g. LevelBoxData or DisjointBoxLayout).

◆ compatible() [1/3]

template<typename P >
bool Proto::DataIterator< P >::compatible ( const P &  a_partition) const
inline

◆ compatible() [2/3]

template<typename P >
bool Proto::DataIterator< P >::compatible ( const DataIndex< P > &  a_index) const
inline

◆ compatible() [3/3]

template<typename P >
bool Proto::DataIterator< P >::compatible ( const DataIterator< P > &  a_iter) const
inline

Member Data Documentation

◆ m_partition

template<typename P>
std::shared_ptr<P> Proto::DataIterator< P >::m_partition
protected

◆ m_current

template<typename P>
DataIndex<P> Proto::DataIterator< P >::m_current
protected

◆ m_end

template<typename P>
DataIndex<P> Proto::DataIterator< P >::m_end
protected

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