30 #ifndef SACADO_FAD_EXP_GENERALFAD_HPP
31 #define SACADO_FAD_EXP_GENERALFAD_HPP
50 template <
typename Storage>
53 public Expr< GeneralFad<Storage> >,
68 using typename StorageType::value_type;
117 GeneralFad(
const int sz,
const int i,
const value_type & x) :
130 template <
typename S>
140 using ExtenderType::ExtenderType;
153 void diff(
const int ith,
const int n) {
154 if (this->size() != n)
162 template <
typename S>
166 const expr_type& x = xx.derived();
169 if (x.size() != this->size())
return false;
170 bool eq = IE::eval(x.val(), this->
val());
171 const int sz = this->size();
173 eq = eq && IE::eval(x.dx(i), this->
dx(i));
198 if (is_const && this->size()!=0)
210 template <
typename S>
214 if (this->size()) this->resize(0);
223 template <
typename S>
238 template <
typename S>
246 template <
typename S>
254 template <
typename S>
257 const int sz = this->size();
265 template <typename S>
268 const int sz = this->size();
304 template <
typename S>
312 template <
typename S>
320 template <
typename S>
328 template <
typename S>
339 template <
typename S>
341 static constexpr
unsigned value =
345 template <
typename S>
347 static constexpr
bool value =
true;
353 template <
typename S>
354 struct IsFad< Fad::Exp::GeneralFad<S> > {
355 static constexpr
bool value =
true;
358 template <
typename S>
359 struct IsExpr< Fad::Exp::GeneralFad<S> > {
360 static constexpr
bool value =
true;
363 template <
typename S>
372 #endif // SACADO_FAD_EXP_GENERALFAD_HPP
Wrapper for a generic expression template.
KOKKOS_INLINE_FUNCTION SACADO_ENABLE_VALUE_FUNC(GeneralFad &) operator
Assignment operator with constant right-hand-side.
Fad::Exp::GeneralFad< S > type
static KOKKOS_INLINE_FUNCTION void assign_times_equal(DstType &dst, const SrcType &x)
Implementation of dst *= x.
#define SACADO_ENABLE_VALUE_CTOR_DECL
Base template specification for whether a type is a Fad type.
KOKKOS_INLINE_FUNCTION GeneralFad(const Expr< S > &x, SACADO_EXP_ENABLE_EXPR_CTOR_DECL)
Copy constructor from any Expression object.
KOKKOS_INLINE_FUNCTION GeneralFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with value.
KOKKOS_INLINE_FUNCTION const derived_type & derived() const
Return derived object.
Turn GeneralFad into a meta-function class usable with mpl::apply.
#define SACADO_EXP_ENABLE_EXPR_CTOR_DECL
Determine whether a given type is an expression.
Wrapper for a generic expression template.
static KOKKOS_INLINE_FUNCTION void assign_equal(DstType &dst, const SrcType &x)
Implementation of dst = x.
~GeneralFad()=default
Destructor.
Replace static derivative length.
KOKKOS_INLINE_FUNCTION GeneralFad(const int sz, const value_type &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz.
#define KOKKOS_INLINE_FUNCTION
static KOKKOS_INLINE_FUNCTION void assign_divide_equal(DstType &dst, const SrcType &x)
Implementation of dst /= x.
static KOKKOS_INLINE_FUNCTION void assign_plus_equal(DstType &dst, const SrcType &x)
Implementation of dst += x.
GeneralFad()=default
Default constructor.
Storage::template apply_N< N >::type S
KOKKOS_INLINE_FUNCTION GeneralFad(const int sz, const int i, const value_type &x)
Constructor with size sz, index i, and value x.
Base template specification for testing equivalence.
Forward-mode AD class templated on the storage for the derivative array.
#define SACADO_FAD_DERIV_LOOP(I, SZ)
KOKKOS_INLINE_FUNCTION bool hasFastAccess() const
Returns true if derivative array is not empty.
Get the base Fad type from a view/expression.
Extender< Storage > ExtenderType
Extender type.
Storage StorageType
Storage type.
T derived_type
Typename of derived object, returned by derived()
Do not initialize the derivative array.
Storage::template apply< T >::type S
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from T)
Meta-function for determining nesting with an expression.
KOKKOS_INLINE_FUNCTION int availableSize() const
Returns number of derivative components that can be stored without reallocation.
Expr< GeneralFad< Storage > > ExprType
Expression type.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
static KOKKOS_INLINE_FUNCTION void assign_minus_equal(DstType &dst, const SrcType &x)
Implementation of dst -= x.
KOKKOS_INLINE_FUNCTION void diff(const int ith, const int n)
Set GeneralFad object as the ith independent variable.
KOKKOS_INLINE_FUNCTION SACADO_EXP_ENABLE_EXPR_FUNC(bool) isEqualTo(const Expr< S > &xx) const
Returns whether two Fad objects have the same values.
KOKKOS_INLINE_FUNCTION void setIsConstant(bool is_const)
Set whether variable is constant.
Initialize the derivative array.
Forward-mode AD class templated on the storage for the derivative array.
KOKKOS_INLINE_FUNCTION GeneralFad(const Storage &s)
Constructor with supplied storage s.
Extension class for extending interface of its argument.