Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_ELRFad_SLFadTraits.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Sacado Package
5// Copyright (2006) Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25// (etphipp@sandia.gov).
26//
27// ***********************************************************************
28// @HEADER
29
30#ifndef SACADO_ELRFAD_SLFADTRAITS_HPP
31#define SACADO_ELRFAD_SLFADTRAITS_HPP
32
33#include "Sacado_Traits.hpp"
34#include <sstream>
35
36// Forward declarations
37namespace Sacado {
38 namespace ELRFad {
39 template <typename T, int Num> class SLFad;
40 }
41}
42
43namespace Sacado {
44
47
48
49 template <typename ValueT, int Num>
50 struct ScalarType< ELRFad::SLFad<ValueT,Num> > {
52 };
53
55 template <typename ValueT, int Num>
56 struct ValueType< ELRFad::SLFad<ValueT,Num> > {
57 typedef ValueT type;
58 };
59
61 template <typename ValueT, int Num>
62 struct IsADType< ELRFad::SLFad<ValueT,Num> > {
63 static const bool value = true;
64 };
65
67 template <typename ValueT, int Num>
68 struct IsScalarType< ELRFad::SLFad<ValueT,Num> > {
69 static const bool value = false;
70 };
71
73 template <typename ValueT, int Num>
74 struct Value< ELRFad::SLFad<ValueT,Num> > {
77 static const value_type& eval(const ELRFad::SLFad<ValueT,Num>& x) {
78 return x.val(); }
79 };
80
82 template <typename ValueT, int Num>
90
92 template <typename ValueT, int Num>
93 struct StringName< ELRFad::SLFad<ValueT,Num> > {
94 static std::string eval() {
95 std::stringstream ss;
96 ss << "Sacado::ELRFad::SLFad< "
97 << StringName<ValueT>::eval() << ", " << Num << " >";
98 return ss.str();
99 }
100 };
101
103 template <typename ValueT, int Num>
104 struct IsEqual< ELRFad::SLFad<ValueT,Num> > {
106 static bool eval(const ELRFad::SLFad<ValueT,Num>& x,
107 const ELRFad::SLFad<ValueT,Num>& y) {
108 return x.isEqualTo(y);
109 }
110 };
111
113 template <typename ValueT, int Num>
114 struct IsStaticallySized< ELRFad::SLFad<ValueT,Num> > {
115 static const bool value = false;
116 };
117
119 template <typename ValueT, int Num>
120 struct IsStaticallySized< const ELRFad::SLFad<ValueT,Num> > {
121 static const bool value = false;
122 };
123
124} // namespace Sacado
125
126//
127// Define Teuchos traits classes
128//
129
130// Promotion traits
131#ifdef HAVE_SACADO_TEUCHOSNUMERICS
132#include "Teuchos_PromotionTraits.hpp"
133namespace Teuchos {
134 template <typename ValueT, int Num>
135 struct PromotionTraits< Sacado::ELRFad::SLFad<ValueT,Num>,
136 Sacado::ELRFad::SLFad<ValueT,Num> > {
139 promote;
140 };
141
142 template <typename ValueT, int Num, typename R>
143 struct PromotionTraits< Sacado::ELRFad::SLFad<ValueT,Num>, R > {
144 typedef typename Sacado::Promote< Sacado::ELRFad::SLFad<ValueT,Num>, R >::type
145 promote;
146 };
147
148 template <typename L, typename ValueT, int Num>
149 struct PromotionTraits< L, Sacado::ELRFad::SLFad<ValueT,Num> > {
150 public:
151 typedef typename Sacado::Promote< L, Sacado::ELRFad::SLFad<ValueT,Num> >::type
152 promote;
153 };
154}
155#endif
156
157// Scalar traits
158#ifdef HAVE_SACADO_TEUCHOSCORE
160namespace Teuchos {
161 template <typename ValueT, int Num>
162 struct ScalarTraits< Sacado::ELRFad::SLFad<ValueT,Num> > :
163 public Sacado::Fad::ScalarTraitsImp< Sacado::ELRFad::SLFad<ValueT,Num> >
164 {};
165}
166#endif
167
168// Serialization traits
169#ifdef HAVE_SACADO_TEUCHOSCOMM
171namespace Teuchos {
172 template <typename Ordinal, typename ValueT, int Num>
173 struct SerializationTraits<Ordinal, Sacado::ELRFad::SLFad<ValueT,Num> > :
174 public Sacado::Fad::SerializationTraitsImp< Ordinal,
175 Sacado::ELRFad::SLFad<ValueT,Num> >
176 {};
177
178 template <typename Ordinal, typename ValueT, int Num>
179 struct ValueTypeSerializer<Ordinal, Sacado::ELRFad::SLFad<ValueT,Num> > :
180 public Sacado::Fad::SerializerImp< Ordinal,
181 Sacado::ELRFad::SLFad<ValueT,Num>,
182 ValueTypeSerializer<Ordinal,ValueT> >
183 {
184 typedef Sacado::ELRFad::SLFad<ValueT,Num> FadType;
185 typedef ValueTypeSerializer<Ordinal,ValueT> ValueSerializer;
186 typedef Sacado::Fad::SerializerImp< Ordinal,FadType,ValueSerializer> Base;
187 ValueTypeSerializer(const Teuchos::RCP<const ValueSerializer>& vs,
188 Ordinal sz = 0) :
189 Base(vs, sz) {}
190 };
191}
192#endif
193
194// KokkosComm
195#if defined(HAVE_SACADO_KOKKOS) && defined(HAVE_SACADO_TEUCHOSKOKKOSCOMM) && defined(HAVE_SACADO_VIEW_SPEC) && !defined(SACADO_DISABLE_FAD_VIEW_SPEC)
196#include "KokkosExp_View_Fad.hpp"
197#endif
198
199#endif // SACADO_ELRFAD_SFADTRAITS_HPP
int Ordinal
#define SACADO_INLINE_FUNCTION
#define SACADO_SFAD_PROMOTE_SPEC(NS, FAD)
#define R
Sacado::Fad::DFad< double > FadType
Namespace for expression-level reverse forward-mode AD classes.
Base template specification for IsADType.
static SACADO_INLINE_FUNCTION bool eval(const ELRFad::SLFad< ValueT, Num > &x, const ELRFad::SLFad< ValueT, Num > &y)
Base template specification for testing equivalence.
Base template specification for IsScalarType.
Base template specification for testing whether type is statically sized.
Base template specification for ScalarType.
static SACADO_INLINE_FUNCTION const scalar_type & eval(const ELRFad::SLFad< ValueT, Num > &x)
ScalarType< ELRFad::SLFad< ValueT, Num > >::type scalar_type
ValueType< ELRFad::SLFad< ValueT, Num > >::type value_type
Base template specification for ScalarValue.
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
Base template specification for string names of types.
static std::string eval()
Base template specification for ValueType.
ValueType< ELRFad::SLFad< ValueT, Num > >::type value_type
static SACADO_INLINE_FUNCTION const value_type & eval(const ELRFad::SLFad< ValueT, Num > &x)
Base template specification for Value.