Shortcuts

Template Function ripple::offset_to_soa

Function Documentation

template<typename SpatialImpl, typename ...Indices>
auto ripple::offset_to_soa(const MultidimSpace<SpatialImpl> &space, size_t element_size, Indices&&... indices) -> size_t

Returns the offset to the element at the index defined by the indices for each of the dimension in a space defined by the space.

The element_size is the number of elements in the array type when the data is stored in SoA format. If the data is stored in SoA format, but has a size of 1, this will compute the offset as if the data is stored contiguously.

For example, for a 2D velocity array with u and v, the layout would be

Here element_size would be 2, since to compute the offset it’s required that the vertical size be know. In the above example, with n=10, element_size=2, indices=(0, 1) would return an offset of 20, while indices=(4, 1) would return an offset of 24.

Parameters
  • space: The multidimensional space to get the offset in.

  • element_size: The size of the elements stored in the space.

  • indices: The indicies for the element in the space.

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

  • Indices: The types of the indices.

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