1 #ifndef DASH__VIEW__CART_VIEW_H__INCLUDED 2 #define DASH__VIEW__CART_VIEW_H__INCLUDED 4 #include <dash/Types.h> 5 #include <dash/Dimensional.h> 6 #include <dash/Cartesian.h> 20 MemArrange Arrangement = ROW_MAJOR,
24 typedef typename std::iterator_traits<Iter>::value_type value_type;
25 typedef typename std::iterator_traits<Iter>::reference reference;
33 template<
typename ... Args>
35 m_cart { (SizeType)args ... },
40 template<
typename Container,
typename... Args>
41 CartViewBase(Container & container, Args... args) :
43 m_begin { container.begin() } {
46 constexpr SizeType rank()
const {
50 constexpr SizeType size()
const {
54 constexpr SizeType extent(
dim_t dim)
const {
58 template<
typename ... Args>
59 reference at(Args ... args)
const {
61 std::advance(it, m_cart.
at(args...));
67 template<dim_t U=NumDimensions>
68 constexpr
typename std::enable_if<(U>0),SizeType>::type
69 x(SizeType offs)
const {
70 return m_cart.
x(offs);
73 template<dim_t U=NumDimensions>
74 constexpr
typename std::enable_if<(U>1),SizeType>::type
75 y(SizeType offs)
const {
76 return m_cart.
y(offs);
79 template<dim_t U=NumDimensions>
80 constexpr
typename std::enable_if<(U>2),SizeType>::type
81 z(SizeType offs)
const {
82 return m_cart.
z(offs);
93 MemArrange Arrangement = ROW_MAJOR,
96 :
public CartViewBase<Iter, NumDimensions, Arrangement, SizeType> {
98 template<
typename... Args>
106 template<
typename Container,
typename... Args>
117 #endif // DASH__VIEW__CART_VIEW_H__INCLUDED internal::default_unsigned_index default_size_t
Unsigned integer type used as default for size values.
Base class for a cartesian view, i.e.
This class is a simple memory pool which holds allocates elements of size ValueType.
constexpr dim_t rank() const noexcept
The number of dimension in the cartesian space with extent greater than 1.
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
constexpr std::enable_if<(U > 2), SizeType >::type z(SizeType offs) const
Accessor for dimension 3 (z), enabled for dimensionality > 2.
constexpr std::enable_if<(U > 0), SizeType >::type x(SizeType offs) const
Accessor for dimension 1 (x), enabled for dimensionality > 0.
constexpr std::enable_if<(U > 1), SizeType >::type y(SizeType offs) const
Accessor for dimension 2 (y), enabled for dimensionality > 1.
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.