30#ifndef SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
31#define SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
49 template <
typename T,
int Num>
60 template <
typename TT>
72#ifdef SACADO_SFAD_INIT_DEFAULT_CONSTRUCTOR
98#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__)
100 throw "StaticFixedStorage::StaticFixedStorage() Error: Supplied derivative dimension does not equal static length.";
136 dx_[
i] = std::move(
x.dx_[
i]);
163 val_ = std::move(
x.val_);
165 dx_[
i] = std::move(
x.dx_[
i]);
181#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__)
182 if (sz != 0 && sz !=
Num)
183 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
195#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__)
196 if (sz != 0 && sz !=
Num)
197 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
205#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ ) && !defined(__HIP_DEVICE_COMPILE__)
207 throw "StaticFixedStorage::expand() Error: Cannot resize fixed storage length.";
#define SACADO_INLINE_FUNCTION
#define SACADO_DEFAULTED_FUNCTION
Fad specializations for Teuchos::BLAS wrappers.
Derivative array storage class using static, fixed memory allocation.
SACADO_INLINE_FUNCTION constexpr int size() const
Returns number of derivative components.
static constexpr bool is_statically_sized
SACADO_INLINE_FUNCTION constexpr int length() const
Returns array length.
T dx_[Num]
Derivative array.
SACADO_DEFAULTED_FUNCTION StaticFixedStorage()=default
Default constructor.
SACADO_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
std::remove_cv< T >::type value_type
SACADO_INLINE_FUNCTION T & val()
Returns value.
SACADO_INLINE_FUNCTION const T * dx() const
Returns derivative array.
SACADO_INLINE_FUNCTION StaticFixedStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
SACADO_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
SACADO_DEFAULTED_FUNCTION ~StaticFixedStorage()=default
Destructor.
SACADO_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
SACADO_INLINE_FUNCTION StaticFixedStorage(StaticFixedStorage &&x)
Move constructor.
SACADO_INLINE_FUNCTION const T & val() const
Returns value.
SACADO_INLINE_FUNCTION StaticFixedStorage(const StaticFixedStorage &x)
Copy constructor.
SACADO_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
SACADO_INLINE_FUNCTION StaticFixedStorage & operator=(const StaticFixedStorage &x)
Assignment.
SACADO_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
SACADO_INLINE_FUNCTION StaticFixedStorage(const int sz, const int i, const value_type &x)
Constructor with size sz, index i, and value x.
SACADO_INLINE_FUNCTION StaticFixedStorage & operator=(StaticFixedStorage &&x)
Move assignment.
SACADO_INLINE_FUNCTION void zero()
Zero out derivative array.
SACADO_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
static constexpr bool is_view
static constexpr int static_size
SACADO_INLINE_FUNCTION StaticFixedStorage(const T &x)
Constructor with value.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors.
@ InitDerivArray
Initialize the derivative array.
Replace static derivative length.
StaticFixedStorage< T, N > type
Turn StaticFixedStorage into a meta-function class usable with mpl::apply.
StaticFixedStorage< TT, Num > type
static SACADO_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.