42 #ifndef STOKHOS_STATIC_FIXED_STORAGE_HPP
43 #define STOKHOS_STATIC_FIXED_STORAGE_HPP
48 #include "Kokkos_Core_fwd.hpp"
49 #include "Kokkos_Cuda.hpp"
51 #include "Sacado_Traits.hpp"
58 template <
typename ordinal_t,
typename value_t,
int Num,
typename device_t>
83 template <
typename ord_t,
typename val_t = value_t ,
typename dev_t = device_t >
94 KOKKOS_DEFAULTED_FUNCTION
98 KOKKOS_INLINE_FUNCTION
105 KOKKOS_INLINE_FUNCTION
111 KOKKOS_INLINE_FUNCTION
115 KOKKOS_DEFAULTED_FUNCTION
119 KOKKOS_INLINE_FUNCTION
125 KOKKOS_DEFAULTED_FUNCTION
129 KOKKOS_DEFAULTED_FUNCTION
133 KOKKOS_INLINE_FUNCTION
140 KOKKOS_INLINE_FUNCTION
148 KOKKOS_INLINE_FUNCTION
156 KOKKOS_INLINE_FUNCTION
162 KOKKOS_INLINE_FUNCTION
168 KOKKOS_INLINE_FUNCTION
177 KOKKOS_INLINE_FUNCTION
186 KOKKOS_INLINE_FUNCTION
192 KOKKOS_INLINE_FUNCTION
198 KOKKOS_INLINE_FUNCTION
202 KOKKOS_INLINE_FUNCTION
206 KOKKOS_INLINE_FUNCTION
211 KOKKOS_INLINE_FUNCTION
216 KOKKOS_INLINE_FUNCTION
220 KOKKOS_INLINE_FUNCTION
226 KOKKOS_INLINE_FUNCTION
232 KOKKOS_INLINE_FUNCTION
236 KOKKOS_INLINE_FUNCTION
241 KOKKOS_INLINE_FUNCTION
245 KOKKOS_INLINE_FUNCTION
249 KOKKOS_INLINE_FUNCTION
253 KOKKOS_INLINE_FUNCTION
257 KOKKOS_INLINE_FUNCTION
261 KOKKOS_INLINE_FUNCTION
265 KOKKOS_INLINE_FUNCTION
269 KOKKOS_INLINE_FUNCTION
275 #if STOKHOS_ALIGN_MEMORY && ( defined(__INTEL_COMPILER) )
283 #if defined(KOKKOS_ENABLE_CUDA)
290 template <
typename ordinal_t,
typename value_t,
int Num>
311 typedef typename execution_space::memory_space
memory_space;
315 template <
typename ord_t,
typename val_t = value_t ,
typename dev_t = execution_space >
322 typedef StaticFixedStorage<ordinal_type,value_type,N,execution_space>
type;
326 KOKKOS_DEFAULTED_FUNCTION
330 KOKKOS_INLINE_FUNCTION
337 KOKKOS_INLINE_FUNCTION
343 KOKKOS_INLINE_FUNCTION
347 KOKKOS_DEFAULTED_FUNCTION
351 KOKKOS_INLINE_FUNCTION
353 ss::copy(s.coeff_,
coeff_, Num);
357 KOKKOS_DEFAULTED_FUNCTION
361 KOKKOS_DEFAULTED_FUNCTION
365 KOKKOS_INLINE_FUNCTION
367 ss::copy(s.coeff_,
coeff_, Num);
372 KOKKOS_INLINE_FUNCTION
375 ss::copy(s.coeff_,
coeff_, Num);
380 KOKKOS_INLINE_FUNCTION
383 ss::copy(s.coeff_,
coeff_, Num);
388 KOKKOS_INLINE_FUNCTION
394 KOKKOS_INLINE_FUNCTION
400 KOKKOS_INLINE_FUNCTION
409 KOKKOS_INLINE_FUNCTION
418 KOKKOS_INLINE_FUNCTION
424 KOKKOS_INLINE_FUNCTION
430 KOKKOS_INLINE_FUNCTION
434 KOKKOS_INLINE_FUNCTION
438 KOKKOS_INLINE_FUNCTION
443 KOKKOS_INLINE_FUNCTION
448 KOKKOS_INLINE_FUNCTION
452 KOKKOS_INLINE_FUNCTION
458 KOKKOS_INLINE_FUNCTION
464 KOKKOS_INLINE_FUNCTION
468 KOKKOS_INLINE_FUNCTION
473 KOKKOS_INLINE_FUNCTION
477 KOKKOS_INLINE_FUNCTION
481 KOKKOS_INLINE_FUNCTION
485 KOKKOS_INLINE_FUNCTION
489 KOKKOS_INLINE_FUNCTION
493 KOKKOS_INLINE_FUNCTION
497 KOKKOS_INLINE_FUNCTION
501 KOKKOS_INLINE_FUNCTION
516 template <
typename ordinal_t,
typename value_t,
int Num,
typename device_t>
517 struct StringName< Stokhos::StaticFixedStorage<ordinal_t,
522 std::stringstream ss;
523 ss <<
"Stokhos::StaticFixedStorage<"
524 << StringName<ordinal_t>::eval() <<
","
525 << StringName<value_t>::eval() <<
","
527 << StringName<device_t>::eval() <<
">";
533 #endif // STOKHOS_STATIC_FIXED_STORAGE_HPP
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 reference getCoeff()
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.
Statically allocated storage class.
KOKKOS_DEFAULTED_FUNCTION StaticFixedStorage()=default
Constructor.
Kokkos::DefaultExecutionSpace execution_space
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const ordinal_type &sz, const value_type &x=value_type(0.0))
Constructor.
Stokhos::StaticArrayTraits< value_type, execution_space > ss
const volatile value_type & const_volatile_reference
Static array allocation class.
KOKKOS_INLINE_FUNCTION void load(pointer v)
Load values to an array of values.
KOKKOS_INLINE_FUNCTION void load(pointer v) volatile
Load values to an array of values.
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< XD, XP...> >::value >::type fill(const Kokkos::View< XD, XP...> &x, const typename Kokkos::View< XD, XP...>::non_const_value_type &val)
static const int static_size
const volatile value_type * const_volatile_pointer
KOKKOS_INLINE_FUNCTION const_pointer coeff() const
Get coefficients.
Stokhos::MemoryTraits< memory_space > MemTraits
KOKKOS_INLINE_FUNCTION void init(const_pointer v, const ordinal_type &sz=0)
Initialize values to an array of values.
KOKKOS_INLINE_FUNCTION const_reference getCoeff() const
const value_type * const_pointer
KOKKOS_INLINE_FUNCTION void resize(const ordinal_type &sz)
Resize to new size (values are preserved)
Turn StaticFixedStorage into a meta-function class usable with mpl::apply.
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 resize(const ordinal_type &sz) volatile
Resize to new size (values are preserved)
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const ordinal_type &sz, pointer v, bool owned)
Constructor for creating a view (not allowed)
const value_type & const_reference
StaticFixedStorage< ordinal_type, value_type, N, device_t > type
Traits class encapsulting memory alignment.
KOKKOS_INLINE_FUNCTION StaticFixedStorage & operator=(const volatile StaticFixedStorage &s) volatile
Assignment operator.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const ordinal_type &sz, const value_type *x)
Constructor from array.
device_t::execution_space execution_space
KOKKOS_INLINE_FUNCTION StaticFixedStorage & operator=(const StaticFixedStorage &s) volatile
Assignment operator.
static std::string eval()
KOKKOS_INLINE_FUNCTION pointer coeff()
Get coefficients.
static const unsigned Alignment
Bytes to which memory allocations are aligned.
volatile value_type & volatile_reference
static KOKKOS_INLINE_FUNCTION ordinal_type size()
Return size.
KOKKOS_INLINE_FUNCTION const_volatile_reference getCoeff() const volatile
device_t::memory_space memory_space
KOKKOS_INLINE_FUNCTION volatile_reference getCoeff() volatile
static const bool is_static
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.
StaticFixedStorage< ord_t, val_t, Num, dev_t > type
KOKKOS_DEFAULTED_FUNCTION StaticFixedStorage & operator=(const StaticFixedStorage &s)=default
Assignment operator.
KOKKOS_INLINE_FUNCTION StaticFixedStorage & operator=(const volatile StaticFixedStorage &s)
Assignment operator.
static const bool supports_reset
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const volatile StaticFixedStorage &s)
Copy constructor.
value_type coeff_[Num]
Coefficient values.
KOKKOS_INLINE_FUNCTION volatile_pointer coeff() volatile
Get coefficients.
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_DEFAULTED_FUNCTION ~StaticFixedStorage()=default
Destructor.
volatile value_type * volatile_pointer