Index.h¶
-
template<size_t
DIM
>
classCubism::Core
::
IndexRange
: public Cubism::Core::Range<Index, DIM>¶ Rectangular index range.
Defines a simple consecutive index space.
- Template Parameters
DIM
: Dimension of the index space
Public Functions
-
inline
IndexRange
()¶ Default constructor (NULL range)
-
inline explicit
IndexRange
(const DataType e)¶ Construct index range.
Constructs equal extent in all
DIM
dimensions.- Parameters
e
: End point (top right) of index space. Begin is0
.
-
inline explicit
IndexRange
(const PointType &e)¶ Construct index range.
Constructs an extent specified the
DIM
-dimensionale
.- Parameters
e
: End point (top right) of index space. Begin is0
.
-
inline
IndexRange
(const DataType b, const DataType e)¶ Construct index range.
Constructs equal extent in all
DIM
dimensions.- Parameters
b
: Begin point (lower left) of index space.e
: End point (top right) of index space.
-
inline
IndexRange
(const PointType &b, const PointType &e)¶ Construct index range.
Constructs an extent specified the
DIM
-dimensional difference ofe
andb
.- Parameters
b
: Begin point (lower left) of index space.e
: End point (top right) of index space.
-
inline IndexRange
getIntersection
(const IndexRange &o) const¶ Get intersection subspace.
- Return
New range for intersection
- Parameters
o
: Other index range
-
inline bool
isIndex
(const MultiIndex &p) const¶ Check if index is valid local in this range.
- Return
True if
p
is a valid index (exclusive; C-style indexing)- Parameters
p
: Local multi-dimensional index
-
inline bool
isGlobalIndex
(const MultiIndex &p) const¶ Check if index is valid global in this range.
- Return
True if
p
is a valid index (exclusive; C-style indexing)- Parameters
p
: Global multi-dimensional index
-
inline size_t
size
() const¶ Size of index space.
- Return
Total number of indices in the index range
-
inline size_t
sizeDim
(const size_t i) const¶ Size of index space.
- Return
Number of indices along dimension
i
- Parameters
i
: Dimension
-
inline size_t
getFlatIndex
(const MultiIndex &p) const¶ Convert a local multi-dimensional index to a local one-dimensional index.
Computes a local flat index from a local multi-dimensional index relative to the index space spanned by this range.
- Return
Local flattened index
- Parameters
p
: Local multi-dimensional index
-
inline size_t
getFlatIndexFromGlobal
(const MultiIndex &p) const¶ Convert a global multi-dimensional index to a local one-dimensional index.
Computes a local flat index from a global multi-dimensional index relative to the index space spanned by this range.
- Return
Local flattened index
- Parameters
p
: Global multi-dimensional index
-
inline MultiIndex
getMultiIndex
(size_t i) const¶ Convert a local one-dimensional index to a local multi-dimensional index.
Computes a local multi-dimensional index from a local one-dimensional index relative to the index space spanned by this range.
- Return
Local multi-dimensional index
- Parameters
i
: Local one-dimensional index