42 #ifndef STOKHOS_DYNAMIC_STORAGE_HPP
43 #define STOKHOS_DYNAMIC_STORAGE_HPP
47 #include "Kokkos_Macros.hpp"
49 #include "Sacado_Traits.hpp"
55 template <
typename ordinal_t,
typename value_t,
typename device_t>
78 template <
typename ord_t,
typename val_t = value_t ,
typename dev_t = device_t >
89 KOKKOS_INLINE_FUNCTION
111 KOKKOS_INLINE_FUNCTION
133 KOKKOS_INLINE_FUNCTION
138 KOKKOS_INLINE_FUNCTION
153 KOKKOS_INLINE_FUNCTION
168 KOKKOS_INLINE_FUNCTION
175 KOKKOS_INLINE_FUNCTION
205 KOKKOS_INLINE_FUNCTION
235 KOKKOS_INLINE_FUNCTION
265 KOKKOS_INLINE_FUNCTION
295 KOKKOS_INLINE_FUNCTION
301 KOKKOS_INLINE_FUNCTION
307 KOKKOS_INLINE_FUNCTION
316 KOKKOS_INLINE_FUNCTION
325 KOKKOS_INLINE_FUNCTION
331 KOKKOS_INLINE_FUNCTION
337 KOKKOS_INLINE_FUNCTION
363 KOKKOS_INLINE_FUNCTION
389 KOKKOS_INLINE_FUNCTION
400 KOKKOS_INLINE_FUNCTION
411 KOKKOS_INLINE_FUNCTION
415 KOKKOS_INLINE_FUNCTION
419 KOKKOS_INLINE_FUNCTION
423 KOKKOS_INLINE_FUNCTION
427 KOKKOS_INLINE_FUNCTION
433 KOKKOS_INLINE_FUNCTION
439 KOKKOS_INLINE_FUNCTION
443 KOKKOS_INLINE_FUNCTION
448 KOKKOS_INLINE_FUNCTION
452 KOKKOS_INLINE_FUNCTION
456 KOKKOS_INLINE_FUNCTION
460 KOKKOS_INLINE_FUNCTION
464 KOKKOS_INLINE_FUNCTION
468 KOKKOS_INLINE_FUNCTION
472 KOKKOS_INLINE_FUNCTION
476 KOKKOS_INLINE_FUNCTION
502 template <
typename ordinal_t,
typename value_t,
typename device_t>
503 struct StringName< Stokhos::DynamicStorage<ordinal_t,
507 std::stringstream ss;
508 ss <<
"Stokhos::DynamicStorage<"
509 << StringName<ordinal_t>::eval() <<
","
510 << StringName<value_t>::eval() <<
","
511 << StringName<device_t>::eval() <<
">";
517 #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
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
static std::string eval()
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.