30 #ifndef SACADO_FAD_EXP_STATICSTORAGE_HPP
31 #define SACADO_FAD_EXP_STATICSTORAGE_HPP
33 #include <type_traits>
48 template <
typename T,
int Num>
58 template <
typename TT>
86 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
88 throw "StaticStorage::StaticStorage() Error: Supplied derivative dimension exceeds maximum length.";
99 for (
int i=0; i<
sz_; i++)
114 for (
int i=0; i<
sz_; i++)
131 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
133 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
145 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
147 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
161 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
163 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
217 #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 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.
KOKKOS_INLINE_FUNCTION StaticStorage(const int sz, const T &x, const DerivInit zero_out)
Constructor with size sz.
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.
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.
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.