Struct NDIndex#
Defined in File NDSpacialInfoTypes.h
Struct Documentation#
-
struct NDIndex#
A type representing an N-dimensional index
Modeled as an array of index at each dimension. To retrieve the index of a certain dimension, use the subscript operator
Note
This type is a copy-on-write type where copy operation will only be triggered when trying to mutate one of the copy. If you are not actually mutating anything, feel free to copy. However, if you want to further eliminate the reference counting overhead, feel free to use references just like using a vector
Public Functions
-
inline NDIndex(const std::initializer_list<Index> &initList)#
Initialize an NDIndex by providing the index of each dimension
-
inline explicit NDIndex(const Dimension dimensions, const Index value = 0)#
Initialize an NDIndex by setting the index of all dimensions to the specified value.
-
Index flattenedIndexWithinSpace(const NDSize &spaceSize, MemoryOrder majorType = MemoryOrder::ROW_MAJOR) const noexcept#
Get the flattened version within an N-dimensional block with size specified by an NDSize
-
Index flattenedIndexWithinSpace(const PlacesSizeWithGhost &sizeWithGhost, MemoryOrder majorType = MemoryOrder::ROW_MAJOR) const noexcept#
Get the flattened version within an N-dimensional block with size specified by a PlacesSizeWithGhost
-
std::optional<NDIndex> neighbourWithinSpace(NeighbourId neighbourId, const NDSize &spaceSize) const noexcept#
Get the N-dimensional index of the neighbor at the specified neighboring direction within an N-dimensional block with size specified by an NDSize.
If such neighbor does not exist (e.g.: out of the size of the block), return
std::nullopt
-
inline NDIndex(const std::initializer_list<Index> &initList)#