30 #ifndef SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
31 #define SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
35 #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
42 template <
typename T,
typename U = T>
43 using VectorDynamicStorage = Exp::VectorDynamicStorage<T,U>;
58 template <
typename T,
typename U = T>
120 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
122 throw "Can\'t resize beyond original size when memory isn't owned!";
153 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
155 throw "Can\'t resize beyond original size when memory isn't owned!";
173 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
175 throw "Can\'t resize beyond original size when memory isn't owned!";
195 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
197 throw "Can\'t resize beyond original size when memory isn't owned!";
290 #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT
292 #endif // SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
static KOKKOS_INLINE_FUNCTION T * strided_get_and_fill(const T *src, int stride, int sz)
Get memory for new array of length sz and fill with entries from src.
static KOKKOS_INLINE_FUNCTION T * get(int sz)
Get memory for new array of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const T *src, T *dest, int sz)
Copy array from src to dest of length sz.
KOKKOS_INLINE_FUNCTION T & val()
Returns value.
int sz_
Derivative array size.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const VectorDynamicStorage &x)
Copy constructor.
KOKKOS_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
#define SACADO_ENABLE_VALUE_CTOR_DECL
static KOKKOS_INLINE_FUNCTION void strided_zero(T *dest, int stride, int sz)
Zero out array dest of length sz.
KOKKOS_INLINE_FUNCTION void setMemory(int sz, T *x, U *dx_p, int stride)
Set value/derivative array memory.
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
KOKKOS_INLINE_FUNCTION U dx(int i) const
Returns derivative component i with bounds checking.
static KOKKOS_INLINE_FUNCTION void destroy_and_release(T *m, int sz)
Destroy array elements and release memory.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
int len_
Derivative array length.
#define KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION const U * dx() const
Returns derivative array.
bool owns_mem
Do we own the val/dx storage.
KOKKOS_INLINE_FUNCTION const U & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
static KOKKOS_INLINE_FUNCTION T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.
int stride_
Derivative array stride.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage & operator=(const VectorDynamicStorage &x)
Assignment.
static KOKKOS_INLINE_FUNCTION void strided_copy(const T *src, int src_stride, T *dest, int dest_stride, int sz)
Copy array from src to dest of length sz.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Default constructor.
Derivative array storage class using dynamic memory allocation.
KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
Initialize the derivative array.
KOKKOS_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
KOKKOS_INLINE_FUNCTION U & fastAccessDx(int i)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION ~VectorDynamicStorage()
Destructor.
KOKKOS_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const int sz, T *x, U *dx_p, const int stride, bool zero_out)
Constructor with supplied memory.
KOKKOS_INLINE_FUNCTION void zero()
Zero out derivative array.
KOKKOS_INLINE_FUNCTION int length() const
Returns array length.