DASH  0.3.0
Cartesian.h
1 #ifndef DASH__CARTESIAN_H_
2 #define DASH__CARTESIAN_H_
3 
4 #include <dash/Types.h>
5 #include <dash/Dimensional.h>
6 #include <dash/Exception.h>
7 #include <dash/internal/Logging.h>
8 
9 #include <array>
10 #include <algorithm>
11 #include <sstream>
12 #include <iostream>
13 #include <cstring>
14 #include <type_traits>
15 
16 namespace dash {
17 
23 template<
24  dim_t NumDimensions,
25  typename SizeType = dash::default_size_t >
27 {
28 private:
29  typedef typename std::make_signed<SizeType>::type
30  IndexType;
32  self_t;
33 
34 public:
35  typedef IndexType index_type;
36  typedef SizeType size_type;
37  typedef std::array<SizeType, NumDimensions> extents_type;
38 
39 public:
40  template<dim_t NDim_, typename SizeType_>
41  friend std::ostream & operator<<(
42  std::ostream & os,
43  const CartesianSpace<NDim_, SizeType_> & cartesian_space);
44 
45 protected:
47  SizeType _size = 0;
49  SizeType _rank = NumDimensions;
51  extents_type _extents = {{ }};
52 
53 public:
57  typedef std::integral_constant<dim_t, NumDimensions> ndim;
58 
63  constexpr CartesianSpace()
64  : _size(0),
65  _rank(NumDimensions)
66  { }
67 
72  template <typename... Args>
73  CartesianSpace(SizeType arg, Args... args)
74  : _size(0),
75  _rank(NumDimensions) {
76  resize(arg, args...);
77  }
78 
83  const extents_type & extents)
84  : _size(0),
85  _rank(NumDimensions) {
86  resize(extents);
87  }
88 
92  bool operator==(const self_t & other) const {
93  if (this == &other) {
94  return true;
95  }
96  for(auto i = 0; i < NumDimensions; i++) {
97  if (_extents[i] != other._extents[i]) {
98  return false;
99  }
100  }
101  // No need to compare _size as it is derived from _extents.
102  return true;
103  }
104 
108  constexpr bool operator!=(const self_t & other) const {
109  return !(*this == other);
110  }
111 
115  template<typename... Args>
116  void resize(SizeType arg, Args... args) {
117  static_assert(
118  sizeof...(Args) == NumDimensions-1,
119  "Invalid number of arguments");
120  std::array<SizeType, NumDimensions> extents =
121  {{ arg, (SizeType)(args)... }};
122  resize(extents);
123  }
124 
128  template<typename SizeType_>
129  void resize(const std::array<SizeType_, NumDimensions> & extents) {
130  // Update size:
131  _size = 1;
132  for(auto i = 0; i < NumDimensions; i++ ) {
133  _extents[i] = static_cast<SizeType>(extents[i]);
134  _size *= _extents[i];
135  }
136  }
137 
141  void resize(dim_t dim, SizeType extent) {
142  _extents[dim] = extent;
143  resize(_extents);
144  }
145 
154  constexpr dim_t rank() const noexcept {
155  return _rank;
156  }
157 
164  constexpr SizeType size() const noexcept {
165  return _size;
166  }
167 
171  constexpr const extents_type & extents() const noexcept {
172  return _extents;
173  }
174 
181  SizeType extent(dim_t dim) const {
182  DASH_ASSERT_RANGE(
183  0, dim, NumDimensions-1,
184  "Dimension for CartesianSpace::extent(dim) is out of bounds");
185  return _extents[dim];
186  }
187 }; // class CartesianSpace
188 
194 template<
195  dim_t NumDimensions,
196  typename SizeType = dash::default_size_t >
197 class SizeSpec : public CartesianSpace<NumDimensions, SizeType>
198 {
199 private:
201  parent_t;
202 
203 public:
207  constexpr SizeSpec() : parent_t() {
208  }
209 
213  template <typename... Args>
214  constexpr SizeSpec(SizeType arg, Args... args)
215  : parent_t(arg, args...) {
216  }
217 
222  constexpr SizeSpec(
223  const ::std::array<SizeType, NumDimensions> & extents)
224  : parent_t(extents) {
225  }
226 };
227 
235 template<
236  dim_t NumDimensions,
237  MemArrange Arrangement = ROW_MAJOR,
238  typename IndexType = dash::default_index_t >
240 {
241 private:
242  typedef typename std::make_unsigned<IndexType>::type
243  SizeType;
245  self_t;
247  ViewSpec_t;
248 
249 public:
250  typedef IndexType index_type;
251  typedef SizeType size_type;
252  typedef std::array<SizeType, NumDimensions> extents_type;
253 
254  template<dim_t NDim_>
255  friend std::ostream & operator<<(
256  std::ostream & os,
257  const CartesianIndexSpace<NDim_> & cartesian_space);
258 
259 protected:
261  SizeType _size = 0;
263  SizeType _rank = NumDimensions;
265  extents_type _extents = { };
269  extents_type _offset_row_major = { };
273  extents_type _offset_col_major = { };
274 
275 public:
279  typedef std::integral_constant<dim_t, NumDimensions> ndim;
280 
285  constexpr CartesianIndexSpace() = default;
286 
291  const extents_type & extents)
292  : _extents(extents)
293  {
294  resize(extents);
295  }
296 
300  template<typename... Args>
301  CartesianIndexSpace(SizeType arg, Args... args)
302  : _extents({{ }})
303  {
304  resize(arg, args...);
305  }
306 
315  constexpr dim_t rank() const noexcept {
316  return _rank;
317  }
318 
322  bool operator==(const self_t & other) const {
323  if (this == &other) {
324  return true;
325  }
326  for(auto i = 0; i < NumDimensions; i++) {
327  if (_extents[i] != other._extents[i]) {
328  return false;
329  }
330  // Comparing either row- or column major offsets suffices:
331  if (_offset_row_major[i] != other._offset_row_major[i]) {
332  return false;
333  }
334  }
335  // No need to compare _size as it is derived from _extents.
336  return true;
337  }
338 
342  constexpr bool operator!=(const self_t & other) const {
343  return !(*this == other);
344  }
345 
349  template<typename... Args>
350  void resize(SizeType arg, Args... args) {
351  static_assert(
352  sizeof...(Args) == NumDimensions-1,
353  "Invalid number of arguments");
354  std::array<SizeType, NumDimensions> extents =
355  {{ arg, (SizeType)(args)... }};
356  resize(extents);
357  }
358 
362  template<typename SizeType_>
363  void resize(const std::array<SizeType_, NumDimensions> & extents) {
364  // Update size:
365  _size = 1;
366  for(auto i = 0; i < NumDimensions; i++ ) {
367  _extents[i] = static_cast<SizeType>(extents[i]);
368  _size *= _extents[i];
369  }
370  // Update offsets:
371  _offset_row_major[NumDimensions-1] = 1;
372  for(auto i = NumDimensions-2; i >= 0; --i) {
373  _offset_row_major[i] = _offset_row_major[i+1] * _extents[i+1];
374  }
375  _offset_col_major[0] = 1;
376  for(auto i = 1; i < NumDimensions; ++i) {
377  _offset_col_major[i] = _offset_col_major[i-1] * _extents[i-1];
378  }
379  }
380 
384  void resize(dim_t dim, SizeType extent) {
385  _extents[dim] = extent;
386  resize(_extents);
387  }
388 
395  constexpr SizeType size() const noexcept {
396  return _size;
397  }
398 
402  constexpr const extents_type & extents() const noexcept {
403  return _extents;
404  }
405 
412  SizeType extent(dim_t dim) const {
413  DASH_ASSERT_RANGE(
414  0, dim, NumDimensions-1,
415  "Given dimension " << dim <<
416  " for CartesianIndexSpace::extent(dim) is out of bounds");
417  return _extents[dim];
418  }
419 
426  template<
427  typename... Args,
428  MemArrange AtArrangement = Arrangement>
429  constexpr IndexType at(
430  IndexType arg, Args... args) const {
431  static_assert(
432  sizeof...(Args) == NumDimensions-1,
433  "Invalid number of arguments");
434  return at<AtArrangement>(
435  std::array<IndexType, NumDimensions> {{
436  arg, (IndexType)(args) ... }}
437  );
438  }
439 
446  template<
447  MemArrange AtArrangement = Arrangement,
448  typename OffsetType>
449  IndexType at(
450  const std::array<OffsetType, NumDimensions> & point) const {
451  SizeType offs = 0;
452  DASH_ASSERT_GT(_size, 0, "CartesianIndexSpace has size 0");
453  for (auto i = 0; i < NumDimensions; i++) {
454  DASH_ASSERT_RANGE(
455  0,
456  static_cast<IndexType>(point[i]),
457  static_cast<IndexType>(_extents[i]-1),
458  "Given coordinate for CartesianIndexSpace::at() exceeds extent");
459  SizeType offset_dim = 0;
460  if (AtArrangement == ROW_MAJOR) {
461  offset_dim = _offset_row_major[i];
462  } else if (AtArrangement == COL_MAJOR) {
463  offset_dim = _offset_col_major[i];
464  }
465  offs += offset_dim * point[i];
466  }
467  return offs;
468  }
469 
479  template<
480  MemArrange AtArrangement = Arrangement,
481  typename OffsetType>
482  IndexType at(
483  const std::array<OffsetType, NumDimensions> & point,
484  const ViewSpec_t & viewspec) const {
485  std::array<OffsetType, NumDimensions> coords{};
486  for (auto d = 0; d < NumDimensions; ++d) {
487  coords[d] = point[d] + viewspec.offset(d);
488  }
489  return at(coords);
490  }
491 
496  template<MemArrange CoordArrangement = Arrangement>
497  std::array<IndexType, NumDimensions> coords(
498  IndexType index) const
499  {
500  DASH_ASSERT_GT(_size, 0, "CartesianIndexSpace has size 0");
501  DASH_ASSERT_RANGE(
502  0, index, static_cast<IndexType>(_size-1),
503  "Given index for CartesianIndexSpace::coords() is out of bounds");
504 
505  ::std::array<IndexType, NumDimensions> pos{};
506  if (CoordArrangement == ROW_MAJOR) {
507  for(auto i = 0; i < NumDimensions; ++i) {
508  pos[i] = index / _offset_row_major[i];
509  index = index % _offset_row_major[i];
510  }
511  } else if (CoordArrangement == COL_MAJOR) {
512  for(auto i = NumDimensions-1; i >= 0; --i) {
513  pos[i] = index / _offset_col_major[i];
514  index = index % _offset_col_major[i];
515  }
516  }
517  return pos;
518  }
519 
525  template<MemArrange CoordArrangement = Arrangement>
526  std::array<IndexType, NumDimensions> coords(
527  IndexType index,
528  const ViewSpec_t & viewspec) const
529  {
530  std::array<IndexType, NumDimensions> pos{};
531  extents_type offset;
532  if (CoordArrangement == ROW_MAJOR)
533  {
534  offset[NumDimensions-1] = 1;
535  for(auto i = NumDimensions-2; i >= 0; --i)
536  offset[i] = offset[i+1] * viewspec.extent(i+1);
537 
538  for(auto i = 0; i < NumDimensions; ++i)
539  {
540  pos[i] = index / offset[i] + viewspec.offset(i);
541  index = index % offset[i];
542  }
543  }
544  else if (CoordArrangement == COL_MAJOR)
545  {
546  offset[0] = 1;
547  for(auto i = 1; i < NumDimensions; ++i)
548  offset[i] = offset[i-1] * viewspec.extent(i-1);
549 
550  for(auto i = NumDimensions-1; i >= 0; --i)
551  {
552  pos[i] = index / offset[i] + viewspec.offset(i);
553  index = index % offset[i];
554  }
555  }
556  return pos;
557  }
558 
559 #if 0
560 
564  template<MemArrange CoordArrangement = Arrangement>
565  bool includes_index(
566  IndexType index,
567  dim_t dimension,
568  IndexType dim_offset) const {
569  if (_rank == 1) {
570  // Shortcut for trivial case
571  return (index >= 0 && index < this->size());
572  }
573  auto base_offset = 0;
574  if (CoordArrangement == COL_MAJOR) {
575  base_offset = _offset_col_major[dimension];
576  } else if (CoordArrangement == ROW_MAJOR) {
577  base_offset = _offset_row_major[dimension];
578  }
579  for (auto d = 0; d < NumDimensions; ++d) {
580  // TODO
581  }
582  return true;
583  }
584 #endif
585 
589  template<dim_t U = NumDimensions>
590  constexpr typename std::enable_if< (U > 0), SizeType >::type
591  x(SizeType offs) const {
592  return coords(offs)[0];
593  }
594 
598  template<dim_t U = NumDimensions>
599  constexpr typename std::enable_if< (U > 1), SizeType >::type
600  y(SizeType offs) const {
601  return coords(offs)[1];
602  }
603 
607  template<dim_t U = NumDimensions>
608  constexpr typename std::enable_if< (U > 2), SizeType >::type
609  z(SizeType offs) const {
610  return coords(offs)[2];
611  }
612 
613 }; // class CartesianIndexSpace
614 
623 template<
624  size_t NumDimensions,
625  MemArrange Arrangement = ROW_MAJOR,
626  typename IndexType = dash::default_index_t >
628  public CartesianIndexSpace<NumDimensions, Arrangement, IndexType>
629 {
630 private:
631  typedef typename std::make_unsigned<IndexType>::type
632  SizeType;
634  self_t;
636  parent_t;
638  ViewSpec_t;
639 public:
644  constexpr LocalMemoryLayout(
645  const SizeSpec<NumDimensions> & sizespec,
646  const DistributionSpec<NumDimensions> & distspec)
647  : parent_t(sizespec),
648  _distspec(distspec) {
649  }
650 
655  constexpr LocalMemoryLayout(
656  const DistributionSpec<NumDimensions> & distspec)
657  : parent_t(SizeSpec<NumDimensions>()),
658  _distspec(distspec) {
659  }
660 
664  bool operator==(const self_t & other) const {
665  if (!(parent_t::operator==(other))) {
666  return false;
667  }
668  return _distspec == other._distspec;
669  }
670 
674  constexpr bool operator!=(const self_t & other) const {
675  return !(*this == other);
676  }
677 
681  template<typename... Args>
682  void resize(SizeType arg, Args... args) {
683  static_assert(
684  sizeof...(Args) == NumDimensions-1,
685  "Invalid number of arguments");
686  std::array<SizeType, NumDimensions> extents =
687  {{ arg, (SizeType)(args)... }};
688  resize(extents);
689  }
690 
694  template<typename SizeType_>
695  void resize(std::array<SizeType_, NumDimensions> extents) {
696  if (!_distspec.is_tiled()) {
697  parent_t::resize(extents);
698  }
699  // Tiles in at least one dimension
700  // TODO
702  "CartesianIndexSpace::resize(IndexType) not implemented for tiles!");
703  }
704 
711  template<
712  typename... Args,
713  MemArrange AtArrangement = Arrangement>
714  constexpr IndexType at(
715  IndexType arg, Args... args) const {
716  static_assert(
717  sizeof...(Args) == NumDimensions-1,
718  "Invalid number of arguments");
719  return at<AtArrangement>(
720  std::array<IndexType, NumDimensions> {
721  arg, (IndexType)(args) ... }
722  );
723  }
724 
731  template<
732  MemArrange AtArrangement = Arrangement,
733  typename OffsetType>
734  IndexType at(
735  const std::array<OffsetType, NumDimensions> & point) const {
736  if (!_distspec.is_tiled()) {
737  // Default case, no tiles
738  return parent_t::at(point);
739  }
740  // Tiles in at least one dimension
741  // TODO
743  "CartesianIndexSpace::at(IndexType) not implemented for tiles!");
744  }
745 
755  template<
756  MemArrange AtArrangement = Arrangement,
757  typename OffsetType>
758  IndexType at(
759  const std::array<OffsetType, NumDimensions> & point,
760  const ViewSpec_t & viewspec) const {
761  std::array<OffsetType, NumDimensions> coords;
762  for (auto d = 0; d < NumDimensions; ++d) {
763  coords[d] = point[d] + viewspec[d].offset;
764  }
765  return at(coords);
766  }
767 
772  template<MemArrange CoordArrangement = Arrangement>
773  std::array<IndexType, NumDimensions> coords(IndexType index) const {
774  if (!_distspec.is_tiled()) {
775  // Default case, no tiles
776  return parent_t::coords(index);
777  }
778  // Tiles in at least one dimension
779  // TODO
781  "CartesianIndexSpace::coords(IndexType) not implemented for tiles!");
782  }
783 
784 private:
786 }; // class LocalMemoryLayout
787 
788 template <
789  dash::dim_t NumDimensions,
790  typename SizeType >
791 std::ostream & operator<<(
792  std::ostream & os,
793  const dash::CartesianSpace<NumDimensions, SizeType> & cartesian_space)
794 {
795  std::ostringstream ss;
796  ss << dash::typestr(cartesian_space)
797  << ": "
798  << "extents(";
799  for (auto dim = 0; dim < NumDimensions; ++dim) {
800  if (dim > 0) {
801  ss << ",";
802  }
803  ss << cartesian_space.extents()[dim];
804  }
805  ss << ")";
806  return operator<<(os, ss.str());
807 }
808 
809 template <
810  dash::dim_t NumDimensions >
811 std::ostream & operator<<(
812  std::ostream & os,
813  const dash::CartesianIndexSpace<NumDimensions> & cartesian_space)
814 {
815  std::ostringstream ss;
816  ss << dash::typestr(cartesian_space)
817  << ": "
818  << "extents(";
819  for (auto dim = 0; dim < NumDimensions; ++dim) {
820  if (dim > 0) {
821  ss << ",";
822  }
823  ss << cartesian_space.extents()[dim];
824  }
825  ss << ")";
826  return operator<<(os, ss.str());
827 }
828 
829 } // namespace dash
830 
831 #endif // DASH__CARTESIAN_H_
constexpr LocalMemoryLayout(const SizeSpec< NumDimensions > &sizespec, const DistributionSpec< NumDimensions > &distspec)
Constructor, creates an instance of LocalMemoryLayout from a SizeSpec and a DistributionSpec of NumDi...
Definition: Cartesian.h:644
internal::default_unsigned_index default_size_t
Unsigned integer type used as default for size values.
Definition: Types.h:69
constexpr bool operator!=(const self_t &other) const
Inequality comparison operator.
Definition: Cartesian.h:342
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
IndexType at(const std::array< OffsetType, NumDimensions > &point) const
Convert the given cartesian point to its respective linear index.
Definition: Cartesian.h:734
CartesianIndexSpace(const extents_type &extents)
Constructor, creates a cartesian index space of given extents.
Definition: Cartesian.h:290
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
constexpr dim_t rank() const noexcept
The number of dimension in the cartesian space with extent greater than 1.
Definition: Cartesian.h:315
CartesianSpace(const extents_type &extents)
Constructor, creates a cartesian space of given extents.
Definition: Cartesian.h:82
Specifies cartesian extents in a specific number of dimensions.
Definition: Cartesian.h:197
Specifies view parameters for implementing submat, rows and cols.
Definition: Dimensional.h:430
CartesianSpace(SizeType arg, Args... args)
Constructor, creates a cartesian index space of given extents in all dimensions.
Definition: Cartesian.h:73
bool operator==(const self_t &other) const
Equality comparison operator.
Definition: Cartesian.h:664
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
std::integral_constant< dim_t, NumDimensions > ndim
The number of dimension in the cartesian space.
Definition: Cartesian.h:279
Specifies how local element indices are arranged in a specific number of dimensions.
Definition: Cartesian.h:627
void resize(const std::array< SizeType_, NumDimensions > &extents)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:363
IndexType at(const std::array< OffsetType, NumDimensions > &point) const
Convert the given cartesian point to its respective linear index.
Definition: Cartesian.h:449
constexpr dim_t rank() const noexcept
The number of dimension in the cartesian space with extent greater than 1.
Definition: Cartesian.h:154
constexpr SizeSpec()
Default constructor, creates a space of extent 0 in all dimensions.
Definition: Cartesian.h:207
Cartesian space defined by extents in n dimensions.
Definition: Cartesian.h:26
CartesianIndexSpace(SizeType arg, Args... args)
Constructor, creates a cartesian index space of given extents.
Definition: Cartesian.h:301
void resize(SizeType arg, Args... args)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:350
constexpr LocalMemoryLayout(const DistributionSpec< NumDimensions > &distspec)
Constructor, creates an instance of LocalMemoryLayout with initial extents 0 and a DistributionSpec o...
Definition: Cartesian.h:655
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
Definition: Types.h:59
constexpr bool operator!=(const self_t &other) const
Inequality comparison operator.
Definition: Cartesian.h:108
constexpr SizeSpec(const ::std::array< SizeType, NumDimensions > &extents)
Constructor, creates a cartesian index space of given extents in all dimensions.
Definition: Cartesian.h:222
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
std::integral_constant< dim_t, NumDimensions > ndim
The number of dimension in the cartesian space.
Definition: Cartesian.h:57
constexpr CartesianSpace()
Default constructor, creates a cartesian space of extent 0 in all dimensions.
Definition: Cartesian.h:63
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr bool operator!=(const self_t &other) const
Inequality comparison operator.
Definition: Cartesian.h:674
Defines a cartesian, totally-ordered index space by mapping linear indices to cartesian coordinates d...
Definition: Cartesian.h:239
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr std::enable_if<(U > 2), SizeType >::type z(SizeType offs) const
Accessor for dimension 3 (z), enabled for dimensionality > 2.
Definition: Cartesian.h:609
constexpr SizeSpec(SizeType arg, Args... args)
Constructor, creates a cartesian space of given extents.
Definition: Cartesian.h:214
void resize(dim_t dim, SizeType extent)
Change the extent of the cartesian space in the given dimension.
Definition: Cartesian.h:384
void resize(SizeType arg, Args... args)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:682
bool operator==(const self_t &other) const
Equality comparison operator.
Definition: Cartesian.h:92
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:181
std::string typestr(const T &obj)
Returns string containing the type name of the given object.
Definition: TypeInfo.h:20
constexpr std::enable_if<(U > 0), SizeType >::type x(SizeType offs) const
Accessor for dimension 1 (x), enabled for dimensionality > 0.
Definition: Cartesian.h:591
bool operator==(const self_t &other) const
Equality comparison operator.
Definition: Cartesian.h:322
void resize(std::array< SizeType_, NumDimensions > extents)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:695
IndexType at(const std::array< OffsetType, NumDimensions > &point, const ViewSpec_t &viewspec) const
Convert the given cartesian point to a linear index, respective to the offsets specified in the given...
Definition: Cartesian.h:758
constexpr std::enable_if<(U > 1), SizeType >::type y(SizeType offs) const
Accessor for dimension 2 (y), enabled for dimensionality > 1.
Definition: Cartesian.h:600
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
void resize(dim_t dim, SizeType extent)
Change the extent of the cartesian space in the given dimension.
Definition: Cartesian.h:141
void resize(const std::array< SizeType_, NumDimensions > &extents)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:129
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:164
void resize(SizeType arg, Args... args)
Change the extent of the cartesian space in every dimension.
Definition: Cartesian.h:116
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:714
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:171
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:773
DistributionSpec describes distribution patterns of all dimensions,.
Definition: Dimensional.h:222
IndexType at(const std::array< OffsetType, NumDimensions > &point, const ViewSpec_t &viewspec) const
Convert the given cartesian point to a linear index, respective to the offsets specified in the given...
Definition: Cartesian.h:482
std::array< IndexType, NumDimensions > coords(IndexType index, const ViewSpec_t &viewspec) const
Convert given linear offset (index) to cartesian coordinates with respect to a given viewspec...
Definition: Cartesian.h:526