Template Numerical Library version\ main:0c33d623
|
Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension. More...
#include <TNL/Containers/NDArrayIndexer.h>
Public Types | |
using | IndexType = typename SizesHolder::IndexType |
Type of indices used for addressing the array elements. | |
using | OverlapsType = Overlaps |
Sequence of integers representing the overlaps in each dimension of a distributed N-dimensional array. | |
using | PermutationType = Permutation |
Permutation that is applied to indices when accessing the array elements. | |
using | SizesHolderType = SizesHolder |
Type of the underlying object which represents the sizes of the N-dimensional array. | |
using | StridesHolderType = StridesHolder |
Type of the base class which represents the strides of the N-dimensional array. | |
Public Member Functions | |
__cuda_callable__ | NDArrayIndexer ()=default |
Constructs an empty indexer with zero sizes and strides. | |
__cuda_callable__ | NDArrayIndexer (SizesHolderType sizes, StridesHolderType strides) |
Creates the indexer with given sizes and strides. | |
template<std::size_t level> | |
__cuda_callable__ IndexType | getSize () const |
Returns a specific component of the N-dimensional sizes. | |
__cuda_callable__ const SizesHolderType & | getSizes () const |
Returns the N-dimensional array sizes held by the indexer. | |
template<typename... IndexTypes> | |
__cuda_callable__ IndexType | getStorageIndex (IndexTypes &&... indices) const |
Computes the one-dimensional storage index for a specific element of the N-dimensional array. | |
__cuda_callable__ IndexType | getStorageSize () const |
Returns the size (number of elements) needed to store the N-dimensional array. | |
template<typename BeginsHolder , typename EndsHolder > | |
__cuda_callable__ bool | isContiguousBlock (const BeginsHolder &begins, const EndsHolder &ends) |
Static Public Member Functions | |
static constexpr std::size_t | getDimension () |
Returns the dimension of the N-dimensional array, i.e. N. | |
template<std::size_t level> | |
static constexpr std::size_t | getOverlap () |
Returns the overlap of a distributed N-dimensional array along the specified axis. | |
Protected Types | |
using | NDBaseType = Base |
Protected Member Functions | |
__cuda_callable__ SizesHolderType & | getSizes () |
Returns a non-constant reference to the underlying sizes. | |
Protected Attributes | |
SizesHolderType | sizes |
Underlying object which represents the sizes of the N-dimensional array. | |
Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension.
SizesHolder | Instance of SizesHolder that will represent the array sizes. |
Permutation | Permutation that will be applied to indices when accessing the array elements. The identity permutation is used by default. |
Base | Either detail::NDArrayBase or detail::SlicedNDArrayBase . |
StridesHolder | Type of the base class which represents the strides of the N-dimensional array. |
Overlaps | Sequence of integers representing the overlaps in each dimension a distributed N-dimensional array. |
|
inlinestaticconstexpr |
Returns the overlap of a distributed N-dimensional array along the specified axis.
level | Integer specifying the axis of the array. |
|
inline |
Returns a specific component of the N-dimensional sizes.
level | Integer specifying the component of the sizes to be returned. |
|
inlineprotected |
Returns a non-constant reference to the underlying sizes.
The function is not public – only subclasses like NDArrayStorage may modify the sizes.
|
inline |
Computes the one-dimensional storage index for a specific element of the N-dimensional array.
indices | Indices of the element in the N-dimensional array. The number of indices supplied must be equal to N, i.e. getDimension(). |
|
inline |
Returns the size (number of elements) needed to store the N-dimensional array.