DASH  0.3.0
dash::halo::StencilOperator< HaloBlockT, StencilSpecT > Class Template Reference

The StencilOperator provides stencil specific iterator and functions for a given HaloBlock and HaloMemory. More...

#include <StencilOperator.h>

Public Types

using Inner_t = StencilOperatorInner< Self_t >
 
using Bnd_t = StencilOperatorBoundary< Self_t >
 
using Element_t = typename HaloBlockT::Element_t
 
using index_t = typename std::make_signed< typename Pattern_t::index_type >::type
 
using uindex_t = typename std::make_unsigned< index_t >::type
 
using StencilOffsets_t = std::array< index_t, NumStencilPoints >
 
using HaloBlock_t = HaloBlockT
 
using HaloMemory_t = HaloMemory< HaloBlock_t >
 
using ViewSpec_t = typename HaloBlockT::ViewSpec_t
 
using Coords_t = std::array< index_t, NumDimensions >
 
using StencilSpec_t = StencilSpecT
 
using StencilSpecViews_t = StencilSpecificViews< HaloBlock_t, StencilSpecT >
 
using stencil_index_t = typename StencilSpecT::stencil_index_t
 
using iterator = StencilIterator< Element_t, Pattern_t, typename HaloBlockT::GlobMem_t, StencilSpecT, StencilViewScope::ALL >
 
using const_iterator = const iterator
 
using CoordsIdxManagerInner_t = CoordsIdxManagerInner< Self_t >
 
using iterator_inner = StencilIteratorTest< CoordsIdxManagerInner_t >
 
using const_iterator_inner = const iterator
 
using CoordsIdxManagerBoundary_t = CoordsIdxManagerBoundary< Self_t >
 
using iterator_bnd = StencilIteratorTest< CoordsIdxManagerBoundary_t >
 
using const_iterator_bnd = const iterator
 

Public Member Functions

 StencilOperator (const HaloBlockT *haloblock, Element_t *local_memory, HaloMemory_t *halomemory, const StencilSpecT &stencil_spec)
 Constructor that takes a HaloBlock, a HaloMemory, a StencilSpec and a local ViewSpec. More...
 
iterator begin () noexcept
 Returns the begin iterator for all relevant elements (inner + boundary) More...
 
const_iterator begin () const noexcept
 Returns the begin const iterator for all relevant elements (inner + boundary) More...
 
iterator end () noexcept
 Returns the end iterator for all relevant elements (inner + boundary) More...
 
const_iterator end () const noexcept
 Returns the end const iterator for all relevant elements (inner + boundary) More...
 
const HaloBlock_t & halo_block ()
 Returns the HaloBlock. More...
 
const StencilSpecTstencil_spec () const
 Returns the stencil specification StencilSpec. More...
 
HaloMemory_thalo_memory ()
 Returns the halo memory management object HaloMemory. More...
 
Element_t * local_memory ()
 Returns the halo memory management object HaloMemory. More...
 
const StencilSpecViews_tspec_views () const
 Returns the StencilSpecificView. More...
 
const ViewSpec_t & view () const
 Returns a SpecView including inner and boundary elements. More...
 
const ViewSpec_t & view_local () const
 Returns the local SpecView. More...
 
const StencilOffsets_t & stencil_offsets () const
 Returns the offsets for each stencil point. More...
 
const index_t stencil_offset_at (std::size_t pos) const
 Returns the offset for specific stencil point. More...
 
index_t get_offset (const Coords_t &coords) const
 Returns the local memory offset for a given coordinate. More...
 

Static Public Member Functions

static decltype(auto) constexpr ndim ()
 
static decltype(auto) constexpr memory_order ()
 
static decltype(auto) constexpr num_stencil_points ()
 

Public Attributes

Inner_t inner
 
Bnd_t boundary
 

Detailed Description

template<typename HaloBlockT, typename StencilSpecT>
class dash::halo::StencilOperator< HaloBlockT, StencilSpecT >

The StencilOperator provides stencil specific iterator and functions for a given HaloBlock and HaloMemory.

Provided StencilIterator are for the inner block, the boundary elements and both. The inner block iterator ensures that no stencil point accesses halo elements or not existing elements. The stencil points of the boundary iterator point at least to one halo element.

Example for an inner block boundary iteration space:

                     boundary region 1
                            :
              .-------------'------------.
              |                          |
      .-------.-------------------------.-------.
      |  0  1 |  2  3  4  5  6  7  8  9 | 10 11 |
      | 12 13 | 14 15 16 17 18 19 20 21 | 22 23 |
   .--:-------+-------------------------+-------:--.
   |  | 24 23 |                         | 34 35 |  |
 .-:  :  ...  :   inner block region    :  ...  :  :- boundary
 | |  | 60 62 |                         | 70 71 |  |  region 3
 | '--:-------+-------------------------+-------:--:
 |    | 72 73 | 74 75 76 77 78 79 80 81 | 82 83 |  :- boundary
 |    | 84 85 | 86 87 88 89 90 91 92 93 | 94 95 |  |  region 8
 |    `-------'-------------------------'-------'--'
 |            |                         |
 |            `------------.------------+
 :                         :
 boundary region 3   boundary region 8

Definition at line 24 of file StencilOperator.h.

Constructor & Destructor Documentation

◆ StencilOperator()

template<typename HaloBlockT , typename StencilSpecT >
dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::StencilOperator ( const HaloBlockT *  haloblock,
Element_t *  local_memory,
HaloMemory_t halomemory,
const StencilSpecT stencil_spec 
)
inline

Constructor that takes a HaloBlock, a HaloMemory, a StencilSpec and a local ViewSpec.

Definition at line 702 of file StencilOperator.h.

References dash::ndim().

707  : inner(this)
708  , boundary(this)
709  , _halo_block(haloblock)
710  , _local_memory(local_memory)
711  , _halo_memory(halomemory)
712  , _stencil_spec(stencil_spec)
713  , _view_local(&haloblock->view_local())
714  , _stencil_offsets(set_stencil_offsets())
715  , _spec_views(*_halo_block, _stencil_spec, _view_local)
716  , _begin(
717  _local_memory,
718  _halo_memory,
719  &_stencil_spec,
720  &_stencil_offsets,
721  *_view_local,
722  _spec_views.inner_with_boundaries(),
723  0)
724  , _end(
725  _local_memory,
726  _halo_memory,
727  &_stencil_spec,
728  &_stencil_offsets,
729  *_view_local,
730  _spec_views.inner_with_boundaries(),
731  _spec_views.inner_with_boundaries().size())
732  , _ibegin(CoordsIdxManagerInner_t(*this))
733  , _iend(CoordsIdxManagerInner_t(*this,
734  _spec_views.inner().size()))
735  , _bbegin(CoordsIdxManagerBoundary_t(*this))
736  , _bend(CoordsIdxManagerBoundary_t(*this,
737  _spec_views.boundary_size())) {
738  }
const ViewSpec_t & inner() const
Returns ViewSpec including all inner elements.
Definition: Halo.h:780
const ViewSpec_t & inner_with_boundaries() const
Returns ViewSpec including all inner and boundary elements.
Definition: Halo.h:785
pattern_size_t boundary_size() const
Returns the number of all boundary elements (no dublicates)
Definition: Halo.h:797
Element_t * local_memory()
Returns the halo memory management object HaloMemory.

Member Function Documentation

◆ begin() [1/2]

template<typename HaloBlockT , typename StencilSpecT >
iterator dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::begin ( )
inlinenoexcept

Returns the begin iterator for all relevant elements (inner + boundary)

Definition at line 749 of file StencilOperator.h.

749 { return _begin; }

◆ begin() [2/2]

template<typename HaloBlockT , typename StencilSpecT >
const_iterator dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::begin ( ) const
inlinenoexcept

Returns the begin const iterator for all relevant elements (inner + boundary)

Definition at line 755 of file StencilOperator.h.

755 { return _begin; }

◆ end() [1/2]

template<typename HaloBlockT , typename StencilSpecT >
iterator dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::end ( )
inlinenoexcept

Returns the end iterator for all relevant elements (inner + boundary)

Definition at line 760 of file StencilOperator.h.

760 { return _end; }

◆ end() [2/2]

template<typename HaloBlockT , typename StencilSpecT >
const_iterator dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::end ( ) const
inlinenoexcept

Returns the end const iterator for all relevant elements (inner + boundary)

Definition at line 766 of file StencilOperator.h.

766 { return _end; }

◆ get_offset()

template<typename HaloBlockT , typename StencilSpecT >
index_t dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::get_offset ( const Coords_t &  coords) const
inline

Returns the local memory offset for a given coordinate.

Definition at line 818 of file StencilOperator.h.

818  {
819  index_t offset = 0;
820 
821  if(MemoryArrange == ROW_MAJOR) {
822  offset = coords[0];
823  for(auto d = 1; d < NumDimensions; ++d)
824  offset = offset * _view_local->extent(d) + coords[d];
825  } else {
826  offset = coords[NumDimensions - 1];
827  for(auto d = NumDimensions - 1; d > 0;) {
828  --d;
829  offset = offset * _view_local->extent(d) + coords[d];
830  }
831  }
832 
833  return offset;
834  }

◆ halo_block()

template<typename HaloBlockT , typename StencilSpecT >
const HaloBlock_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::halo_block ( )
inline

Returns the HaloBlock.

Definition at line 771 of file StencilOperator.h.

771 { return *_halo_block; }

◆ halo_memory()

template<typename HaloBlockT , typename StencilSpecT >
HaloMemory_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::halo_memory ( )
inline

Returns the halo memory management object HaloMemory.

Definition at line 781 of file StencilOperator.h.

781 { return *_halo_memory; }

◆ local_memory()

template<typename HaloBlockT , typename StencilSpecT >
Element_t* dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::local_memory ( )
inline

Returns the halo memory management object HaloMemory.

Definition at line 786 of file StencilOperator.h.

786 { return _local_memory; }

◆ spec_views()

template<typename HaloBlockT , typename StencilSpecT >
const StencilSpecViews_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::spec_views ( ) const
inline

Returns the StencilSpecificView.

Definition at line 791 of file StencilOperator.h.

791 { return _spec_views; }

◆ stencil_offset_at()

template<typename HaloBlockT , typename StencilSpecT >
const index_t dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::stencil_offset_at ( std::size_t  pos) const
inline

Returns the offset for specific stencil point.

Definition at line 811 of file StencilOperator.h.

811  {
812  return _stencil_offsets[pos];
813  }

◆ stencil_offsets()

template<typename HaloBlockT , typename StencilSpecT >
const StencilOffsets_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::stencil_offsets ( ) const
inline

Returns the offsets for each stencil point.

Definition at line 806 of file StencilOperator.h.

806 { return _stencil_offsets; }

◆ stencil_spec()

template<typename HaloBlockT , typename StencilSpecT >
const StencilSpecT& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::stencil_spec ( ) const
inline

Returns the stencil specification StencilSpec.

Definition at line 776 of file StencilOperator.h.

776 { return _stencil_spec; }

◆ view()

template<typename HaloBlockT , typename StencilSpecT >
const ViewSpec_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::view ( ) const
inline

Returns a SpecView including inner and boundary elements.

Definition at line 796 of file StencilOperator.h.

796 { return _spec_views.inner_with_boundaries(); }
const ViewSpec_t & inner_with_boundaries() const
Returns ViewSpec including all inner and boundary elements.
Definition: Halo.h:785

◆ view_local()

template<typename HaloBlockT , typename StencilSpecT >
const ViewSpec_t& dash::halo::StencilOperator< HaloBlockT, StencilSpecT >::view_local ( ) const
inline

Returns the local SpecView.

Definition at line 801 of file StencilOperator.h.

801 { return *_view_local; }

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