DASH  0.3.0
dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT > Class Template Reference

Proxy type representing an access modifier on elements in a dash::Array. More...

#include <Array.h>

Public Types

typedef ElementType value_type
 Public types as required by iterator concept. More...
 
typedef IndexType index_type
 
typedef std::make_unsigned< IndexType >::type size_type
 
typedef std::make_unsigned< IndexType >::type difference_type
 
typedef GlobIter< value_type, PatternType, typename Array_t::memory_typeiterator
 
typedef GlobIter< const value_type, PatternType, typename Array_t::memory_typeconst_iterator
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef GlobRef< value_typereference
 
typedef GlobRef< const value_typeconst_reference
 
typedef iterator pointer
 
typedef const_iterator const_pointer
 
typedef PatternType pattern_type
 Public types as required by dash container concept. More...
 
typedef self_t view_type
 
typedef LocalArrayRef< value_type, IndexType, PatternType, LocalMemSpaceT > local_type
 
typedef AsyncArrayRef< value_type, IndexType, PatternType, LocalMemSpaceT > async_type
 
typedef std::integral_constant< dim_t, 1 > rank
 

Public Member Functions

 ArrayRef (const Array_t *array, const ViewSpec_t &viewspec)
 
constexpr Teamteam () const
 
constexpr size_type size () const noexcept
 
constexpr size_type local_size () const noexcept
 
constexpr size_type local_capacity () const noexcept
 
constexpr size_type extent (dim_t dim) const noexcept
 
constexpr Extents_t extents () const noexcept
 
constexpr bool empty () const noexcept
 
void barrier () const
 
constexpr const_pointer data () const noexcept
 
iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
local_type sub_local () noexcept
 View representing elements in the active unit's local memory. More...
 
constexpr ElementType * lbegin () const noexcept
 Pointer to first element in local range. More...
 
constexpr ElementType * lend () const noexcept
 Pointer past final element in local range. More...
 
reference operator[] (size_type global_index)
 
constexpr const_reference operator[] (size_type global_index) const
 
reference at (size_type global_pos)
 
const_reference at (size_type global_pos) const
 
constexpr const PatternType & pattern () const
 The pattern used to distribute array elements to units. More...
 

Static Public Member Functions

static constexpr dim_t ndim ()
 

Detailed Description

template<typename ElementType, typename IndexType, class PatternType, typename LocalMemSpaceT>
class dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >

Proxy type representing an access modifier on elements in a dash::Array.

Implemented concept:
Array Concept

Definition at line 447 of file Array.h.

Member Typedef Documentation

◆ pattern_type

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
typedef PatternType dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::pattern_type

Public types as required by dash container concept.

The type of the pattern used to distribute array elements to units

Definition at line 490 of file Array.h.

◆ value_type

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
typedef ElementType dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::value_type

Public types as required by iterator concept.

Definition at line 463 of file Array.h.

Constructor & Destructor Documentation

◆ ArrayRef()

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::ArrayRef ( 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 507 of file Array.h.

References dash::barrier(), dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::begin(), dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::end(), dash::extent(), and dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::size().

512  : _arr(array),
513  _viewspec(viewspec),
514  _begin(array->begin() + _viewspec.offsets()[0]),
515  _end(array->begin() + _viewspec.offsets()[0] + _viewspec.extents()[0]),
516  _size(_viewspec.size())
517  { }
iterator begin() noexcept
Global pointer to the beginning of the array.
Definition: Array.h:1040

Member Function Documentation

◆ at() [1/2]

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
reference dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::at ( size_type  global_pos)
inline
Parameters
global_posThe position of the element to return

Definition at line 580 of file Array.h.

References dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::size().

583  {
584  if (global_pos >= size()) {
585  DASH_THROW(
587  "Position " << global_pos
588  << " is out of range " << size()
589  << " in ArrayRef.at()" );
590  }
591  return _arr->_begin[global_pos];
592  }

◆ at() [2/2]

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
const_reference dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::at ( size_type  global_pos) const
inline
Parameters
global_posThe position of the element to return

Definition at line 594 of file Array.h.

References dash::LocalArrayRef< T, IndexType, PatternType, LocalMemSpaceT >::size().

597  {
598  if (global_pos >= size()) {
599  DASH_THROW(
601  "Position " << global_pos
602  << " is out of range " << size()
603  << " in ArrayRef.at()" );
604  }
605  return _arr->_begin[global_pos];
606  }

◆ lbegin()

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
constexpr ElementType* dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::lbegin ( ) const
noexcept

Pointer to first element in local range.

◆ lend()

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
constexpr ElementType* dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::lend ( ) const
noexcept

Pointer past final element in local range.

◆ operator[]() [1/2]

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
reference dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::operator[] ( size_type  global_index)
inline
Parameters
global_indexThe position of the element to return

Definition at line 565 of file Array.h.

568  {
569  DASH_LOG_TRACE("ArrayRef.[]=", global_index);
570  return _arr->_begin[global_index];
571  }

◆ operator[]() [2/2]

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
constexpr const_reference dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::operator[] ( size_type  global_index) const
inline
Parameters
global_indexThe position of the element to return

Definition at line 573 of file Array.h.

576  {
577  return _arr->_begin[global_index];
578  }

◆ pattern()

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
constexpr const PatternType& dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::pattern ( ) const
inline

The pattern used to distribute array elements to units.

Definition at line 611 of file Array.h.

611  {
612  return _arr->pattern();
613  }
constexpr const PatternType & pattern() const noexcept
The pattern used to distribute array elements to units.
Definition: Array.h:1310

◆ sub_local()

template<typename ElementType , typename IndexType , class PatternType , typename LocalMemSpaceT >
local_type dash::ArrayRef< ElementType, IndexType, PatternType, LocalMemSpaceT >::sub_local ( )
inlinenoexcept

View representing elements in the active unit's local memory.


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