Shortcuts

Struct StridedStorageView::Allocator

Nested Relationships

This struct is a nested type of Template Class StridedStorageView.

Struct Documentation

struct ripple::StridedStorageView::Allocator

Allocator for the strided storage.

This can be used to determine the memory requirement for the storage for a spicifc spatial configuration, as well as to access into the storage space.

Public Static Functions

constexpr auto allocation_size(size_t elements) noexcept -> size_t

Computes the number of bytes required to allocate the the number of specified elements.

Return

The number of bytes required to allocate the number of elements.

Parameters
  • elements: The number of elements to allocate.

template<size_t Elements>
constexpr auto allocation_size() noexcept -> size_t

Computesthe number of bytes required to allocate a total of Elements of the types defined by Ts.

This overload of the function can be used to allocate static memory when the number of elements in the space is known at compile time.

Return

The number of bytes required to allocated the number of elements.

Template Parameters
  • Elements: The number of elements to allocate.

constexpr auto strided_types() noexcept -> size_t

Gets the number of types which are stored strided.

Return

The number of types which are stored strided.

template<size_t I>
constexpr auto num_elements() noexcept -> size_t

Gets the number of elements in the Ith type.

Return

The number of elements in the ith type.

Template Parameters
  • I: The index of the type.

template<size_t I>
constexpr auto element_byte_size() noexcept -> size_t

Gets the number of bytes for an elemeent in the Ith type.

Return

The number of bytes for an element in the Ith type.

Template Parameters
  • I: The index of the type to get the element size of.

template<typename SpaceImpl, typename Dim>
auto offset(const Storage &storage, const MultidimSpace<SpaceImpl> &space, Dim &&dim, int amount) noexcept -> Storage

Offsets the storage by the amount specified in the given dimension.

Return

A new strided storage offset by the given amount.

Parameters
  • storage: The storage to offset.

  • space: The space for which the storage is defined.

  • dim: The dimension to offset in.

Template Parameters
  • SpaceImpl: The implementation of the spatial interface.

  • Dim: The type of the dimension.

template<typename SpaceImpl, typename Dim>
auto shift(Storage &storage, const MultidimSpace<SpaceImpl> &space, Dim &&dim, int amount) noexcept -> void

Shifts the storage by the amount specified in the given dimension.

Return

A new strided storage offset by the given amount.

Parameters
  • storage: The storage to offset.

  • space: The space for which the storage is defined.

  • dim: The dimension to offset in.

Template Parameters
  • SpaceImpl: The implementation of the spatial interface.

  • Dim: The type of the dimension.

template<typename SpaceImpl>
auto create(void *ptr, const MultidimSpace<SpaceImpl> &space) noexcept -> Storage

Creates the storage, initializing a StridedStorage instance which has its data pointers pointing to the given pointer.

Note

The memory space should have a size which is that returned by the allocation_size() method, otherwise this may index into undefined memory.

Return

A new strided storage pointing to given pointer.

Parameters
  • ptr: A pointer to the data to create the storage in.

  • space: The space for which the storage is defined.

  • is: The indices to offset to in the space.

Template Parameters
  • SpaceImpl: The implementation of the spatial interface.

  • Indices: The types of the indices.

Public Static Attributes

constexpr size_t alignment = max_element(storage_element_traits_t<Ts>::align_size...)

Returns the alignment required to allocate the storage.

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples