Template Function ripple::offset_to_soa¶
Defined in File offset_to.hpp
Function Documentation¶
-
template<typename
SpatialImpl
, typename ...Indices
>
autoripple
::
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 thespace
.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, withn=10
,element_size=2
,indices=(0, 1)
would return an offset of 20, whileindices=(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.