Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_Fad_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_FAD_VIEWFADTRAITS_HPP
31 #define SACADO_FAD_VIEWFADTRAITS_HPP
32 
33 #include "Sacado_ConfigDefs.h"
34 
35 #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
36 
38 
39 #else
40 
41 #include "Sacado_Traits.hpp"
42 
43 // Forward declarations
44 namespace Sacado {
45  namespace Fad {
46  template <typename T,unsigned,unsigned,typename> class ViewFad;
47  }
48 }
49 
50 namespace Sacado {
51 
54 
55 
56  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
57  struct ScalarType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
59  };
60 
62  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
63  struct ValueType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
64  typedef ValueT type;
65  };
66 
68  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
69  struct IsADType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
70  static const bool value = true;
71  };
72 
74  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
75  struct IsScalarType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
76  static const bool value = false;
77  };
78 
80  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
81  struct IsSimdType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
82  static const bool value = IsSimdType<ValueT>::value;
83  };
84 
86  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
87  struct Value< Fad::ViewFad<ValueT,Size,Stride,Base> > {
91  return x.val(); }
92  };
93 
95  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
96  struct ScalarValue< Fad::ViewFad<ValueT,Size,Stride,Base> > {
101  return ScalarValue<value_type>::eval(x.val()); }
102  };
103 
105  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
106  struct StringName< Fad::ViewFad<ValueT,Size,Stride,Base> > {
107  static std::string eval() {
108  return std::string("Sacado::Fad::ViewFad< ") +
109  StringName<ValueT>::eval() + " >"; }
110  };
111 
113  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
114  struct IsEqual< Fad::ViewFad<ValueT,Size,Stride,Base> > {
118  return x.isEqualTo(y);
119  }
120  };
121 
123  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
124  struct IsStaticallySized< Fad::ViewFad<ValueT,Size,Stride,Base> > {
125  static const bool value = false;
126  };
127 
128 } // namespace Sacado
129 
130 // ViewFad is not a proper scalar type, so we don't define any of the
131 // Teuchos traits classes
132 
133 #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT
134 
135 #endif // SACADO_FAD_DFADTRAITS_HPP
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
static std::string eval()
Base template specification for ScalarValue.
Base template specification for ScalarType.
static SACADO_INLINE_FUNCTION const value_type & eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x)
Base template specification for string names of types.
Base template specification for IsADType.
Base template specification for Value.
ValueType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type value_type
Base class for Sacado types to control overload resolution.
Definition: Sacado_Base.hpp:26
static SACADO_INLINE_FUNCTION const scalar_type & eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x)
Base template specification for IsSimdType.
static const bool value
Base template specification for testing equivalence.
static const bool value
ScalarType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type scalar_type
static SACADO_INLINE_FUNCTION bool eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x, const Fad::ViewFad< ValueT, Size, Stride, Base > &y)
static const bool value
Fad::ViewFad< ValueT, Size, Stride, Base >::ScalarT type
ValueType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type value_type
Base template specification for IsScalarType.
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
#define SACADO_VFAD_PROMOTE_SPEC(NS)
#define SACADO_INLINE_FUNCTION
Base template specification for ValueType.
const double y
Base template specification for testing whether type is statically sized.