The base class for Kokkos jagged arrays. More...
#include <KokkosJaggedArray.h>
Public Member Functions | |
| void | create (const std::vector< dof_id_type > &n) |
| Allocate outer array. More... | |
| void | reserve (const std::array< dof_id_type, outer > &index, const std::array< dof_id_type, inner > &dimension) |
| Reserve inner array for an outer array entry. More... | |
| void | finalize () |
| Setup array structure. More... | |
| void | copyToDevice () |
| Copy data from host to device. More... | |
| void | copyToHost () |
| Copy data from device to host. More... | |
| auto & | array () |
| Get the underlying data array. More... | |
| KOKKOS_FUNCTION bool | isFinalized () const |
| Get whether the array is finalized. More... | |
| KOKKOS_FUNCTION dof_id_type | size () const |
| Get the total data array size. More... | |
| KOKKOS_FUNCTION dof_id_type | n () const |
| Get the total outer array size. More... | |
| KOKKOS_FUNCTION dof_id_type | n (unsigned int dim) const |
| Get the size of a dimension of the outer array. More... | |
| KOKKOS_FUNCTION auto | operator[] (dof_id_type i) const |
| Get an inner array. More... | |
Protected Attributes | |
| Array< T > | _data |
| Sequential data array. More... | |
| Array< JaggedArrayInnerDim< inner >, outer > | _dims |
| Dimension information of each inner array. More... | |
| Array< dof_id_type, outer > | _offsets |
| Starting offset of each inner array into the sequential data array. More... | |
| bool | _finalized |
| Whether the array was finalized. More... | |
The base class for Kokkos jagged arrays.
A Kokkos jagged array aids in treating jagged arrays conveniently and efficiently by using a sequential data storage and providing multi-dimensional indexing using internal dope vectors. A jagged array is divided into the inner and outer arrays. The outer array is the regular part of a jagged array. Each entry of the outer array can hold an inner array, whose size can vary with each other. Calling create() will allocate the outer array, and inner arrays should be reserved one-by-one through reserve(). Once the array structure is set, finalize() should be called. A finalized array cannot be restructured unless it is reset completely by calling create() again. The inner array returned by operator() or operator[] using the outer array index is held in a temporary wrapper object. To avoid the overhead of temporary object creation, it is recommended to store the object locally.
| T | The data type |
| inner | The inner array dimension size |
| outer | The outer array dimension size |
Definition at line 221 of file KokkosJaggedArray.h.
|
inline |
Get the underlying data array.
Definition at line 263 of file KokkosJaggedArray.h.
|
inline |
Copy data from host to device.
Definition at line 244 of file KokkosJaggedArray.h.
|
inline |
Copy data from device to host.
Definition at line 253 of file KokkosJaggedArray.h.
| void Moose::Kokkos::JaggedArrayBase< T, inner, outer >::create | ( | const std::vector< dof_id_type > & | n | ) |
Allocate outer array.
| n | The vector containing the size of each dimension for the outer array |
Definition at line 328 of file KokkosJaggedArray.h.
Referenced by Moose::Kokkos::JaggedArray< T, inner, 1 >::create(), Moose::Kokkos::JaggedArray< T, inner, 2 >::create(), and Moose::Kokkos::JaggedArray< T, inner, 3 >::create().
| void Moose::Kokkos::JaggedArrayBase< T, inner, outer >::finalize | ( | ) |
Setup array structure.
Definition at line 366 of file KokkosJaggedArray.h.
|
inline |
Get whether the array is finalized.
Definition at line 269 of file KokkosJaggedArray.h.
|
inline |
Get the total outer array size.
Definition at line 279 of file KokkosJaggedArray.h.
|
inline |
Get the size of a dimension of the outer array.
| dim | The dimension index |
Definition at line 285 of file KokkosJaggedArray.h.
|
inline |
Get an inner array.
| i | The dimensionless outer array index |
Definition at line 291 of file KokkosJaggedArray.h.
| void Moose::Kokkos::JaggedArrayBase< T, inner, outer >::reserve | ( | const std::array< dof_id_type, outer > & | index, |
| const std::array< dof_id_type, inner > & | dimension | ||
| ) |
Reserve inner array for an outer array entry.
| index | The array containing the index for the outer array |
| dimension | The array containing the size of each dimension for the inner array |
Definition at line 339 of file KokkosJaggedArray.h.
|
inline |
Get the total data array size.
Definition at line 274 of file KokkosJaggedArray.h.
|
protected |
Sequential data array.
Definition at line 304 of file KokkosJaggedArray.h.
Referenced by Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::array(), Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::copyToDevice(), Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::copyToHost(), Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::operator[](), and Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::size().
|
protected |
Dimension information of each inner array.
Definition at line 308 of file KokkosJaggedArray.h.
Referenced by Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::operator[]().
|
protected |
Whether the array was finalized.
Definition at line 316 of file KokkosJaggedArray.h.
Referenced by Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::copyToDevice(), Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::copyToHost(), and Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::isFinalized().
|
protected |
Starting offset of each inner array into the sequential data array.
Definition at line 312 of file KokkosJaggedArray.h.
Referenced by Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::n(), and Moose::Kokkos::JaggedArrayBase< T, inner, 1 >::operator[]().
1.8.14