10 #ifndef SACADO_FAD_EXP_STATICSTORAGE_HPP
11 #define SACADO_FAD_EXP_STATICSTORAGE_HPP
13 #include <type_traits>
29 template <
typename T,
int Num>
40 template <
typename TT>
69 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__ )
71 throw "StaticStorage::StaticStorage() Error: Supplied derivative dimension exceeds maximum length.";
103 dx_[
i] = std::move(
x.dx_[
i]);
127 val_ = std::move(
x.val_);
130 dx_[
i] = std::move(
x.dx_[
i]);
146 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__ )
148 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
160 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__ )
162 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
176 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__ )
178 throw "StaticStorage::resize() Error: Supplied derivative dimension exceeds maximum length.";
232 #endif // SACADO_FAD_EXP_STATICSTORAGE_HPP
static constexpr int static_size
SACADO_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
SACADO_INLINE_FUNCTION T & val()
Returns value.
SACADO_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
Turn StaticStorage into a meta-function class usable with mpl::apply.
int sz_
Size of derivative array.
SACADO_INLINE_FUNCTION StaticStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
SACADO_INLINE_FUNCTION StaticStorage & operator=(const StaticStorage &x)
Assignment.
StaticStorage< T, Num > type
SACADO_INLINE_FUNCTION const T & val() const
Returns value.
SACADO_INLINE_FUNCTION StaticStorage(const T &x)
Constructor with value.
std::remove_cv< T >::type value_type
SACADO_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
SACADO_INLINE_FUNCTION StaticStorage & operator=(StaticStorage &&x)
Move assignment.
StaticStorage< TT, Num > type
SACADO_INLINE_FUNCTION StaticStorage()
Default constructor.
SACADO_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
T dx_[Num]
Derivative array.
SACADO_INLINE_FUNCTION int length() const
Returns array length.
static constexpr bool is_view
SACADO_INLINE_FUNCTION ~StaticStorage()
Destructor.
SACADO_INLINE_FUNCTION StaticStorage(StaticStorage &&x)
Move constructor.
SACADO_INLINE_FUNCTION void zero()
Zero out derivative array.
SACADO_INLINE_FUNCTION StaticStorage(const int sz, const int i, const value_type &x)
Constructor with size sz, index i, and value x.
SACADO_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
static constexpr bool is_statically_sized
static SACADO_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.
Initialize the derivative array.
SACADO_INLINE_FUNCTION const T * dx() const
Returns derivative array.
#define SACADO_INLINE_FUNCTION
SACADO_INLINE_FUNCTION int size() const
Returns number of derivative components.
SACADO_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
Derivative array storage class using static memory allocation.
SACADO_INLINE_FUNCTION StaticStorage(const StaticStorage &x)
Copy constructor.
Replace static derivative length (interpreted as a fixed length)