30#if defined(HAVE_SACADO_KOKKOSCORE)
31#include "Kokkos_Atomic.hpp"
32#include "impl/Kokkos_Error.hpp"
49 template <
typename ValueT>
51 public Expr< GeneralFad<ValueT,Fad::DynamicStorage<ValueT> > > {
118 DFad(
const int sz,
const int i,
const ValueT &
x) :
127 template <
typename S>
139 template <
typename S>
142 GeneralFadType::operator=(v);
154 template <
typename S>
158 GeneralFadType::operator=(
x);
163 template <
typename S>
166 GeneralFadType::operator+=(
x);
171 template <
typename S>
174 GeneralFadType::operator-=(
x);
179 template <
typename S>
182 GeneralFadType::operator*=(
x);
187 template <
typename S>
190 GeneralFadType::operator/=(
x);
223 template <
typename S>
226 GeneralFadType::operator+=(
x);
231 template <
typename S>
234 GeneralFadType::operator-=(
x);
239 template <
typename S>
242 GeneralFadType::operator*=(
x);
247 template <
typename S>
250 GeneralFadType::operator/=(
x);
256 template <
typename T>
257 struct BaseExpr< GeneralFad<
T,Fad::DynamicStorage<T> > > {
261 template <
typename T>
264 ExprLevel< typename DFad<T>::value_type >
::value + 1;
267 template <
typename T>
274 template <
typename T>
279 template <
typename T>
284 template <
typename T>
289 template <
typename,
unsigned,
unsigned>
struct ViewFadType;
291 template <
typename,
unsigned,
unsigned,
typename>
class ViewFad;
295 template<
class ValueType,
unsigned length,
unsigned str
ide >
304 template<
class ValueType,
unsigned length,
unsigned str
ide >
311#if defined(HAVE_SACADO_KOKKOSCORE)
320 template <
typename T>
322 void atomic_add(DFad<T>* dst,
const DFad<T>&
x) {
323 using Kokkos::atomic_add;
325 const int xsz =
x.size();
326 const int sz = dst->size();
332 "Sacado error: Fad resize within atomic_add() not supported!");
334 if (xsz != sz && sz > 0 && xsz > 0)
336 "Sacado error: Fad assignment of incompatiable sizes!");
339 if (sz > 0 && xsz > 0) {
341 atomic_add(&(dst->fastAccessDx(
i)),
x.fastAccessDx(
i));
344 atomic_add(&(dst->val()),
x.val());
#define SACADO_INLINE_FUNCTION
#define SACADO_FAD_THREAD_SINGLE
#define SACADO_FAD_DERIV_LOOP(I, SZ)
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE)
#define SACADO_ENABLE_VALUE_CTOR_DECL
#define SACADO_ENABLE_EXPR_FUNC(RETURN_TYPE)
#define SACADO_ENABLE_EXPR_CTOR_DECL
Forward-mode AD class using dynamic memory allocation and expression templates.
ExprType::scalar_type scalar_type
Typename of scalar's (which may be different from value_type)
ExprType::value_type value_type
Typename of values.
GeneralFad< ValueT, StorageType > GeneralFadType
ScalarType< ValueT >::type ScalarT
Typename of scalar's (which may be different from ValueT)
SACADO_INLINE_FUNCTION DFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with supplied value x convertible to ValueT.
SACADO_INLINE_FUNCTION ~DFad()
Destructor.
Expr< GeneralFadType > ExprType
SACADO_INLINE_FUNCTION DFad(const int sz, const int i, const ValueT &x)
Constructor with size sz, index i, and value x.
SACADO_INLINE_FUNCTION DFad(const Expr< S > &x, SACADO_ENABLE_EXPR_CTOR_DECL)
Copy constructor from any Expression object.
SACADO_INLINE_FUNCTION DFad()
Default constructor.
SACADO_INLINE_FUNCTION DFad(const DFad &x)
Copy constructor.
Fad::DynamicStorage< ValueT > StorageType
Base classes.
SACADO_INLINE_FUNCTION DFad(const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz and value x.
Forward-mode AD class using dynamic memory allocation and expression templates.
Derivative array storage class using dynamic memory allocation.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors.
@ InitDerivArray
Initialize the derivative array.
FAD_NS::DFad< T >::base_expr_type type
Get the base Fad type from a view/expression.
DFad< typename GeneralFad< T, Fad::DynamicStorage< T > >::value_type > type
Replace static derivative length.
Turn DFad into a meta-function class usable with mpl::apply.
Base template specification for whether a type is a Fad type.
Sacado::FAD_NS::ViewFad< ValueType, length, stride, Sacado::FAD_NS::DFad< ValueType > > type
Sacado::FAD_NS::ViewFad< const ValueType, length, stride, Sacado::FAD_NS::DFad< ValueType > > type
Get view type for any Fad type.