30 #ifndef SACADO_FAD_EXP_STATICSTORAGE_HPP
31 #define SACADO_FAD_EXP_STATICSTORAGE_HPP
33 #include <type_traits>
49 template <
typename T,
int Num>
60 template <
typename TT>
89 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
91 throw "StaticStorage::StaticStorage() Error: Supplied derivative dimension exceeds maximum length.";
114 for (
int i=0; i<
sz_; i++)
122 for (
int i=0; i<
sz_; i++)
123 dx_[i] = std::move(x.dx_[i]);
137 for (
int i=0; i<
sz_; i++)
147 val_ = std::move(x.val_);
149 for (
int i=0; i<
sz_; i++)
150 dx_[i] = std::move(x.dx_[i]);
166 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
168 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
180 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
182 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
196 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
198 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
252 #endif // SACADO_FAD_EXP_STATICSTORAGE_HPP
static constexpr int static_size
KOKKOS_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
Turn StaticStorage into a meta-function class usable with mpl::apply.
KOKKOS_INLINE_FUNCTION StaticStorage()
Default constructor.
int sz_
Size of derivative array.
StaticStorage< T, Num > type
KOKKOS_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION T & val()
Returns value.
KOKKOS_INLINE_FUNCTION StaticStorage(const int sz, const int i, const value_type &x)
Constructor with size sz, index i, and value x.
KOKKOS_INLINE_FUNCTION void zero()
Zero out derivative array.
KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
KOKKOS_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION StaticStorage(const T &x)
Constructor with value.
static KOKKOS_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.
KOKKOS_INLINE_FUNCTION ~StaticStorage()
Destructor.
std::remove_cv< T >::type value_type
#define KOKKOS_INLINE_FUNCTION
StaticStorage< TT, Num > type
T dx_[Num]
Derivative array.
KOKKOS_INLINE_FUNCTION StaticStorage(const StaticStorage &x)
Copy constructor.
KOKKOS_INLINE_FUNCTION StaticStorage & operator=(const StaticStorage &x)
Assignment.
static constexpr bool is_view
KOKKOS_INLINE_FUNCTION StaticStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
KOKKOS_INLINE_FUNCTION int length() const
Returns array length.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
static constexpr bool is_statically_sized
KOKKOS_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION StaticStorage & operator=(StaticStorage &&x)
Move assignment.
Initialize the derivative array.
Derivative array storage class using static memory allocation.
Replace static derivative length (interpreted as a fixed length)
KOKKOS_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
KOKKOS_INLINE_FUNCTION const T * dx() const
Returns derivative array.
KOKKOS_INLINE_FUNCTION StaticStorage(StaticStorage &&x)
Move constructor.