10 #ifndef STOKHOS_DYNAMIC_STORAGE_HPP
11 #define STOKHOS_DYNAMIC_STORAGE_HPP
15 #include "Kokkos_Macros.hpp"
17 #include "Sacado_Traits.hpp"
23 template <
typename ordinal_t,
typename value_t,
typename device_t>
46 template <
typename ord_t,
typename val_t = value_t ,
typename dev_t = device_t >
57 KOKKOS_INLINE_FUNCTION
79 KOKKOS_INLINE_FUNCTION
101 KOKKOS_INLINE_FUNCTION
106 KOKKOS_INLINE_FUNCTION
121 KOKKOS_INLINE_FUNCTION
136 KOKKOS_INLINE_FUNCTION
143 KOKKOS_INLINE_FUNCTION
173 KOKKOS_INLINE_FUNCTION
203 KOKKOS_INLINE_FUNCTION
233 KOKKOS_INLINE_FUNCTION
263 KOKKOS_INLINE_FUNCTION
269 KOKKOS_INLINE_FUNCTION
275 KOKKOS_INLINE_FUNCTION
284 KOKKOS_INLINE_FUNCTION
293 KOKKOS_INLINE_FUNCTION
299 KOKKOS_INLINE_FUNCTION
305 KOKKOS_INLINE_FUNCTION
331 KOKKOS_INLINE_FUNCTION
357 KOKKOS_INLINE_FUNCTION
368 KOKKOS_INLINE_FUNCTION
379 KOKKOS_INLINE_FUNCTION
383 KOKKOS_INLINE_FUNCTION
387 KOKKOS_INLINE_FUNCTION
391 KOKKOS_INLINE_FUNCTION
395 KOKKOS_INLINE_FUNCTION
401 KOKKOS_INLINE_FUNCTION
407 KOKKOS_INLINE_FUNCTION
411 KOKKOS_INLINE_FUNCTION
416 KOKKOS_INLINE_FUNCTION
420 KOKKOS_INLINE_FUNCTION
424 KOKKOS_INLINE_FUNCTION
428 KOKKOS_INLINE_FUNCTION
432 KOKKOS_INLINE_FUNCTION
436 KOKKOS_INLINE_FUNCTION
440 KOKKOS_INLINE_FUNCTION
444 KOKKOS_INLINE_FUNCTION
472 #endif // STOKHOS_DYNAMIC_STORAGE_HPP
pointer coeff_
Coefficient values.
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const volatile DynamicStorage &s) volatile
Assignment operator.
KOKKOS_INLINE_FUNCTION void init(const_pointer v, const ordinal_type &sz=0) volatile
Initialize values to an array of values.
Stokhos::DynArrayTraits< value_type, execution_space > ds
#define STOKHOS_STORAGE_HELPER_STRINGNAME_DYNAMIC(__storagename__)
KOKKOS_INLINE_FUNCTION const_volatile_pointer coeff() const volatile
Get coefficients.
KOKKOS_INLINE_FUNCTION void init(const_reference v)
Initialize values to a constant value.
KOKKOS_INLINE_FUNCTION DynamicStorage(const ordinal_type &sz=1, const value_type &x=value_type(0.0))
Constructor.
KOKKOS_INLINE_FUNCTION volatile_pointer coeff() volatile
Get coefficients.
KOKKOS_INLINE_FUNCTION const_volatile_reference getCoeff() const volatile
Kokkos::DefaultExecutionSpace execution_space
KOKKOS_INLINE_FUNCTION ~DynamicStorage()
Destructor.
device_t::memory_space memory_space
DynamicStorage< ord_t, val_t, dev_t > type
const volatile value_type & const_volatile_reference
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const DynamicStorage &s)
Assignment operator.
KOKKOS_INLINE_FUNCTION const_pointer coeff() const
Get coefficients.
Turn DynamicStorage into a meta-function class usable with mpl::apply.
KOKKOS_INLINE_FUNCTION void shallowReset(pointer v, const ordinal_type &sz, const ordinal_type &stride, bool owned) volatile
Reset storage to given array, size, and stride.
KOKKOS_INLINE_FUNCTION DynamicStorage(const ordinal_type &sz, const value_type *x)
Constructor from array.
KOKKOS_INLINE_FUNCTION void resize(const ordinal_type &sz) volatile
Resize to new size (values are preserved)
KOKKOS_INLINE_FUNCTION const_reference operator[](const ordinal_type &i) const
Coefficient access (avoid if possible)
KOKKOS_INLINE_FUNCTION void init(const_reference v) volatile
Initialize values to a constant value.
const value_type * const_pointer
static KOKKOS_INLINE_FUNCTION void fill(T *dest, std::size_t sz, const T &v)
Fill array dest of length sz with value v.
KOKKOS_INLINE_FUNCTION DynamicStorage(const volatile DynamicStorage &s)
Constructor.
static KOKKOS_INLINE_FUNCTION T * get_and_fill(std::size_t sz, const T &x=T(0.0))
Get memory for new array of length sz and fill with zeros.
device_t::execution_space execution_space
KOKKOS_INLINE_FUNCTION void resize(const ordinal_type &sz)
Resize to new size (values are preserved)
KOKKOS_INLINE_FUNCTION void load(pointer v) volatile
Load values to an array of values.
volatile value_type * volatile_pointer
KOKKOS_INLINE_FUNCTION const_reference getCoeff() const
KOKKOS_INLINE_FUNCTION volatile_reference getCoeff() volatile
ordinal_type sz_
Size of array used.
KOKKOS_INLINE_FUNCTION bool is_view() const
Return whether storage is a view.
static const bool supports_reset
KOKKOS_INLINE_FUNCTION pointer coeff()
Get coefficients.
volatile value_type & volatile_reference
KOKKOS_INLINE_FUNCTION bool is_view() const volatile
Return whether storage is a view.
KOKKOS_INLINE_FUNCTION ordinal_type size() const volatile
Return size.
KOKKOS_INLINE_FUNCTION void load(pointer v)
Load values to an array of values.
KOKKOS_INLINE_FUNCTION void shallowReset(pointer v, const ordinal_type &sz, const ordinal_type &stride, bool owned)
Reset storage to given array, size, and stride.
static KOKKOS_INLINE_FUNCTION void copy(const volatile T *src, volatile T *dest, std::size_t sz)
Copy array from src to dest of length sz.
Dynamic array allocation class that is specialized for scalar i.e., fundamental or built-in types (fl...
const value_type & const_reference
KOKKOS_INLINE_FUNCTION ordinal_type size() const
Return size.
bool is_view_
Do we own the array.
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const DynamicStorage &s) volatile
Assignment operator.
KOKKOS_INLINE_FUNCTION DynamicStorage(const DynamicStorage &s)
Constructor.
KOKKOS_INLINE_FUNCTION reference getCoeff()
static const bool is_static
const volatile value_type * const_volatile_pointer
KOKKOS_INLINE_FUNCTION DynamicStorage(const ordinal_type &sz, pointer v, bool owned)
Constructor for creating a view.
DynamicStorage< ordinal_type, value_type, device_t > type
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const volatile DynamicStorage &s)
Assignment operator.
bool is_constant_
Is the coefficient array length-1.
value_type coeff_0_
Coefficient value when sz_ == 1 (i.e., a constant)
static const int static_size
KOKKOS_INLINE_FUNCTION void init(const_pointer v, const ordinal_type &sz=0)
Initialize values to an array of values.
static KOKKOS_INLINE_FUNCTION void destroy_and_release(T *m, std::size_t sz)
Destroy array elements and release memory.