DASH  0.3.0
dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope > Class Template Reference

Public Types

using iterator_category = std::random_access_iterator_tag
 
using value_type = ElementT
 
using difference_type = typename PatternT::index_type
 
using pointer = ElementT *
 
using reference = ElementT &
 
using HaloMemory_t = HaloMemory< HaloBlock_t >
 
using pattern_index_t = typename PatternT::index_type
 
using LocalLayout_t = CartesianIndexSpace< NumDimensions, MemoryArrange, pattern_index_t >
 
using StencilP_t = StencilPoint< NumDimensions >
 
using ElementCoords_t = std::array< pattern_index_t, NumDimensions >
 
using signed_pattern_size_t = typename std::make_signed< pattern_size_t >::type
 
using StencilOffsets_t = std::array< signed_pattern_size_t, NumStencilPoints >
 
using StencilSpecViews_t = StencilSpecificViews< HaloBlock_t, StencilSpecT >
 
using BoundaryViews_t = typename StencilSpecViews_t::BoundaryViews_t
 

Public Member Functions

 StencilIterator (ElementT *local_memory, HaloMemory_t *halomemory, const StencilSpecT *stencil_spec, const StencilOffsets_t *stencil_offsets, const ViewSpec_t &view_local, const ViewSpec_t &view_scope, pattern_index_t idx)
 Constructor. More...
 
 StencilIterator (ElementT *local_memory, HaloMemory_t *halomemory, const StencilSpecT *stencil_spec, const StencilOffsets_t *stencil_offsets, const ViewSpec_t &view_local, const BoundaryViews_t &boundary_views, pattern_index_t idx)
 Constructor. More...
 
 StencilIterator (const Self_t &other)=default
 Copy constructor. More...
 
Self_toperator= (const Self_t &other)=default
 Assignment operator. More...
 
reference operator* () const
 Dereference operator. More...
 
reference operator[] (pattern_index_t n) const
 Subscript operator, returns global reference to element at given global index. More...
 
pattern_index_t rpos () const
 
pattern_index_t lpos () const
 
ElementCoords_t coords () const
 
bool is_halo_value (const region_index_t index_stencil)
 
ElementT value_at (const region_index_t index_stencil)
 Returns the value for a given stencil point index (index postion in StencilSpec) More...
 
ElementT value_at (const StencilP_t &stencil)
 
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...
 
Self_toperator+= (pattern_index_t n)
 
Self_toperator-= (pattern_index_t n)
 
Self_t operator+ (pattern_index_t n) const
 
Self_t operator- (pattern_index_t n) const
 
difference_type operator- (const Self_t &other) const
 
bool operator< (const Self_t &other) const
 
bool operator<= (const Self_t &other) const
 
bool operator> (const Self_t &other) const
 
bool operator>= (const Self_t &other) const
 
bool operator== (const Self_t &other) const
 
bool operator!= (const Self_t &other) const
 

Static Public Member Functions

static constexpr dim_t ndim ()
 The number of dimensions of the iterator's underlying pattern. More...
 

Detailed Description

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
class dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >

Definition at line 871 of file StencilIterator.h.

Constructor & Destructor Documentation

◆ StencilIterator() [1/3]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::StencilIterator ( ElementT *  local_memory,
HaloMemory_t halomemory,
const StencilSpecT stencil_spec,
const StencilOffsets_t *  stencil_offsets,
const ViewSpec_t &  view_local,
const ViewSpec_t &  view_scope,
pattern_index_t  idx 
)
inline

Constructor.

Parameters
local_memoryPointer to the begining of the local NArray memory
halomemoryHaloMemory instance for loacl halo memory
stencil_specStencilSpec to use
stencil_offsetsstencil offsets for every stencil point
view_locallocal SpecView including all local elements
view_scopeViewSpec to use
idxposition of the iterator

Definition at line 917 of file StencilIterator.h.

922  : _halomemory(halomemory), _stencil_spec(stencil_spec),
923  _stencil_offsets(stencil_offsets), _view(view_scope),
924  _local_memory(local_memory),
925  _local_layout(view_local.extents()), _idx(idx) {
926  _size = _view.size();
927  if(_idx < _size)
928  set_coords();
929 
930  const auto ext_max = stencil_spec->minmax_distances(FastestDimension);
931  if(Scope == StencilViewScope::INNER) {
932  _ext_dim_reduced = std::make_pair(
933  _view.offset(FastestDimension),
934  _local_layout.extent(FastestDimension) - ext_max.second - 1);
935  } else {
936  _ext_dim_reduced =
937  std::make_pair(std::abs(ext_max.first),
938  _view.extent(FastestDimension) - ext_max.second - 1);
939  }
940  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
DistanceAll_t minmax_distances() const
Returns the minimal and maximal distances of all stencil points for all dimensions.
Definition: Stencil.h:267

◆ StencilIterator() [2/3]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::StencilIterator ( ElementT *  local_memory,
HaloMemory_t halomemory,
const StencilSpecT stencil_spec,
const StencilOffsets_t *  stencil_offsets,
const ViewSpec_t &  view_local,
const BoundaryViews_t &  boundary_views,
pattern_index_t  idx 
)
inline

Constructor.

Parameters
local_memoryPointer to the begining of the local NArray memory
halomemoryHaloMemory instance for halo memory elements
stencil_specStencilSpec to use
stencil_offsetsstencil offsets for every stencil point
view_locallocal SpecView including all local elements
boundary_viewsall relevant boundary views
idxposition of the iterator

Definition at line 953 of file StencilIterator.h.

958  : _halomemory(halomemory), _stencil_spec(stencil_spec),
959  _stencil_offsets(stencil_offsets),
960  _view(view_local.extents()),
961  _boundary_views(boundary_views),
962  _local_memory(local_memory),
963  _local_layout(view_local.extents()), _idx(idx) {
964  _size = 0;
965  for(const auto& view : boundary_views)
966  _size += view.size();
967 
968  if(_idx < _size)
969  set_coords();
970 
971  const auto ext_max = stencil_spec->minmax_distances(FastestDimension);
972 
973  _ext_dim_reduced =
974  std::make_pair(std::abs(ext_max.first),
975  _view.extent(FastestDimension) - ext_max.second - 1);
976  }
DistanceAll_t minmax_distances() const
Returns the minimal and maximal distances of all stencil points for all dimensions.
Definition: Stencil.h:267

◆ StencilIterator() [3/3]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::StencilIterator ( const Self_t other)
default

Copy constructor.

Member Function Documentation

◆ ndim()

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
static constexpr dim_t dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::ndim ( )
inlinestatic

The number of dimensions of the iterator's underlying pattern.

See also
Global Iterator Concept

Definition at line 995 of file StencilIterator.h.

995 { return NumDimensions; }

◆ operator*()

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
reference dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator* ( ) const
inline

Dereference operator.

Returns
A global reference to the element at the iterator's position.

Definition at line 1002 of file StencilIterator.h.

1002 { return *_current_lmemory_addr; }

◆ operator++() [1/2]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
Self_t& dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator++ ( )
inline

Prefix increment operator.

Definition at line 1059 of file StencilIterator.h.

1059  {
1060  ++_idx;
1061  next_element();
1062 
1063  return *this;
1064  }

◆ operator++() [2/2]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
Self_t dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 1069 of file StencilIterator.h.

1069  {
1070  Self_t result = *this;
1071  ++_idx;
1072  next_element();
1073 
1074  return result;
1075  }

◆ operator--() [1/2]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
Self_t& dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator-- ( )
inline

Prefix decrement operator.

Definition at line 1080 of file StencilIterator.h.

1080  {
1081  --_idx;
1082  set_coords();
1083 
1084  return *this;
1085  }

◆ operator--() [2/2]

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
Self_t dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator-- ( int  )
inline

Postfix decrement operator.

Definition at line 1090 of file StencilIterator.h.

1090  {
1091  Self_t result = *this;
1092  --_idx;
1093  if(_idx < _size) {
1094  _coords = set_coords(_idx);
1095  set_offsets();
1096  }
1097 
1098  return result;
1099  }

◆ operator=()

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
Self_t& dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator= ( const Self_t other)
default

Assignment operator.

See also
Global Iterator Concept

◆ operator[]()

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
reference dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::operator[] ( pattern_index_t  n) const
inline

Subscript operator, returns global reference to element at given global index.

See also
Global Iterator Concept

Definition at line 1010 of file StencilIterator.h.

1010  {
1011  auto coords = set_coords(_idx + n);
1012  return _local_memory[_local_layout.at(coords)];
1013  }
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429

◆ value_at()

template<typename ElementT, typename PatternT, typename GlobMemT, typename StencilSpecT, StencilViewScope Scope>
ElementT dash::halo::StencilIterator< ElementT, PatternT, GlobMemT, StencilSpecT, Scope >::value_at ( const region_index_t  index_stencil)
inline

Returns the value for a given stencil point index (index postion in StencilSpec)

Definition at line 1040 of file StencilIterator.h.

1040  {
1041  return *(_stencil_mem_ptr[index_stencil]);
1042  }

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