DASH  0.3.0
Multidimensional Iterator Concept
Collaboration diagram for Multidimensional Iterator Concept:

Functions

template<class IndexType >
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type dash::index (IndexType idx)
 
template<class Iterator >
constexpr auto dash::index (Iterator it) -> decltype((++it).gpos())
 
template<class RandomAccessIt >
RandomAccessIt::difference_type dash::distance (const RandomAccessIt &first, const RandomAccessIt &last)
 Resolve the number of elements between two iterators. More...
 
template<typename ElementType , class Pattern , class GlobMemType , class Pointer , class Reference >
Pattern::index_type dash::distance (const GlobIter< ElementType, Pattern, GlobMemType, Pointer, Reference > &first, const GlobIter< ElementType, Pattern, GlobMemType, Pointer, Reference > &last)
 Resolve the number of elements between two global iterators. More...
 
template<class T >
constexpr std::ptrdiff_t dash::distance (T *const first, T *const last)
 
template<class OffsetType >
constexpr std::enable_if< std::is_integral< OffsetType >::value, OffsetType >::type dash::distance (OffsetType begin, OffsetType end)
 

Detailed Description

Description

Definitions for multidimensional iterator expressions.

See also
Multidimensional Value Concept
Multidimensional View Concept
Multidimensional Range Concept
dash::view_traits
Types
Expressions

Expression | Returns | Effect | Precondition | Postcondition ---------------------— | ----— | ---— | ---------— | ----------—

Metafunctions
Functions
Functions in the Range concept

Function Documentation

◆ distance() [1/4]

template<class RandomAccessIt >
RandomAccessIt::difference_type dash::distance ( const RandomAccessIt &  first,
const RandomAccessIt &  last 
)

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Resolve the number of elements between two iterators.

Implemented concept:
Multidimensional Iterator Concept

Definition at line 90 of file Iterator.h.

Referenced by dash::equal(), dash::find_if(), dash::halo::HaloMatrixWrapper< MatrixT, SigReady >::set_custom_halos(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::shrink().

93 {
94  return last - first;
95 }

◆ distance() [2/4]

template<typename ElementType , class Pattern , class GlobMemType , class Pointer , class Reference >
Pattern::index_type dash::distance ( const GlobIter< ElementType, Pattern, GlobMemType, Pointer, Reference > &  first,
const GlobIter< ElementType, Pattern, GlobMemType, Pointer, Reference > &  last 
)

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Resolve the number of elements between two global iterators.

The difference of global pointers is not well-defined if their range spans over more than one block. The corresponding invariant is: g_last == g_first + (l_last - l_first) Example:

unit: 0 1 0
local offset: | 0 1 2 | 0 1 2 | 3 4 5 | ...
global offset: | 0 1 2 3 4 5 6 7 8 ...
range: [- - - - -]

When iterating in local memory range [0,5[ of unit 0, the position of the global iterator to return is 8 != 5

Template Parameters
ElementTypeType of the elements in the range
Time complexity
O(1)
Implemented concept:
Multidimensional Iterator Concept
Parameters
firstGlobal pointer to the initial position in the global sequence
lastGlobal iterator to the final position in the global sequence

Definition at line 130 of file Iterator.h.

137 {
138  return last - first;
139 }

◆ distance() [3/4]

template<class T >
constexpr std::ptrdiff_t dash::distance ( T *const  first,
T *const  last 
)

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Implemented concept:
Multidimensional Iterator Concept

Definition at line 165 of file Iterator.h.

References dash::distance().

165  {
166  return std::distance(first, last);
167 }
constexpr std::enable_if< std::is_integral< OffsetType >::value, OffsetType >::type distance(OffsetType begin, OffsetType end)
Definition: Iterator.h:180

◆ distance() [4/4]

template<class OffsetType >
constexpr std::enable_if< std::is_integral<OffsetType>::value, OffsetType >::type dash::distance ( OffsetType  begin,
OffsetType  end 
)

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Implemented concept:
Multidimensional Iterator Concept

Definition at line 180 of file Iterator.h.

Referenced by dash::distance().

182  {
183  return (end - begin);
184 }
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
Definition: Range.h:89

◆ index() [1/2]

template<class IndexType >
constexpr std::enable_if< std::is_integral<IndexType>::value, IndexType >::type dash::index ( IndexType  idx)

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Implemented concept:
Multidimensional Iterator Concept
Examples:
ex.06.pattern-block-visualizer/main.cpp, and ex.09.view-1dim/main.cpp.

Definition at line 60 of file Iterator.h.

Referenced by dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::boundary_region(), dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::boundary_regions(), dash::halo::RegionCoords< NumDimensions >::coords(), dash::CartesianIndexSpace< NumDimensions, ROW_MAJOR, dash::default_index_t >::coords(), dash::CSRPattern< 1, Arrangement, IndexType >::coords(), dash::BlockPattern< 1, ROW_MAJOR, dash::default_index_t >::coords(), dash::halo::HaloSpec< NumDimensions >::extent(), dash::halo::HaloMemory< HaloBlock_t >::first_element_at(), dash::halo::HaloSpec< NumDimensions >::halo_extension_max(), dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::halo_region(), dash::halo::RegionCoords< NumDimensions >::index(), dash::halo::RegionSpec< NumDimensions >::index(), dash::halo::HaloBlock< ElementT, PatternT, GlobMemT >::index_at(), dash::intersect(), dash::BlockPattern< 1, ROW_MAJOR, dash::default_index_t >::is_local(), dash::halo::RegionCoords< NumDimensions >::level(), dash::halo::StencilIteratorTest< CoordsIdxManagerBoundary_t >::operator--(), dash::halo::StencilSpec< StencilPointT, NumStencilPoints >::operator[](), dash::halo::RegionSpec< NumDimensions >::operator[](), dash::halo::HaloMemory< HaloBlock_t >::range_at(), dash::halo::HaloSpec< NumDimensions >::spec(), and dash::halo::HaloMatrixWrapper< MatrixT, SigReady >::stencil_operator().

60  {
61  return idx;
62 }

◆ index() [2/2]

template<class Iterator >
constexpr auto dash::index ( Iterator  it) -> decltype((++it).gpos())

#include </tmp/tmporruphar/dash/include/dash/Iterator.h>

Implemented concept:
Multidimensional Iterator Concept
Implemented concept:
Multidimensional Iterator Concept

Definition at line 78 of file Iterator.h.

78  {
79  return it.gpos();
80 }