30 #ifndef SACADO_FAD_SIMPLEFAD_HPP
31 #define SACADO_FAD_SIMPLEFAD_HPP
51 template <
typename ValueT>
108 SimpleFad(
const int sz,
const int i,
const ValueT & x) :
118 for (
int i=0; i<this->
size(); i++)
130 if (x.
size() != this->
size())
return false;
131 bool eq = IE::eval(x.
val(), this->
val());
132 for (
int i=0; i<this->
size(); i++)
133 eq = eq && IE::eval(x.
dx(i), this->
dx(i));
138 template <
typename S>
140 GeneralFadType::operator=(v);
146 GeneralFadType::operator=(static_cast<const GeneralFadType&>(x));
151 template <
typename S>
154 GeneralFadType::operator+=(x);
159 template <
typename S>
162 GeneralFadType::operator-=(x);
167 template <
typename S>
170 GeneralFadType::operator*=(x);
175 template <
typename S>
178 GeneralFadType::operator/=(x);
185 GeneralFadType::operator+=(static_cast<const GeneralFadType&>(x));
192 GeneralFadType::operator-=(static_cast<const GeneralFadType&>(x));
199 GeneralFadType::operator*=(static_cast<const GeneralFadType&>(x));
206 GeneralFadType::operator/=(static_cast<const GeneralFadType&>(x));
219 #endif // SACADO_FAD_SIMPLEFAD_HPP
KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
SimpleFad(const SimpleFad &x, const ValueT &v, const ValueT &partial)
Tangent copy constructor.
ScalarType< value_type >::type scalar_type
Typename of scalar's (which may be different from T)
#define SACADO_ENABLE_VALUE_CTOR_DECL
KOKKOS_INLINE_FUNCTION const T & val() const
Returns value.
GeneralFadType::scalar_type scalar_type
Typename of scalar's (which may be different from value_type)
RemoveConst< T >::type value_type
Typename of values.
GeneralFad< ValueT, StorageType > GeneralFadType
ScalarType< ValueT >::type ScalarT
Typename of scalar's (which may be different from ValueT)
SimpleFad(const SimpleFad &x)
Copy constructor.
Forward-mode AD class using dynamic memory allocation but no expression templates.
SimpleFad()
Default constructor.
#define KOKKOS_INLINE_FUNCTION
SimpleFad(const int sz, const ValueT &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz and value x.
KOKKOS_INLINE_FUNCTION const U * dx() const
Returns derivative array.
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE)
Base template specification for testing equivalence.
Turn SimpleFad into a meta-function class usable with mpl::apply.
bool isEqualTo(const SimpleFad &x) const
Returns whether two Fad objects have the same values.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors...
GeneralFadType::value_type value_type
Typename of values.
KOKKOS_INLINE_FUNCTION DynamicStorage & operator=(const DynamicStorage &x)
Assignment.
Initialize the derivative array.
SimpleFad(const int sz, const int i, const ValueT &x)
Constructor with size sz, index i, and value x.
DynamicStorage< ValueT > StorageType
Base classes.
KOKKOS_INLINE_FUNCTION ValueT & fastAccessDx(int i)
Returns derivative component i without bounds checking.
SimpleFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with supplied value x convertible to ValueT.
Forward-mode AD class templated on the storage for the derivative array.