Debian Codegraph @

packages/stokhos/src/sacado/Sacado_ETPCE_OrthogPolyTraits.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef SACADO_ETPCE_ORTHOGPOLYTRAITS_HPP
11 #define SACADO_ETPCE_ORTHOGPOLYTRAITS_HPP
12
13 #include "Sacado_Traits.hpp"
14
15 // Forward declarations
16 namespace Sacado {
17 namespace ETPCE {
18 template <typename T, typename S> class OrthogPoly;
19 }
20 }
21
22 namespace Sacado {
23
24 //! Specialization of %Promote to OrthogPoly types
25 SACADO_AD_PROMOTE_SPEC2( ETPCE, OrthogPoly )
26
27 //! Specialization of %ScalarType to OrthogPoly types
28 template <typename T, typename S>
29 struct ScalarType< ETPCE::OrthogPoly<T,S> > {
30 typedef typename ScalarType<typename ETPCE::OrthogPoly<T,S>::value_type>::type type;
31 };
32
33 //! Specialization of %ValueType to OrthogPoly types
34 template <typename T, typename S>
35 struct ValueType< ETPCE::OrthogPoly<T,S> > {
36 typedef typename ETPCE::OrthogPoly<T,S>::value_type type;
37 };
38
39 //! Specialization of %IsADType to OrthogPoly types
40 template <typename T, typename S>
41 struct IsADType< ETPCE::OrthogPoly<T,S> > {
42 static const bool value = true;
43 };
44
45 //! Specialization of %IsADType to OrthogPoly types
46 template <typename T, typename S>
47 struct IsScalarType< ETPCE::OrthogPoly<T,S> > {
48 static const bool value = false;
49 };
50
51 //! Specialization of %Value to OrthogPoly types
52 template <typename T, typename S>
53 struct Value< ETPCE::OrthogPoly<T,S> > {
54 typedef typename ValueType< ETPCE::OrthogPoly<T,S> >::type value_type;
55 static const value_type& eval(const ETPCE::OrthogPoly<T,S>& x) {
56 return x.val(); }
57 };
58
59 //! Specialization of %ScalarValue to OrthogPoly types
60 template <typename T, typename S>
61 struct ScalarValue< ETPCE::OrthogPoly<T,S> > {
62 typedef typename ValueType< ETPCE::OrthogPoly<T,S> >::type value_type;
63 typedef typename ScalarType< ETPCE::OrthogPoly<T,S> >::type scalar_type;
64 static const scalar_type& eval(const ETPCE::OrthogPoly<T,S>& x) {
65 return ScalarValue<value_type>::eval(x.val()); }
66 };
67
68 //! Specialization of %StringName to OrthogPoly types
69 template <typename T, typename S>
70 struct StringName< ETPCE::OrthogPoly<T,S> > {
71 static std::string eval() {
72 return std::string("Sacado::ETPCE::OrthogPoly< ") +
73 StringName<T>::eval() + " >"; }
74 };
75
76 //! Specialization of %IsEqual to OrthogPoly types
77 template <typename T, typename S>
78 struct IsEqual< ETPCE::OrthogPoly<T,S> > {
79 static bool eval(const ETPCE::OrthogPoly<T,S>& x,
80 const ETPCE::OrthogPoly<T,S>& y) {
81 return x.isEqualTo(y);
82 }
83 };
84
85 //! Specialization of %IsStaticallySized to OrthogPoly types
86 template <typename T, typename S>
87 struct IsStaticallySized< ETPCE::OrthogPoly<T,S> > {
88 static const bool value = false;
89 };
90
91 } // namespace Sacado
92
93 // Define Teuchos traits classes
94 // Note Stokhos has required dependency on all Teuchos sub-packages
95 #include "Teuchos_PromotionTraits.hpp"
96 #include "Teuchos_ScalarTraits.hpp"
97 #include "Sacado_PCE_ScalarTraitsImp.hpp"
98 #include "Teuchos_SerializationTraits.hpp"
99
100 namespace Teuchos {
101
102 //! Specialization of %Teuchos::PromotionTraits to DFad types
103 template <typename T, typename S>
104 struct PromotionTraits< Sacado::ETPCE::OrthogPoly<T,S>,
105 Sacado::ETPCE::OrthogPoly<T,S> > {
106 typedef typename Sacado::Promote< Sacado::ETPCE::OrthogPoly<T,S>,
107 Sacado::ETPCE::OrthogPoly<T,S> >::type
108 promote;
109 };
110
111 //! Specialization of %Teuchos::PromotionTraits to DFad types
112 template <typename T, typename S, typename R>
113 struct PromotionTraits< Sacado::ETPCE::OrthogPoly<T,S>, R > {
114 typedef typename Sacado::Promote< Sacado::ETPCE::OrthogPoly<T,S>, R >::type
115 promote;
116 };
117
118 //! Specialization of %Teuchos::PromotionTraits to DFad types
119 template <typename L, typename T, typename S>
120 struct PromotionTraits< L, Sacado::ETPCE::OrthogPoly<T,S> > {
121 public:
122 typedef typename Sacado::Promote< L, Sacado::ETPCE::OrthogPoly<T,S> >::type
123 promote;
124 };
125
126 //! Specializtion of %Teuchos::ScalarTraits
127 template <typename T, typename S>
128 struct ScalarTraits< Sacado::ETPCE::OrthogPoly<T,S> > :
129 public Sacado::PCE::ScalarTraitsImp< Sacado::ETPCE::OrthogPoly<T,S> > {};
130
131 //! Specialization of %Teuchos::SerializationTraits
132 template <typename Ordinal, typename T, typename S>
133 struct SerializationTraits<Ordinal, Sacado::ETPCE::OrthogPoly<T,S> > :
134 public Sacado::PCE::SerializationTraitsImp< Ordinal,
135 Sacado::ETPCE::OrthogPoly<T,S> >
136 {};
137
138 //! Specialization of %Teuchos::ValueTypeSerializer
139 template <typename Ordinal, typename T, typename S>
140 struct ValueTypeSerializer<Ordinal, Sacado::ETPCE::OrthogPoly<T,S> > :
141 public Sacado::PCE::SerializerImp< Ordinal,
142 Sacado::ETPCE::OrthogPoly<T,S>,
143 ValueTypeSerializer<Ordinal,T> >
144 {
145 typedef Sacado::ETPCE::OrthogPoly<T,S> PCEType;
146 typedef ValueTypeSerializer<Ordinal,T> ValueSerializer;
147 typedef Sacado::PCE::SerializerImp< Ordinal,PCEType,ValueSerializer> Base;
148 typedef typename Base::expansion_type expansion_type;
149 ValueTypeSerializer(const Teuchos::RCP<expansion_type>& expansion,
150 const Teuchos::RCP<const ValueSerializer>& vs) :
151 Base(expansion,vs) {}
152 };
153 }
154
155 #endif // SACADO_ETPCE_ORTHOGPOLYTRAITS_HPP