42 #ifndef STOKHOS_DYNAMIC_STRIDED_STORAGE_HPP
43 #define STOKHOS_DYNAMIC_STRIDED_STORAGE_HPP
47 #include "Kokkos_Macros.hpp"
49 #include "Sacado_Traits.hpp"
55 template <
typename ordinal_t,
typename value_t,
typename device_t>
77 template <
typename ord_t,
typename val_t = value_t,
typename dev_t = device_t >
83 KOKKOS_INLINE_FUNCTION
91 KOKKOS_INLINE_FUNCTION
98 KOKKOS_INLINE_FUNCTION
103 KOKKOS_INLINE_FUNCTION
116 KOKKOS_INLINE_FUNCTION
129 KOKKOS_INLINE_FUNCTION
135 KOKKOS_INLINE_FUNCTION
164 KOKKOS_INLINE_FUNCTION
193 KOKKOS_INLINE_FUNCTION
223 KOKKOS_INLINE_FUNCTION
253 KOKKOS_INLINE_FUNCTION
263 KOKKOS_INLINE_FUNCTION
273 KOKKOS_INLINE_FUNCTION
286 KOKKOS_INLINE_FUNCTION
299 KOKKOS_INLINE_FUNCTION
308 KOKKOS_INLINE_FUNCTION
317 KOKKOS_INLINE_FUNCTION
339 KOKKOS_INLINE_FUNCTION
361 KOKKOS_INLINE_FUNCTION
373 KOKKOS_INLINE_FUNCTION
385 KOKKOS_INLINE_FUNCTION
389 KOKKOS_INLINE_FUNCTION
393 KOKKOS_INLINE_FUNCTION
399 KOKKOS_INLINE_FUNCTION
405 KOKKOS_INLINE_FUNCTION
411 KOKKOS_INLINE_FUNCTION
417 KOKKOS_INLINE_FUNCTION
421 KOKKOS_INLINE_FUNCTION
425 KOKKOS_INLINE_FUNCTION
429 KOKKOS_INLINE_FUNCTION
433 KOKKOS_INLINE_FUNCTION
437 KOKKOS_INLINE_FUNCTION
441 KOKKOS_INLINE_FUNCTION
445 KOKKOS_INLINE_FUNCTION
467 template <
typename ordinal_t,
typename value_t,
typename device_t>
468 struct StringName< Stokhos::DynamicStridedStorage<ordinal_t,
472 std::stringstream ss;
473 ss <<
"Stokhos::DynamicStridedStorage<"
474 << StringName<ordinal_t>::eval() <<
","
475 << StringName<value_t>::eval() <<
","
476 << StringName<device_t>::eval() <<
">";
482 #endif // STOKHOS_DYNAMIC_STORAGE_HPP
KOKKOS_INLINE_FUNCTION DynamicStridedStorage(const ordinal_type &sz=1, const value_type &x=value_type(0.0))
Constructor.
KOKKOS_INLINE_FUNCTION void resize(const ordinal_type &sz)
Resize to new size (values are preserved)
KOKKOS_INLINE_FUNCTION volatile_pointer coeff() volatile
Get coefficients.
static std::string eval()
const value_type * const_pointer
KOKKOS_INLINE_FUNCTION void init(const_pointer v, const ordinal_type &sz=0) volatile
Initialize values to an array of values.
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 void resize(const ordinal_type &sz) volatile
Resize to new size (values are preserved)
pointer coeff_
Coefficient values.
KOKKOS_INLINE_FUNCTION ordinal_type size() const
Return size.
KOKKOS_INLINE_FUNCTION DynamicStridedStorage(const volatile DynamicStridedStorage &s)
Constructor.
KOKKOS_INLINE_FUNCTION void init(const_reference v) volatile
Initialize values to a constant value.
KOKKOS_INLINE_FUNCTION const_volatile_pointer coeff() const volatile
Get coefficients.
KOKKOS_INLINE_FUNCTION const_volatile_reference getCoeff() const volatile
ordinal_type stride_
Stride of array.
KOKKOS_INLINE_FUNCTION ordinal_type size() const volatile
Return size.
Turn DynamicStridedStorage into a meta-function class usable with mpl::apply.
KOKKOS_INLINE_FUNCTION ~DynamicStridedStorage()
Destructor.
Stokhos::DynArrayTraits< value_type, execution_space > ds
KOKKOS_INLINE_FUNCTION DynamicStridedStorage(const ordinal_type &sz, pointer v, bool owned)
Constructor for creating a view.
static const int static_size
DynamicStridedStorage< ord_t, val_t, dev_t > type
static KOKKOS_INLINE_FUNCTION void fill(T *dest, std::size_t sz, const T &v)
Fill array dest of length sz with value v.
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.
KOKKOS_INLINE_FUNCTION pointer coeff()
Get coefficients.
bool is_owned_
Do we own the array.
KOKKOS_INLINE_FUNCTION const_reference getCoeff() const
KOKKOS_INLINE_FUNCTION volatile DynamicStridedStorage & operator=(const DynamicStridedStorage &s) volatile
Assignment operator.
static const bool is_static
const volatile value_type & const_volatile_reference
const value_type & const_reference
KOKKOS_INLINE_FUNCTION const_reference operator[](const ordinal_type &i) const
Coefficient access (avoid if possible)
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.
KOKKOS_INLINE_FUNCTION reference getCoeff()
KOKKOS_INLINE_FUNCTION const_pointer coeff() const
Get coefficients.
KOKKOS_INLINE_FUNCTION DynamicStridedStorage & operator=(const volatile DynamicStridedStorage &s)
Assignment operator.
const volatile value_type * const_volatile_pointer
KOKKOS_INLINE_FUNCTION void load(pointer v) volatile
Load values to an array of values.
volatile value_type & volatile_reference
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.
ordinal_type sz_
Size of array used.
KOKKOS_INLINE_FUNCTION void init(const_reference v)
Initialize values to a constant value.
Dynamic array allocation class that is specialized for scalar i.e., fundamental or built-in types (fl...
KOKKOS_INLINE_FUNCTION DynamicStridedStorage(const ordinal_type &sz, const value_type *x)
Constructor from array.
KOKKOS_INLINE_FUNCTION void load(pointer v)
Load values to an array of values.
KOKKOS_INLINE_FUNCTION void init(const_pointer v, const ordinal_type &sz=0)
Initialize values to an array of values.
KOKKOS_INLINE_FUNCTION volatile DynamicStridedStorage & operator=(const volatile DynamicStridedStorage &s) volatile
Assignment operator.
KOKKOS_INLINE_FUNCTION DynamicStridedStorage & operator=(const DynamicStridedStorage &s)
Assignment operator.
KOKKOS_INLINE_FUNCTION DynamicStridedStorage(const DynamicStridedStorage &s)
Constructor.
KOKKOS_INLINE_FUNCTION volatile_reference getCoeff() volatile
static const bool supports_reset
volatile value_type * volatile_pointer
static KOKKOS_INLINE_FUNCTION void destroy_and_release(T *m, std::size_t sz)
Destroy array elements and release memory.