10 #ifndef SACADO_FAD_DYNAMICSTORAGE_HPP
11 #define SACADO_FAD_DYNAMICSTORAGE_HPP
15 #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
22 template <
typename T,
typename U = T>
23 using DynamicStorage = Exp::DynamicStorage<T,U>;
38 template <
typename T,
typename U = T>
179 #if defined(SACADO_VIEW_CUDA_HIERARCHICAL_DFAD_STRIDED) && !defined(SACADO_DISABLE_CUDA_IN_KOKKOS) && defined(__CUDA_ARCH__)
183 U
dx(
int i)
const {
return sz_ ?
dx_[i*blockDim.x] : U(0.); }
229 #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT
231 #endif // SACADO_FAD_DYNAMICSTORAGE_HPP
SACADO_INLINE_FUNCTION ~DynamicStorage()
Destructor.
SACADO_INLINE_FUNCTION T & val()
Returns value.
Derivative array storage class using dynamic memory allocation.
#define SACADO_ENABLE_VALUE_CTOR_DECL
static SACADO_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.
SACADO_INLINE_FUNCTION U dx(int i) const
Returns derivative component i with bounds checking.
SACADO_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
SACADO_INLINE_FUNCTION DynamicStorage & operator=(const DynamicStorage &x)
Assignment.
SACADO_INLINE_FUNCTION DynamicStorage(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Default constructor.
SACADO_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
int len_
Derivative array length.
SACADO_INLINE_FUNCTION U & fastAccessDx(int i)
Returns derivative component i without bounds checking.
SACADO_INLINE_FUNCTION DynamicStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
static SACADO_INLINE_FUNCTION void destroy_and_release(T *m, int sz)
Destroy array elements and release memory.
SACADO_INLINE_FUNCTION const T & val() const
Returns value.
SACADO_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 SACADO_INLINE_FUNCTION void copy(const T *src, T *dest, int sz)
Copy array from src to dest of length sz.
SACADO_INLINE_FUNCTION DynamicStorage(const DynamicStorage &x)
Copy constructor.
SACADO_INLINE_FUNCTION int size() const
Returns number of derivative components.
Initialize the derivative array.
SACADO_INLINE_FUNCTION const U & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
static SACADO_INLINE_FUNCTION T * get(int sz)
Get memory for new array of length sz.
int sz_
Derivative array size.
#define SACADO_INLINE_FUNCTION
SACADO_INLINE_FUNCTION void zero()
Zero out derivative array.
SACADO_INLINE_FUNCTION const U * dx() const
Returns derivative array.
SACADO_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
static SACADO_INLINE_FUNCTION T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.