10 #ifndef SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
11 #define SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
15 #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
22 template <
typename T,
typename U = T>
23 using VectorDynamicStorage = Exp::VectorDynamicStorage<T,U>;
38 template <
typename T,
typename U = T>
100 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
102 throw "Can\'t resize beyond original size when memory isn't owned!";
133 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
135 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!";
175 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
177 throw "Can\'t resize beyond original size when memory isn't owned!";
270 #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT
272 #endif // SACADO_FAD_VECTORDYNAMICSTORAGE_HPP
SACADO_INLINE_FUNCTION void setMemory(int sz, T *x, U *dx_p, int stride)
Set value/derivative array memory.
static SACADO_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.
SACADO_INLINE_FUNCTION U dx(int i) const
Returns derivative component i with bounds checking.
int sz_
Derivative array size.
SACADO_INLINE_FUNCTION VectorDynamicStorage(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Default constructor.
#define SACADO_ENABLE_VALUE_CTOR_DECL
SACADO_INLINE_FUNCTION const U * dx() const
Returns derivative array.
SACADO_INLINE_FUNCTION U & fastAccessDx(int i)
Returns derivative component i without bounds checking.
SACADO_INLINE_FUNCTION ~VectorDynamicStorage()
Destructor.
SACADO_INLINE_FUNCTION T & val()
Returns value.
int len_
Derivative array length.
SACADO_INLINE_FUNCTION VectorDynamicStorage & operator=(const VectorDynamicStorage &x)
Assignment.
bool owns_mem
Do we own the val/dx storage.
int stride_
Derivative array stride.
SACADO_INLINE_FUNCTION int size() const
Returns number of derivative components.
static SACADO_INLINE_FUNCTION void destroy_and_release(T *m, int sz)
Destroy array elements and release memory.
SACADO_INLINE_FUNCTION void zero()
Zero out derivative array.
SACADO_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
SACADO_INLINE_FUNCTION const U & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
SACADO_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
SACADO_INLINE_FUNCTION VectorDynamicStorage(const int sz, T *x, U *dx_p, const int stride, bool zero_out)
Constructor with supplied memory.
SACADO_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
static SACADO_INLINE_FUNCTION void copy(const T *src, T *dest, int sz)
Copy array from src to dest of length sz.
Derivative array storage class using dynamic memory allocation.
SACADO_INLINE_FUNCTION VectorDynamicStorage(const VectorDynamicStorage &x)
Copy constructor.
SACADO_INLINE_FUNCTION const T & val() const
Returns value.
Initialize the derivative array.
static SACADO_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 SACADO_INLINE_FUNCTION T * get(int sz)
Get memory for new array of length sz.
SACADO_INLINE_FUNCTION int length() const
Returns array length.
#define SACADO_INLINE_FUNCTION
static SACADO_INLINE_FUNCTION void strided_zero(T *dest, int stride, int sz)
Zero out array dest of length sz.
SACADO_INLINE_FUNCTION VectorDynamicStorage(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
static SACADO_INLINE_FUNCTION T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.