10 #ifndef SACADO_FAD_EXP_GENERALFAD_HPP
11 #define SACADO_FAD_EXP_GENERALFAD_HPP
29 template <
typename Storage>
31 public Expr< GeneralFad<Storage> >,
46 using typename StorageType::value_type;
52 static constexpr
bool is_view = Storage::is_view;
74 using ExtenderType::ExtenderType;
115 void diff(
const int ith,
const int n) {
116 if (this->size() != n)
142 template <
typename S>
146 const expr_type&
x = xx.derived();
149 if (x.size() != this->size())
return false;
150 bool eq = IE::eval(x.val(), this->
val());
151 const int sz = this->size();
153 eq = eq && IE::eval(x.dx(
i), this->
dx(
i));
178 if (is_const && this->size()!=0)
190 template <
typename S>
194 if (this->size()) this->resize(0);
209 template <
typename S>
224 template <
typename S>
232 template <
typename S>
240 template <
typename S>
243 const int sz = this->size();
251 template <typename S>
254 const int sz = this->size();
290 template <
typename S>
298 template <
typename S>
306 template <
typename S>
314 template <
typename S>
325 template <
typename S>
331 template <
typename S>
339 template <
typename S>
340 struct IsView< Fad::Exp::GeneralFad<S> > {
344 template <
typename S>
345 struct IsFad< Fad::Exp::GeneralFad<S> > {
349 template <
typename S>
350 struct IsExpr< Fad::Exp::GeneralFad<S> > {
354 template <
typename S>
363 #endif // SACADO_FAD_EXP_GENERALFAD_HPP
Wrapper for a generic expression template.
static SACADO_INLINE_FUNCTION void assign_divide_equal(DstType &dst, const SrcType &x)
Implementation of dst /= x.
Fad::Exp::GeneralFad< S > type
SACADO_INLINE_FUNCTION void setUpdateValue(bool update_val)
Set whether this Fad object should update values.
static SACADO_INLINE_FUNCTION void assign_times_equal(DstType &dst, const SrcType &x)
Implementation of dst *= x.
SACADO_INLINE_FUNCTION GeneralFad(const Expr< S > &x, SACADO_EXP_ENABLE_EXPR_CTOR_DECL)
Copy constructor from any Expression object (disabled for ViewFad)
Base template specification for whether a type is a Fad type.
#define SACADO_DEFAULTED_FUNCTION
SACADO_INLINE_FUNCTION SACADO_EXP_ENABLE_EXPR_FUNC(bool) isEqualTo(const Expr< S > &xx) const
Returns whether two Fad objects have the same values.
SACADO_INLINE_FUNCTION GeneralFad(const S &x, SACADO_EXP_ENABLE_VALUE_CTOR_DECL)
Constructor with value (disabled for ViewFad)
static SACADO_INLINE_FUNCTION void assign_equal(DstType &dst, const SrcType &x)
Implementation of dst = x.
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.
Replace static derivative length.
SACADO_INLINE_FUNCTION void cache() const
Cache values.
SACADO_INLINE_FUNCTION bool hasFastAccess() const
Returns true if derivative array is not empty.
Storage::template apply_N< N >::type S
SACADO_INLINE_FUNCTION const derived_type & derived() const
Return derived object.
SACADO_INLINE_FUNCTION void diff(const int ith, const int n)
Set GeneralFad object as the ith independent variable.
Determine whether a given type is a view.
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)
Get the base Fad type from a view/expression.
Extender< Storage > ExtenderType
Extender type.
Storage StorageType
Storage type.
#define SACADO_EXP_ENABLE_VALUE_CTOR_DECL
T derived_type
Typename of derived object, returned by derived()
SACADO_INLINE_FUNCTION void setIsConstant(bool is_const)
Set whether variable is constant.
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)
static constexpr bool is_view
Whether we are a view.
Meta-function for determining nesting with an expression.
Expr< GeneralFad< Storage > > ExprType
Expression type.
SACADO_INLINE_FUNCTION SACADO_ENABLE_VALUE_FUNC(GeneralFad &) operator
Assignment operator with constant right-hand-side.
expr expr expr fastAccessDx(i)) FAD_UNARYOP_MACRO(exp
SACADO_DEFAULTED_FUNCTION GeneralFad()=default
Default constructor.
static SACADO_INLINE_FUNCTION void assign_minus_equal(DstType &dst, const SrcType &x)
Implementation of dst -= x.
SACADO_DEFAULTED_FUNCTION ~GeneralFad()=default
Destructor.
SACADO_INLINE_FUNCTION bool updateValue() const
Return whether this Fad object has an updated value.
#define SACADO_INLINE_FUNCTION
SACADO_DEFAULTED_FUNCTION GeneralFad & operator=(GeneralFad &&x)=default
Move assignment with GeneralFad right-hand-side.
SACADO_INLINE_FUNCTION int availableSize() const
Returns number of derivative components that can be stored without reallocation.
static SACADO_INLINE_FUNCTION void assign_plus_equal(DstType &dst, const SrcType &x)
Implementation of dst += x.
Forward-mode AD class templated on the storage for the derivative array.
Extension class for extending interface of its argument.