Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_ELRFad_ViewFadTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 //
8 // ***********************************************************************
9 //
10 // The forward-mode AD classes in Sacado are a derivative work of the
11 // expression template classes in the Fad package by Nicolas Di Cesare.
12 // The following banner is included in the original Fad source code:
13 //
14 // ************ DO NOT REMOVE THIS BANNER ****************
15 //
16 // Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
17 // http://www.ann.jussieu.fr/~dicesare
18 //
19 // CEMRACS 98 : C++ courses,
20 // templates : new C++ techniques
21 // for scientific computing
22 //
23 //********************************************************
24 //
25 // NumericalTraits class to illustrate TRAITS
26 //
27 //********************************************************
28 // @HEADER
29 
30 #ifndef SACADO_ELRFAD_VIEWFADTRAITS_HPP
31 #define SACADO_ELRFAD_VIEWFADTRAITS_HPP
32 
33 #include "Sacado_Traits.hpp"
34 
35 // Forward declarations
36 namespace Sacado {
37  namespace ELRFad {
38  template <typename T,unsigned,unsigned,typename> class ViewFad;
39  }
40 }
41 
42 namespace Sacado {
43 
45  SACADO_VFAD_PROMOTE_SPEC( ELRFad )
46 
47 
48  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
49  struct ScalarType< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
51  };
52 
54  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
55  struct ValueType< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
56  typedef ValueT type;
57  };
58 
60  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
61  struct IsADType< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
62  static const bool value = true;
63  };
64 
66  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
67  struct IsScalarType< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
68  static const bool value = false;
69  };
70 
72  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
73  struct Value< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
77  return x.val(); }
78  };
79 
81  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
82  struct ScalarValue< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
87  return ScalarValue<value_type>::eval(x.val()); }
88  };
89 
91  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
92  struct StringName< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
93  static std::string eval() {
94  return std::string("Sacado::ELRFad::ViewFad< ") +
95  StringName<ValueT>::eval() + " >"; }
96  };
97 
99  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
100  struct IsEqual< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
104  return x.isEqualTo(y);
105  }
106  };
107 
109  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
110  struct IsStaticallySized< ELRFad::ViewFad<ValueT,Size,Stride,Base> > {
111  static const bool value = false;
112  };
113 
114 } // namespace Sacado
115 
116 // ViewFad is not a proper scalar type, so we don't define any of the
117 // Teuchos traits classes
118 
119 #endif // SACADO_ELRFAD_VIEWFADTRAITS_HPP
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
ValueType< ELRFad::ViewFad< ValueT, Size, Stride, Base > >::type value_type
static std::string eval()
static SACADO_INLINE_FUNCTION const value_type & eval(const ELRFad::ViewFad< ValueT, Size, Stride, Base > &x)
Base template specification for ScalarValue.
Base template specification for ScalarType.
Base template specification for string names of types.
Base template specification for IsADType.
Base template specification for Value.
Base class for Sacado types to control overload resolution.
Definition: Sacado_Base.hpp:26
static const bool value
ScalarType< ELRFad::ViewFad< ValueT, Size, Stride, Base > >::type scalar_type
Base template specification for testing equivalence.
static const bool value
Base template specification for IsScalarType.
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
#define SACADO_VFAD_PROMOTE_SPEC(NS)
#define SACADO_INLINE_FUNCTION
static SACADO_INLINE_FUNCTION const scalar_type & eval(const ELRFad::ViewFad< ValueT, Size, Stride, Base > &x)
static SACADO_INLINE_FUNCTION bool eval(const ELRFad::ViewFad< ValueT, Size, Stride, Base > &x, const ELRFad::ViewFad< ValueT, Size, Stride, Base > &y)
Base template specification for ValueType.
const double y
Base template specification for testing whether type is statically sized.
ValueType< ELRFad::ViewFad< ValueT, Size, Stride, Base > >::type value_type