DASH  0.3.0
dash::PatternIterator< PatternType, IndexType > Class Template Reference

{}Usage: More...

#include <PatternIterator.h>

Classes

class  PatternLocalIterator
 

Public Member Functions

 PatternIterator (const PatternType &pattern)
 Constructor. More...
 
 PatternIterator (const self_t &other)
 Copy constructor. More...
 
PatternType::local_index_t operator* ()
 Dereference operator, returns unit and local offset at current iterator position in global cartesian index space. More...
 
self_toperator++ ()
 Prefix increment operator. More...
 
self_t operator++ (int)
 Postfix increment operator. More...
 
self_toperator-- ()
 Prefix decrement operator. More...
 
self_t operator-- (int)
 Postfix decrement operator. More...
 

Detailed Description

template<class PatternType, typename IndexType = dash::default_index_t>
class dash::PatternIterator< PatternType, IndexType >

{}

Usage:

Pattern<2> pattern(...)
// Iterate global indices:
for(auto global_index : pattern) {
// ...
}
// Same as
for(auto gi_it = pattern.begin(),
gi_end = pattern.end();
gi_it != gi_end;
++gi_it) {
Pattern<2>::index_type global_index = *gi_it;
// ...
}
// Iterate local indices:
for(auto local_index : pattern.local) {
// ...
}
// Same as
for(auto li_it = pattern.lbegin(),
li_end = pattern.lend();
li_it != li_end;
++li_it) {
Pattern<2>::index_type local_index = *li_it;
// ...
}

Definition at line 45 of file PatternIterator.h.

Constructor & Destructor Documentation

◆ PatternIterator() [1/2]

template<class PatternType , typename IndexType = dash::default_index_t>
dash::PatternIterator< PatternType, IndexType >::PatternIterator ( const PatternType &  pattern)
inline

Constructor.

Parameters
patternThe pattern to iterate

Definition at line 71 of file PatternIterator.h.

74  : _pattern(pattern),
75  _global_pos(0) {
76  }

◆ PatternIterator() [2/2]

template<class PatternType , typename IndexType = dash::default_index_t>
dash::PatternIterator< PatternType, IndexType >::PatternIterator ( const self_t other)
inline

Copy constructor.

Parameters
otherThe pattern to iterate

Definition at line 81 of file PatternIterator.h.

84  : _pattern(other._pattern),
85  _global_pos(other._global_pos) {
86  }

Member Function Documentation

◆ operator*()

template<class PatternType , typename IndexType = dash::default_index_t>
PatternType::local_index_t dash::PatternIterator< PatternType, IndexType >::operator* ( )
inline

Dereference operator, returns unit and local offset at current iterator position in global cartesian index space.

Definition at line 92 of file PatternIterator.h.

92  {
93  return _pattern.local(_global_pos);
94  }

◆ operator++() [1/2]

template<class PatternType , typename IndexType = dash::default_index_t>
self_t& dash::PatternIterator< PatternType, IndexType >::operator++ ( )
inline

Prefix increment operator.

Definition at line 99 of file PatternIterator.h.

99  {
100  ++_global_pos;
101  return *this;
102  }

◆ operator++() [2/2]

template<class PatternType , typename IndexType = dash::default_index_t>
self_t dash::PatternIterator< PatternType, IndexType >::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 107 of file PatternIterator.h.

107  {
108  self_t ret(*this);
109  ++_global_pos;
110  return ret;
111  }

◆ operator--() [1/2]

template<class PatternType , typename IndexType = dash::default_index_t>
self_t& dash::PatternIterator< PatternType, IndexType >::operator-- ( )
inline

Prefix decrement operator.

Definition at line 116 of file PatternIterator.h.

116  {
117  --_global_pos;
118  return *this;
119  }

◆ operator--() [2/2]

template<class PatternType , typename IndexType = dash::default_index_t>
self_t dash::PatternIterator< PatternType, IndexType >::operator-- ( int  )
inline

Postfix decrement operator.

Definition at line 124 of file PatternIterator.h.

124  {
125  self_t ret(*this);
126  --_global_pos;
127  return ret;
128  }

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