Struct NDOffset#

Struct Documentation#

struct NDOffset#

A type representing an N-dimensional offset

Modeled as an array of offset at each dimension. To retrieve the offset 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 NDOffset(const std::initializer_list<Offset> &initList)#

Initialize an NDOffset by providing the offset at each dimension

inline explicit NDOffset(const Dimension dimensions, const Offset value = 0)#

Initialize an NDOffset by setting the offset at all dimension to the specified value

inline const Offset &operator[](const Index dimIndex) const noexcept#

Get the offset at certain dimension

inline Offset &operator[](const Index dimIndex) noexcept#

Get the offset at certain dimension

inline Dimension dimensions() const noexcept#
Offset flattenedOffsetWithinSpace(const NDSize &size, MemoryOrder majorType = MemoryOrder::ROW_MAJOR) const noexcept#

Calculate the flattened version within an N-dimensional block with size specified by an NDSize

Offset flattenedOffsetWithinSpace(const PlacesSizeWithGhost &sizeWithGhost, MemoryOrder majorType = MemoryOrder::ROW_MAJOR) const noexcept#

Calculate the flattened version within an N-dimensional block with size specified by an PlacesSizeWithGhost

NeighbourId mappedNeighbourId() const noexcept#

Calculate the corresponding neighbor direction

inline Offset *data() noexcept#
inline const Offset *data() const noexcept#
inline mass::span<const Offset> span() const noexcept#
inline mass::span<Offset> span() noexcept#
inline bool operator==(const NDOffset &other) const noexcept#

Friends

friend std::ostream &operator<<(std::ostream &os, const NDOffset &offset)#