10 #ifndef SACADO_FAD_EXP_VIEWSTORAGE_HPP
11 #define SACADO_FAD_EXP_VIEWSTORAGE_HPP
13 #include <type_traits>
26 #ifndef SACADO_FAD_DERIV_LOOP
27 #if defined(SACADO_VIEW_CUDA_HIERARCHICAL_DFAD) && !defined(SACADO_DISABLE_CUDA_IN_KOKKOS) && ( defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__) )
28 #define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=threadIdx.x; I<SZ; I+=blockDim.x)
30 #define SACADO_FAD_DERIV_LOOP(I,SZ) for (int I=0; I<SZ; ++I)
35 template <
typename T,
unsigned sl,
unsigned ss,
typename U>
43 template <
typename T,
unsigned static_length,
unsigned static_str
ide,
typename U>
60 template <
typename TT>
81 ViewStorage(
T* v,
const int arg_size = 0,
const int arg_stride = 0) :
87 const int arg_stride = 0) :
97 template <
typename TT>
118 if (
this != reinterpret_cast<ViewStorage*>(
120 reinterpret_cast<const volatile char&>(x)))) {
215 template <
typename,
unsigned,
unsigned,
typename>
237 #endif // SACADO_FAD_EXP_VIEWSTORAGE_HPP
const mpl::integral_nonzero_constant< int, static_length > sz_
Derivative array size.
Turn ViewStorage into a meta-function class usable with mpl::apply.
SACADO_INLINE_FUNCTION const T & val() const
Returns value.
mpl::apply< U, base_expr_TT >::type UU
static constexpr bool is_statically_sized
BaseExprType< non_const_TT >::type base_expr_TT
SACADO_INLINE_FUNCTION ViewStorage & operator=(const ViewStorage &x)
Assignment.
SACADO_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
SACADO_INLINE_FUNCTION ViewFadPtr< T, static_length, static_stride, U > operator&() const
Overload of addressof operator.
static constexpr bool is_view
SACADO_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
std::remove_cv< TT >::type non_const_TT
SACADO_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
std::remove_cv< T >::type value_type
Derivative array storage class that is a view into a contiguous memory allocation. It does not provide proper value semantics and thus should not be used in a general-purpose scalar type.
SACADO_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
F::template apply< A1, A2, A3, A4, A5 >::type type
SACADO_INLINE_FUNCTION const T * dx() const
Returns derivative array.
SACADO_INLINE_FUNCTION constexpr int length() const
Returns array length.
SACADO_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
SACADO_INLINE_FUNCTION T & val()
Returns value.
static constexpr int static_size
Replace static derivative length.
SACADO_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.
#define SACADO_FAD_DERIV_LOOP(I, SZ)
static constexpr bool stride_one
SACADO_INLINE_FUNCTION void zero()
Zero out derivative array.
ViewStorage< T, static_length, static_stride, U > type
SACADO_INLINE_FUNCTION ViewStorage(T *arg_dx, T *arg_val, const int arg_size=0, const int arg_stride=0)
Constructor.
SACADO_INLINE_FUNCTION ViewStorage()
Default constructor (needed to satisfy interface)
SACADO_INLINE_FUNCTION ViewStorage(const ViewStorage< TT, static_length, static_stride, U > &x, typename std::enable_if< std::is_same< TT, T >::value||std::is_same< const TT, T >::value >::type *=0)
Copy constructor.
SACADO_INLINE_FUNCTION ~ViewStorage()
Destructor.
#define SACADO_INLINE_FUNCTION
ViewStorage< TT, static_length, static_stride, UU > type
SACADO_INLINE_FUNCTION ViewStorage(T *v, const int arg_size=0, const int arg_stride=0)
Constructor.
static SACADO_INLINE_FUNCTION void strided_zero(T *dest, int stride, int sz)
Zero out array dest of length sz.
const mpl::integral_nonzero_constant< int, static_stride > stride_
Derivative array stride.
SACADO_INLINE_FUNCTION constexpr int size() const
Returns number of derivative components.