30 #ifndef SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
31 #define SACADO_FAD_EXP_STATICFIXEDSTORAGE_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 "StaticFixedStorage::StaticFixedStorage() Error: Supplied derivative dimension does not equal static length.";
103 for (
int i=0; i<Num; i++)
120 for (
int i=0; i<Num; i++)
128 constexpr
int size()
const {
return Num; }
132 constexpr
int length()
const {
return Num; }
137 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
138 if (sz != 0 && sz != Num)
139 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
151 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
152 if (sz != 0 && sz != Num)
153 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
161 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
163 throw "StaticFixedStorage::expand() Error: Cannot resize fixed storage length.";
211 #endif // SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
StaticFixedStorage< TT, Num > type
Replace static derivative length.
Turn StaticFixedStorage into a meta-function class usable with mpl::apply.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const StaticFixedStorage &x)
Copy constructor.
T dx_[Num]
Derivative array.
KOKKOS_INLINE_FUNCTION const T * dx() const
Returns derivative array.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const T &x)
Constructor with value.
KOKKOS_INLINE_FUNCTION constexpr int size() const
Returns number of derivative components.
KOKKOS_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
static KOKKOS_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.
KOKKOS_INLINE_FUNCTION constexpr int length() const
Returns array length.
#define KOKKOS_INLINE_FUNCTION
~StaticFixedStorage()=default
Destructor.
KOKKOS_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
Derivative array storage class using static, fixed memory allocation.
KOKKOS_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION void zero()
Zero out derivative array.
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
KOKKOS_INLINE_FUNCTION StaticFixedStorage & operator=(const StaticFixedStorage &x)
Assignment.
StaticFixedStorage< T, N > type
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
KOKKOS_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
Initialize the derivative array.
std::remove_cv< T >::type value_type
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const int sz, const T &x, const DerivInit zero_out)
Constructor with size sz.
static constexpr bool is_statically_sized
static constexpr int static_size
KOKKOS_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION T & val()
Returns value.
KOKKOS_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
StaticFixedStorage()=default
Default constructor.