|
| AoSoA (const std::string &label="") |
| Default constructor.
|
|
| AoSoA (const std::string label, const size_type n) |
| Allocate a container with n tuples.
|
|
| AoSoA (soa_type *ptr, const size_type num_soa, const size_type n) |
| Create an unmanaged AoSoA with user-provided memory.
|
|
std::string | label () const |
| Returns the data structure label.
|
|
KOKKOS_FUNCTION size_type | size () const |
| Returns the number of tuples in the container.
|
|
KOKKOS_FUNCTION bool | empty () const |
| Returns if the container is empty or not.
|
|
KOKKOS_FUNCTION size_type | capacity () const |
| Returns the size of the storage space currently allocated for the container, expressed in terms of tuples.
|
|
void | resize (const size_type n) |
| Resizes the container so that it contains n tuples.
|
|
void | reserve (const size_type n) |
| Requests that the container capacity be at least enough to contain n tuples.
|
|
void | shrinkToFit () |
| Remove unused capacity.
|
|
KOKKOS_INLINE_FUNCTION size_type | numSoA () const |
| Get the number of structs-of-arrays in the container.
|
|
KOKKOS_INLINE_FUNCTION size_type | arraySize (const size_type s) const |
| Get the size of the data array at a given struct member index.
|
|
KOKKOS_FORCEINLINE_FUNCTION soa_type & | access (const size_type s) const |
| Get a reference to the SoA at a given index.
|
|
KOKKOS_INLINE_FUNCTION tuple_type | getTuple (const size_type i) const |
| Get a tuple at a given index via a deep copy.
|
|
KOKKOS_INLINE_FUNCTION void | setTuple (const size_type i, const tuple_type &tpl) const |
| Set a tuple at a given index via a deep copy.
|
|
soa_type * | data () const |
| Get a typed raw pointer to the entire data block.
|
|
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
class Cabana::AoSoA< DataTypes, MemorySpace, VectorLength, MemoryTraits >
Array-of-Struct-of-Arrays.
Represents tuples and their data via an array-of-structs-of-arrays.
- Template Parameters
-
DataType | (required) Specifically this must be an instance of MemberTypes with the data layout of the structs. For example:
General sequence of types for SoA and AoSoA member data. Definition Cabana_MemberTypes.hpp:28
would define an AoSoA where each tuple had a 3x3 matrix of doubles, a 3-vector of doubles, and an integer. The AoSoA is then templated on this sequence of types. In general, put larger datatypes first in the MemberType parameter pack (i.e. matrices and vectors) and group members of the same type together to achieve the smallest possible memory footprint based on compiler-generated padding. |
MemorySpace | (required) The Kokkos memory space. |
VectorLength | (optional) The vector length within the structs of the AoSoA. If not specified, this defaults to the preferred layout for the MemorySpace . |
MemoryTraits | (optional) Memory traits for the AoSoA data. Can be used to indicate managed memory, unmanaged memory, etc. |
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
KOKKOS_FUNCTION size_type Cabana::AoSoA< DataTypes, MemorySpace, VectorLength, MemoryTraits >::capacity |
( |
| ) |
const |
|
inline |
Returns the size of the storage space currently allocated for the container, expressed in terms of tuples.
- Returns
- The capacity of the container.
This capacity is not necessarily equal to the container size. It can be equal or greater, with the extra space allowing to accommodate for growth without the need to reallocate on each insertion.
Notice that this capacity does not suppose a limit on the size of the container. When this capacity is exhausted and more is needed, it is automatically expanded by the container (reallocating the storage space).
The capacity of a container can be explicitly altered by calling member reserve.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
KOKKOS_FUNCTION bool Cabana::AoSoA< DataTypes, MemorySpace, VectorLength, MemoryTraits >::empty |
( |
| ) |
const |
|
inline |
Returns if the container is empty or not.
- Returns
- True if the number of tuples in the container is zero.
This is the number of actual objects held in the container, which is not necessarily equal to its storage capacity.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
std::string Cabana::AoSoA< DataTypes, MemorySpace, VectorLength, MemoryTraits >::label |
( |
| ) |
const |
|
inline |
Returns the data structure label.
- Returns
- A string identifying the data structure.
This label will be assigned to the underlying Kokkos view managing the data of this class and can be used for debugging and profiling purposes.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
Requests that the container capacity be at least enough to contain n tuples.
If n is greater than the current container capacity, the function causes the container to reallocate its storage increasing its capacity to n (or greater).
In all other cases, the function call does not cause a reallocation and the container capacity is not affected.
If reallocation occurs, all slices and all references to the elements are invalidated. If no reallocation takes place, no slices or references are invalidated.
This function has no effect on the container size and cannot alter its tuples.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
Resizes the container so that it contains n tuples.
If n is smaller than the current container size, the content is reduced to its first n tuples.
If n is greater than the current container size, the content is expanded by inserting at the end as many tuples as needed to reach a size of n.
If n is also greater than the current container capacity, an automatic reallocation of the allocated storage space takes place.
Notice that this function changes the actual content of the container by inserting or erasing tuples from it. If reallocation occurs, all slices and all references to the elements are invalidated. If no reallocation takes place, no slices or references are invalidated.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
void Cabana::AoSoA< DataTypes, MemorySpace, VectorLength, MemoryTraits >::shrinkToFit |
( |
| ) |
|
|
inline |
Remove unused capacity.
Will reduce the capacity to be the smallest number of SoAs needed to hold size() tuples. If reallocation occurs, all slices and all references to the elements are invalidated. If no reallocation takes place, no slices or references are invalidated.
template<class DataTypes, class MemorySpace, int VectorLength = Impl::PerformanceTraits< typename MemorySpace::execution_space>::vector_length, class MemoryTraits = Kokkos::MemoryManaged>
Returns the number of tuples in the container.
- Returns
- The number of tuples in the container.
This is the number of actual objects held in the container, which is not necessarily equal to its storage capacity.