42 #ifndef SACADO_MP_VECTOR_TRAITS_HPP
43 #define SACADO_MP_VECTOR_TRAITS_HPP
45 #include "Sacado_Traits.hpp"
46 #include "Sacado_mpl_apply.hpp"
57 template <
typename S>
class Vector;
64 SACADO_AD_PROMOTE_SPEC( MP, Vector )
68 struct ScalarType< MP::Vector<S> > {
74 struct ValueType< MP::Vector<S> > {
80 struct IsADType< MP::Vector<S> > {
81 static const bool value =
true;
86 struct IsScalarType< MP::Vector<S> > {
87 static const bool value = S::is_static;
92 struct Value< MP::Vector<S> > {
93 typedef typename ValueType< MP::Vector<S> >::type
value_type;
94 KOKKOS_INLINE_FUNCTION
100 template <
typename S>
101 struct ScalarValue< MP::Vector<S> > {
102 typedef typename ValueType< MP::Vector<S> >::type
value_type;
104 KOKKOS_INLINE_FUNCTION
106 return ScalarValue<value_type>::eval(x.val()); }
110 template <
typename S>
111 struct StringName< MP::Vector<S> > {
113 return std::string(
"Sacado::MP::Vector< ") +
114 StringName<S>::eval() +
" >"; }
118 template <
typename S>
119 struct IsEqual< MP::Vector<S> > {
120 KOKKOS_INLINE_FUNCTION
123 return x.isEqualTo(y);
128 template <
typename S>
129 struct IsStaticallySized< MP::Vector<S> > {
130 static const bool value = S::is_static;
134 template <
typename S>
135 struct StaticSize< MP::Vector<S> > {
136 static const unsigned value = S::static_size;
153 template <
typename S>
156 typedef typename Sacado::Promote< Sacado::MP::Vector<S>,
162 template <
typename S,
typename R>
164 typedef typename Sacado::Promote< Sacado::MP::Vector<S>, R >::type
169 template <
typename L,
typename S>
172 typedef typename Sacado::Promote< L, Sacado::MP::Vector<S> >::type
177 #if defined(HAVE_STOKHOS_ENSEMBLE_REDUCT)
178 template <
typename S>
182 template <
typename S>
188 template <
typename Ordinal,
typename S>
191 Sacado::MP::Vector<S>,
195 template <
typename Ordinal,
typename S>
198 Sacado::MP::Vector<S>,
199 ValueTypeSerializer<Ordinal,typename Sacado::MP::Vector<S>::value_type> >
211 template<
class TypeTo,
class StorageFrom>
219 return Teuchos::as<TypeTo>(t.coeff(0));
229 return Teuchos::as<TypeTo>(t.coeff(0));
233 template<
class TypeTo,
class ExprFrom>
241 return Teuchos::as<TypeTo>(t.derived().coeff(0));
251 return Teuchos::as<TypeTo>(t.derived().coeff(0));
261 #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.