10 #ifndef SACADO_MP_VECTOR_TRAITS_HPP
11 #define SACADO_MP_VECTOR_TRAITS_HPP
13 #include "Sacado_Traits.hpp"
14 #include "Sacado_mpl_apply.hpp"
25 template <
typename S>
class Vector;
32 SACADO_AD_PROMOTE_SPEC( MP, Vector )
36 struct ScalarType< MP::Vector<S> > {
42 struct ValueType< MP::Vector<S> > {
48 struct IsADType< MP::Vector<S> > {
49 static const bool value =
true;
54 struct IsScalarType< MP::Vector<S> > {
55 static const bool value = S::is_static;
60 struct Value< MP::Vector<S> > {
61 typedef typename ValueType< MP::Vector<S> >::type
value_type;
62 KOKKOS_INLINE_FUNCTION
69 struct ScalarValue< MP::Vector<S> > {
70 typedef typename ValueType< MP::Vector<S> >::type
value_type;
71 typedef typename ScalarType< MP::Vector<S> >::type
scalar_type;
72 KOKKOS_INLINE_FUNCTION
74 return ScalarValue<value_type>::eval(x.val()); }
79 struct StringName< MP::Vector<S> > {
80 static std::string
eval() {
81 return std::string(
"Sacado::MP::Vector< ") +
82 StringName<S>::eval() +
" >"; }
87 struct IsEqual< MP::Vector<S> > {
88 KOKKOS_INLINE_FUNCTION
91 return x.isEqualTo(y);
97 struct IsStaticallySized< MP::Vector<S> > {
98 static const bool value = S::is_static;
102 template <
typename S>
103 struct StaticSize< MP::Vector<S> > {
104 static const unsigned value = S::static_size;
121 template <
typename S>
124 typedef typename Sacado::Promote< Sacado::MP::Vector<S>,
130 template <
typename S,
typename R>
132 typedef typename Sacado::Promote< Sacado::MP::Vector<S>, R >::type
137 template <
typename L,
typename S>
140 typedef typename Sacado::Promote< L, Sacado::MP::Vector<S> >::type
145 #if defined(HAVE_STOKHOS_ENSEMBLE_REDUCT)
146 template <
typename S>
150 template <
typename S>
156 template <
typename Ordinal,
typename S>
159 Sacado::MP::Vector<S>,
163 template <
typename Ordinal,
typename S>
166 Sacado::MP::Vector<S>,
167 ValueTypeSerializer<Ordinal,typename Sacado::MP::Vector<S>::value_type> >
179 template<
class TypeTo,
class StorageFrom>
187 return Teuchos::as<TypeTo>(t.coeff(0));
197 return Teuchos::as<TypeTo>(t.coeff(0));
201 template<
class TypeTo,
class ExprFrom>
209 return Teuchos::as<TypeTo>(t.derived().coeff(0));
219 return Teuchos::as<TypeTo>(t.derived().coeff(0));
229 #endif // SACADO_MP_VECTORTRAITS_HPP
static KOKKOS_INLINE_FUNCTION const scalar_type & eval(const MP::Vector< S > &x)
Sacado::MP::Vector< S > VecType
static std::string eval()
static TypeTo convert(const TypeFrom &t)
Convert t from a TypeFrom object to a TypeTo object.
static KOKKOS_INLINE_FUNCTION const value_type & eval(const MP::Vector< S > &x)
MP::Vector< S >::value_type type
VecType::value_type value_type
ValueType< MP::Vector< S > >::type value_type
Sacado::MP::Vector< StorageFrom > TypeFrom
ScalarType< typename MP::Vector< S >::value_type >::type type
static TypeTo safeConvert(const TypeFrom &t)
Convert t from a TypeFrom object to a TypeTo object, with checks for validity.
Sacado::MP::Expr< ExprFrom > TypeFrom
ScalarType< MP::Vector< S > >::type scalar_type
static TypeTo convert(const TypeFrom &t)
Convert t from a TypeFrom object to a TypeTo object.
ValueTypeSerializer(const Teuchos::RCP< const ValueSerializer > &vs, Ordinal sz=0)
Implementation of Teuchos::SerializationTraits for all Vector types.
static KOKKOS_INLINE_FUNCTION bool eval(const MP::Vector< S > &x, const MP::Vector< S > &y)
ValueTypeSerializer< Ordinal, value_type > ValueSerializer
An indirect serialization object for all Vector types.
ValueType< MP::Vector< S > >::type value_type
Sacado::MP::SerializerImp< Ordinal, VecType, ValueSerializer > Base
static TypeTo safeConvert(const TypeFrom &t)
Convert t from a TypeFrom object to a TypeTo object, with checks for validity.