30#if defined(HAVE_SACADO_KOKKOSCORE)
31#include "Kokkos_Atomic.hpp"
32#include "impl/Kokkos_Error.hpp"
40 template <
typename T,
int Num>
56 template <
typename ValueT,
int Num>
58 public Expr< GeneralFad<ValueT,Fad::StaticStorage<ValueT,Num> > > {
108 template <
typename S>
128 SLFad(
const int sz,
const int i,
const ValueT &
x) :
137 template <
typename S>
149 template <
typename S>
152 GeneralFadType::operator=(v);
164 template <
typename S>
168 GeneralFadType::operator=(
x);
173 template <
typename S>
176 GeneralFadType::operator+=(
x);
181 template <
typename S>
184 GeneralFadType::operator-=(
x);
189 template <
typename S>
192 GeneralFadType::operator*=(
x);
197 template <
typename S>
200 GeneralFadType::operator/=(
x);
233 template <
typename S>
236 GeneralFadType::operator+=(
x);
242 template <
typename S>
245 GeneralFadType::operator-=(
x);
250 template <
typename S>
253 GeneralFadType::operator*=(
x);
258 template <
typename S>
261 GeneralFadType::operator/=(
x);
267 template <
typename T,
int N>
272 template <
typename T,
int N>
275 ExprLevel< typename SLFad<T,N>::value_type >
::value + 1;
278 template <
typename T,
int N>
285 template <
typename T,
int N>
290 template <
typename T,
int N>
295 template <
typename T,
int N>
300 template <
typename T,
unsigned,
unsigned>
struct ViewFadType;
302 template <
typename,
unsigned,
unsigned,
typename>
class ViewFad;
306 template<
class ValueType,
int N,
unsigned length,
unsigned str
ide >
315 template<
class ValueType,
int N,
unsigned length,
unsigned str
ide >
322#if defined(HAVE_SACADO_KOKKOSCORE)
331 template <
typename T,
int N>
333 void atomic_add(SLFad<T,N>* dst,
const SLFad<T,N>&
x) {
334 using Kokkos::atomic_add;
336 const int xsz =
x.size();
337 const int sz = dst->size();
343 "Sacado error: Fad resize within atomic_add() not supported!");
345 if (xsz != sz && sz > 0 && xsz > 0)
347 "Sacado error: Fad assignment of incompatiable sizes!");
350 if (sz > 0 && xsz > 0) {
352 atomic_add(&(dst->fastAccessDx(
i)),
x.fastAccessDx(
i));
355 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 static memory allocation with long arrays and expression templates.
SACADO_INLINE_FUNCTION SLFad(const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz and value x.
SACADO_INLINE_FUNCTION SLFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with supplied value x convertible to ValueT.
SACADO_INLINE_FUNCTION SLFad(const SLFad &x)
Copy constructor.
Fad::StaticStorage< ValueT, Num > StorageType
Base classes.
SACADO_INLINE_FUNCTION ~SLFad()
Destructor.
SACADO_INLINE_FUNCTION SLFad(const Expr< S > &x, SACADO_ENABLE_EXPR_CTOR_DECL)
Copy constructor from any Expression object.
GeneralFad< ValueT, StorageType > GeneralFadType
ExprType::value_type value_type
Typename of values.
Expr< GeneralFadType > ExprType
SACADO_INLINE_FUNCTION SLFad(const int sz, const int i, const ValueT &x)
Constructor with size sz, index i, and value x.
ScalarType< ValueT >::type ScalarT
Typename of scalar's (which may be different from ValueT)
ExprType::scalar_type scalar_type
Typename of scalar's (which may be different from value_type)
SACADO_INLINE_FUNCTION SLFad()
Default constructor.
Forward-mode AD class using dynamic memory allocation and expression templates.
Derivative array storage class using static 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::SLFad< T, N >::base_expr_type type
Get the base Fad type from a view/expression.
SLFad< typename GeneralFad< T, Fad::StaticStorage< T, N > >::value_type, N > type
Replace static derivative length.
SLFad< ValueT, Num > type
Turn SLFad 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::SLFad< ValueType, N > > type
Sacado::FAD_NS::ViewFad< const ValueType, length, stride, Sacado::FAD_NS::SLFad< ValueType, N > > type
Get view type for any Fad type.