30 #ifndef SACADO_FAD_EXP_VECTORDYNAMICSTORAGE_HPP
31 #define SACADO_FAD_EXP_VECTORDYNAMICSTORAGE_HPP
33 #include <type_traits>
44 template <
typename T,
typename U = T>
54 template <
typename TT,
typename UU = TT>
125 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
127 throw "Can\'t resize beyond original size when memory isn't owned!";
158 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
160 throw "Can\'t resize beyond original size when memory isn't owned!";
178 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
180 throw "Can\'t resize beyond original size when memory isn't owned!";
200 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
202 throw "Can\'t resize beyond original size when memory isn't owned!";
296 #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.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const int sz, const T &x, const DerivInit zero_out)
Constructor with size sz.
KOKKOS_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size 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 U dx(int i) const
Returns derivative component i with bounds checking.
VectorDynamicStorage< T, U > type
Turn DynamicStorage into a meta-function class usable with mpl::apply.
static KOKKOS_INLINE_FUNCTION void strided_zero(T *dest, int stride, int sz)
Zero out array dest of length sz.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const int sz, T *x, U *dx_p, const int stride, bool zero_out)
Constructor with supplied memory.
int stride_
Derivative array stride.
Replace static derivative length.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const VectorDynamicStorage &x)
Copy constructor.
static constexpr int static_size
static constexpr bool is_statically_sized
VectorDynamicStorage< TT, UU > type
KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
static KOKKOS_INLINE_FUNCTION void destroy_and_release(T *m, int sz)
Destroy array elements and release memory.
KOKKOS_INLINE_FUNCTION int length() const
Returns array length.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage()
Default constructor.
#define KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
KOKKOS_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
int len_
Derivative array length.
static KOKKOS_INLINE_FUNCTION T * get_and_fill(int sz)
Get memory for new array of length sz and fill with zeros.
KOKKOS_INLINE_FUNCTION void zero()
Zero out derivative array.
KOKKOS_INLINE_FUNCTION const U & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
std::remove_cv< T >::type value_type
KOKKOS_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION T & val()
Returns value.
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.
KOKKOS_INLINE_FUNCTION U & 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...
KOKKOS_INLINE_FUNCTION ~VectorDynamicStorage()
Destructor.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage(const T &x)
Constructor with value.
Initialize the derivative array.
KOKKOS_INLINE_FUNCTION void setMemory(int sz, T *x, U *dx_p, int stride)
Set value/derivative array memory.
Derivative array storage class using dynamic memory allocation.
bool owns_mem
Do we own the val/dx storage.
KOKKOS_INLINE_FUNCTION const U * dx() const
Returns derivative array.
KOKKOS_INLINE_FUNCTION VectorDynamicStorage & operator=(const VectorDynamicStorage &x)
Assignment.
int sz_
Derivative array size.