30 #ifndef SACADO_FAD_EXP_VIEWFAD_HPP
31 #define SACADO_FAD_EXP_VIEWFAD_HPP
36 #if defined(HAVE_SACADO_KOKKOSCORE)
37 #include "Kokkos_Atomic.hpp"
38 #include "impl/Kokkos_Error.hpp"
46 template <
typename T,
unsigned static_length,
unsigned static_str
ide,
typename U>
50 template <
typename T,
unsigned sl,
unsigned ss,
typename U>
58 using view_fad_type::view_fad_type;
69 #if defined(HAVE_SACADO_KOKKOSCORE)
71 template <
typename ValT,
unsigned sl,
unsigned ss,
typename U,
typename T>
73 void atomic_add(ViewFadPtr<ValT,sl,ss,U> dst,
const Expr<T>& xx) {
74 using Kokkos::atomic_add;
78 const int xsz = x.size();
79 const int sz = dst->size();
85 "Sacado error: Fad resize within atomic_add() not supported!");
87 if (xsz != sz && sz > 0 && xsz > 0)
89 "Sacado error: Fad assignment of incompatiable sizes!");
92 if (sz > 0 && xsz > 0) {
97 atomic_add(&(dst->
val()), x.val());
107 template<
class S,
unsigned length,
unsigned str
ide >
116 template<
class S,
unsigned length,
unsigned str
ide >
117 struct ViewFadType< const Fad::Exp::GeneralFad<S>, length, stride > {
122 template <
typename T,
unsigned static_length,
unsigned static_str
ide,
typename U>
123 struct BaseExprType< Fad::Exp::GeneralFad< Fad::Exp::ViewStorage<T,static_length,static_stride,U> > > {
132 template <
typename ValueT,
unsigned Size,
unsigned Str
ide,
typename Base>
141 template <
typename ValueT,
unsigned Size,
unsigned Str
ide,
typename Base>
148 #endif // SACADO_FAD_EXP_VIEWFAD_HPP
Wrapper for a generic expression template.
Base template specification for ScalarType.
#define SACADO_FAD_THREAD_SINGLE
KOKKOS_INLINE_FUNCTION view_fad_type * operator->()
#define KOKKOS_INLINE_FUNCTION
Forward-mode AD class templated on the storage for the derivative array.
#define SACADO_FAD_DERIV_LOOP(I, SZ)
Get the base Fad type from a view/expression.
ViewFad< T, sl, ss, U > view_fad_type
Fad::Exp::ViewFad< const typename S::value_type, length, stride, Fad::Exp::GeneralFad< S > > type
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
Fad::Exp::ViewFad< typename S::value_type, length, stride, Fad::Exp::GeneralFad< S > > type
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
Base template specification for ValueType.
ScalarType< ValueT >::type type
KOKKOS_INLINE_FUNCTION view_fad_type & operator*()
Get view type for any Fad type.