DASH  0.3.0
dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT > Class Template Reference

Proxy type representing local access to elements in a dash::Array. More...

#include <Array.h>

Public Types

typedef T value_type
 
typedef std::make_unsigned< IndexType >::type size_type
 
typedef IndexType index_type
 
typedef IndexType difference_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT > View
 Type alias for LocalArrayRef<T,I,P>::view_type. More...
 
typedef self_t local_type
 
typedef PatternType pattern_type
 
typedef std::integral_constant< dim_t, 1 > rank
 

Public Member Functions

 LocalArrayRef (const Array_t *array)
 Constructor, creates a local access proxy for the given array. More...
 
 LocalArrayRef (const Array_t *array, const ViewSpec_t &viewspec)
 
 LocalArrayRef (const self_t &)=default
 
 LocalArrayRef (self_t &&)=default
 
self_toperator= (const self_t &)=default
 
self_toperator= (self_t &&)=default
 
constexpr const_iterator begin () const noexcept
 Pointer to initial local element in the array. More...
 
iterator begin () noexcept
 Pointer to initial local element in the array. More...
 
constexpr const_iterator end () const noexcept
 Pointer past final local element in the array. More...
 
iterator end () noexcept
 Pointer past final local element in the array. More...
 
constexpr size_type size () const noexcept
 Number of array elements in local memory. More...
 
constexpr const_reference operator[] (const size_type n) const
 Subscript operator, access to local array element at given position. More...
 
reference operator[] (const size_type n)
 Subscript operator, access to local array element at given position. More...
 
constexpr bool is_local (index_type local_index) const
 Checks whether the given local index is local to the calling unit. More...
 
constexpr self_t block (index_type block_lindex) const
 View at block at given global block offset. More...
 
constexpr const PatternType & pattern () const noexcept
 The pattern used to distribute array elements to units. More...
 

Static Public Member Functions

static constexpr dim_t ndim ()
 

Detailed Description

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
class dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >

Proxy type representing local access to elements in a dash::Array.

Todo:
Expression dash::index(dash:begin(dash:local(array))) should be valid; requires dash::LocalArrayRef<T,...>::pointer to provide method .pos().
Implemented concept:
Array Concept

Definition at line 105 of file Array.h.

Member Typedef Documentation

◆ View

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
typedef LocalArrayRef<T, IndexType, PatternType, LocalMemSpaceT> dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::View

Type alias for LocalArrayRef<T,I,P>::view_type.

Definition at line 142 of file Array.h.

Constructor & Destructor Documentation

◆ LocalArrayRef() [1/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::LocalArrayRef ( const Array_t array)
inline

Constructor, creates a local access proxy for the given array.

Definition at line 158 of file Array.h.

160  : _array(array)
161  { }

◆ LocalArrayRef() [2/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::LocalArrayRef ( const Array_t array,
const ViewSpec_t viewspec 
)
inline
Parameters
arrayPointer to array instance referenced by this view.
viewspecThe view's offset and extent within the referenced array.

Definition at line 163 of file Array.h.

168  : _array(array),
169  _viewspec(viewspec)
170  { }

Member Function Documentation

◆ begin() [1/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr const_iterator dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
iterator dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::begin ( )
inlinenoexcept

Pointer to initial local element in the array.

Definition at line 188 of file Array.h.

188  {
189  return _array->m_lbegin;
190  }

◆ block()

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr self_t dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::block ( index_type  block_lindex) const
inline

View at block at given global block offset.

Definition at line 241 of file Array.h.

Referenced by dash::Array< signal_t >::block().

242  {
243  return self_t(_array, pattern().local_block(block_lindex));
244  }
constexpr const PatternType & pattern() const noexcept
The pattern used to distribute array elements to units.
Definition: Array.h:249

◆ end() [1/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr const_iterator dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
iterator dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::end ( )
inlinenoexcept

Pointer past final local element in the array.

Definition at line 202 of file Array.h.

202  {
203  return _array->m_lend;
204  }

◆ is_local()

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr bool dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::is_local ( index_type  local_index) const
inline

Checks whether the given local index is local to the calling unit.

Returns
True
Parameters
local_indexA global array index

Definition at line 232 of file Array.h.

234  {
235  return true;
236  }

◆ operator[]() [1/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr const_reference dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::operator[] ( const size_type  n) const
inline

Subscript operator, access to local array element at given position.

Definition at line 216 of file Array.h.

Referenced by dash::LocalArrayRef< value_type, dash::default_index_t, BlockPattern< 1, ROW_MAJOR, dash::default_index_t >, HostSpace >::pattern().

216  {
217  return (_array->m_lbegin)[n];
218  }

◆ operator[]() [2/2]

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
reference dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::operator[] ( const size_type  n)
inline

Subscript operator, access to local array element at given position.

Definition at line 223 of file Array.h.

223  {
224  return (_array->m_lbegin)[n];
225  }

◆ pattern()

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr const PatternType& dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::pattern ( ) const
inlinenoexcept

The pattern used to distribute array elements to units.

Definition at line 249 of file Array.h.

Referenced by dash::Array< signal_t >::allocate(), dash::LocalArrayRef< value_type, dash::default_index_t, BlockPattern< 1, ROW_MAJOR, dash::default_index_t >, HostSpace >::block(), and dash::Array< signal_t >::block().

249  {
250  return _array->pattern();
251  }
constexpr const PatternType & pattern() const noexcept
The pattern used to distribute array elements to units.
Definition: Array.h:1310

◆ size()

template<typename T, typename IndexType, class PatternType, typename LocalMemSpaceT>
constexpr size_type dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::size ( ) const
inlinenoexcept

Number of array elements in local memory.

Definition at line 209 of file Array.h.

Referenced by dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::ArrayRef(), dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::at(), dash::Array< signal_t >::at(), dash::Array< signal_t >::empty(), dash::LocalArrayRef< value_type, dash::default_index_t, BlockPattern< 1, ROW_MAJOR, dash::default_index_t >, HostSpace >::pattern(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::shrink().

209  {
210  return end() - begin();
211  }
constexpr const_iterator end() const noexcept
Pointer past final local element in the array.
Definition: Array.h:195
constexpr const_iterator begin() const noexcept
Pointer to initial local element in the array.
Definition: Array.h:181

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