Template Numerical Library version\ main:4e58ea6
|
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 Types inherited from TNL::Containers::ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 > | |
using | IndexType |
Public Member Functions | |
__cuda_callable__ | NDArrayIndexer ()=default |
Constructs an empty indexer with zero sizes and strides. | |
__cuda_callable__ | NDArrayIndexer (SizesHolderType sizes, StridesHolderType strides, OverlapsType overlaps) |
Creates the indexer with given sizes and strides. | |
template<std::size_t level> | |
__cuda_callable__ IndexType | getOverlap () const |
Returns the overlap of a distributed N-dimensional array along the specified axis. | |
__cuda_callable__ OverlapsType & | getOverlaps () |
Returns the N-dimensional overlaps holder instance. | |
__cuda_callable__ const OverlapsType & | getOverlaps () const |
Returns the N-dimensional overlaps holder instance. | |
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. | |
__cuda_callable__ const StridesHolderType & | getStrides () const |
Returns the N-dimensional strides holder instance. | |
template<typename BeginsHolder , typename EndsHolder > | |
__cuda_callable__ bool | isContiguousBlock (const BeginsHolder &begins, const EndsHolder &ends) |
Public Member Functions inherited from TNL::Containers::ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 > | |
__cuda_callable__ typename SizesHolder::IndexType | getSize () const |
__cuda_callable__ typename SizesHolder::IndexType | operator[] (typename SizesHolder::IndexType level) const |
Returns the dynamic size along a specific axis. It is always equal to the static size. | |
Static Public Member Functions | |
static constexpr std::size_t | getDimension () |
Returns the dimension of the N-dimensional array, i.e. N. | |
Static Public Member Functions inherited from TNL::Containers::ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 > | |
static constexpr std::size_t | getDimension () |
static constexpr std::size_t | getStaticSize () |
static constexpr typename SizesHolder::IndexType | getStaticSize (typename SizesHolder::IndexType level) |
Returns the static size of a specific dimension identified by a runtime parameter level. | |
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. |
|
inlinenodiscard |
Returns the overlap of a distributed N-dimensional array along the specified axis.
level | Integer specifying the axis of the array. |
|
inlinenodiscard |
Returns a specific component of the N-dimensional sizes.
level | Integer specifying the component of the sizes to be returned. |
|
inlinenodiscardprotected |
Returns a non-constant reference to the underlying sizes.
The function is not public – only subclasses like NDArrayStorage may modify the sizes.
|
inlinenodiscard |
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(). |
|
inlinenodiscard |
Returns the size (number of elements) needed to store the N-dimensional array.