1 #ifndef DASH__VIEW__VIEW_ORIGIN_H__INCLUDED 2 #define DASH__VIEW__VIEW_ORIGIN_H__INCLUDED 4 #include <dash/view/IndexSet.h> 5 #include <dash/view/ViewTraits.h> 6 #include <dash/view/ViewIterator.h> 8 #include <dash/Types.h> 9 #include <dash/Range.h> 10 #include <dash/Iterator.h> 22 template <dim_t NDim = 1>
33 typedef IndexSetIdentity<self_t> index_set_type;
36 typedef std::integral_constant<bool, false> is_local;
37 typedef std::integral_constant<dim_t, NDim> rank;
40 std::array<size_type, NDim> _extents = { };
41 std::array<index_type, NDim> _offsets = { };
42 index_set_type _index_set;
46 constexpr
ViewOrigin(
const self_t &) =
default;
48 self_t & operator=(self_t &&) =
default;
49 self_t & operator=(
const self_t &) =
default;
51 template <std::
size_t N>
53 std::array<dim_t, N> extents)
58 constexpr
const domain_type & domain()
const {
62 constexpr
const index_set_type & index_set()
const {
66 constexpr
bool operator==(
const self_t & rhs)
const {
67 return (
this == &rhs);
70 constexpr
bool operator!=(
const self_t & rhs)
const {
71 return !(*
this == rhs);
76 constexpr
const std::array<size_type, NDim> extents()
const {
80 template <dim_t ExtentDim = 0>
81 constexpr index_type extent()
const {
82 return _extents[ExtentDim];
85 constexpr index_type extent(
dim_t extent_dim)
const {
86 return _extents[extent_dim];
91 constexpr
const std::array<index_type, NDim> & offsets()
const {
95 template <dim_t OffsetDim = 0>
96 constexpr index_type offset()
const {
97 return _offsets[OffsetDim];
100 constexpr index_type offset(
dim_t offset_dim)
const {
101 return _offsets[offset_dim];
106 template <dim_t SizeDim = 0>
107 constexpr index_type size()
const {
108 return extent<SizeDim>() *
110 ? size<SizeDim + 1>()
115 template <dim_t NDim>
121 typedef typename ViewOrigin<NDim>::index_type index_type;
122 typedef typename ViewOrigin<NDim>::size_type size_type;
123 typedef typename ViewOrigin<NDim>::index_set_type index_set_type;
125 typedef std::integral_constant<bool, false> is_projection;
126 typedef std::integral_constant<bool, true> is_view;
127 typedef std::integral_constant<bool, true> is_origin;
128 typedef std::integral_constant<bool, false> is_local;
130 typedef std::integral_constant<dim_t, NDim> rank;
135 #endif // DASH__VIEW__VIEW_ORIGIN_H__INCLUDED internal::default_unsigned_index default_extent_t
Unsigned integer type used as default for extent values.
This class is a simple memory pool which holds allocates elements of size ValueType.
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Monotype for the logical symbol that represents a view origin.
internal::default_signed_index default_index_t
Signed integer type used as default for index values.