Sacado Package Browser (Single Doxygen Collection)  Version of the Day
Sacado_Fad_ViewFadTraits.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 //
29 // The forward-mode AD classes in Sacado are a derivative work of the
30 // expression template classes in the Fad package by Nicolas Di Cesare.
31 // The following banner is included in the original Fad source code:
32 //
33 // ************ DO NOT REMOVE THIS BANNER ****************
34 //
35 // Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
36 // http://www.ann.jussieu.fr/~dicesare
37 //
38 // CEMRACS 98 : C++ courses,
39 // templates : new C++ techniques
40 // for scientific computing
41 //
42 //********************************************************
43 //
44 // NumericalTraits class to illustrate TRAITS
45 //
46 //********************************************************
47 // @HEADER
48 
49 #ifndef SACADO_FAD_VIEWFADTRAITS_HPP
50 #define SACADO_FAD_VIEWFADTRAITS_HPP
51 
52 #include "Sacado_ConfigDefs.h"
53 
54 #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT
55 
57 
58 #else
59 
60 #include "Sacado_Traits.hpp"
61 
62 // Forward declarations
63 namespace Sacado {
64  namespace Fad {
65  template <typename T,unsigned,unsigned,typename> class ViewFad;
66  }
67 }
68 
69 namespace Sacado {
70 
73 
74 
75  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
76  struct ScalarType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
78  };
79 
81  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
82  struct ValueType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
83  typedef ValueT type;
84  };
85 
87  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
88  struct IsADType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
89  static const bool value = true;
90  };
91 
93  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
94  struct IsScalarType< Fad::ViewFad<ValueT,Size,Stride,Base> > {
95  static const bool value = false;
96  };
97 
99  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
100  struct Value< Fad::ViewFad<ValueT,Size,Stride,Base> > {
104  return x.val(); }
105  };
106 
108  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
109  struct ScalarValue< Fad::ViewFad<ValueT,Size,Stride,Base> > {
114  return ScalarValue<value_type>::eval(x.val()); }
115  };
116 
118  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
119  struct StringName< Fad::ViewFad<ValueT,Size,Stride,Base> > {
120  static std::string eval() {
121  return std::string("Sacado::Fad::ViewFad< ") +
122  StringName<ValueT>::eval() + " >"; }
123  };
124 
126  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
127  struct IsEqual< Fad::ViewFad<ValueT,Size,Stride,Base> > {
131  return x.isEqualTo(y);
132  }
133  };
134 
136  template <typename ValueT, unsigned Size, unsigned Stride, typename Base>
137  struct IsStaticallySized< Fad::ViewFad<ValueT,Size,Stride,Base> > {
138  static const bool value = false;
139  };
140 
141 } // namespace Sacado
142 
143 // ViewFad is not a proper scalar type, so we don't define any of the
144 // Teuchos traits classes
145 
146 #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT
147 
148 #endif // SACADO_FAD_DFADTRAITS_HPP
Sacado::ValueType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type
ValueT type
Definition: Sacado_Fad_ViewFadTraits.hpp:83
Sacado::StringName::eval
static std::string eval()
Definition: Sacado_Traits.hpp:377
KOKKOS_INLINE_FUNCTION
#define KOKKOS_INLINE_FUNCTION
Definition: Sacado_ConfigDefs.h:90
Sacado::ScalarType
Base template specification for ScalarType.
Definition: Sacado_Traits.hpp:303
Sacado::ValueType
Base template specification for ValueType.
Definition: Sacado_Traits.hpp:320
Sacado::StringName
Base template specification for string names of types.
Definition: Sacado_Traits.hpp:376
Sacado::Value< Fad::ViewFad< ValueT, Size, Stride, Base > >::eval
static const KOKKOS_INLINE_FUNCTION value_type & eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x)
Definition: Sacado_Fad_ViewFadTraits.hpp:103
Sacado::Value
Base template specification for Value.
Definition: Sacado_Traits.hpp:354
Sacado::ScalarType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type
Fad::ViewFad< ValueT, Size, Stride, Base >::ScalarT type
Definition: Sacado_Fad_ViewFadTraits.hpp:77
Sacado::IsADType::value
static const bool value
Definition: Sacado_Traits.hpp:338
Sacado::ScalarValue::eval
static const KOKKOS_INLINE_FUNCTION T & eval(const T &x)
Definition: Sacado_Traits.hpp:366
Sacado_Traits.hpp
Sacado_Fad_Exp_GeneralFadTraits.hpp
Sacado::ScalarValue< Fad::ViewFad< ValueT, Size, Stride, Base > >::eval
static const KOKKOS_INLINE_FUNCTION scalar_type & eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x)
Definition: Sacado_Fad_ViewFadTraits.hpp:113
Sacado::IsEqual
Base template specification for testing equivalence.
Definition: Sacado_Traits.hpp:381
Sacado::IsStaticallySized
Base template specification for testing whether type is statically sized.
Definition: Sacado_Traits.hpp:387
Sacado::IsEqual< Fad::ViewFad< ValueT, Size, Stride, Base > >::eval
static KOKKOS_INLINE_FUNCTION bool eval(const Fad::ViewFad< ValueT, Size, Stride, Base > &x, const Fad::ViewFad< ValueT, Size, Stride, Base > &y)
Definition: Sacado_Fad_ViewFadTraits.hpp:129
Sacado::Fad::Exp::ViewFad
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
Definition: Sacado_Fad_Exp_ViewFad.hpp:47
Sacado
Definition: Sacado_mpl_apply.hpp:39
SACADO_VFAD_PROMOTE_SPEC
#define SACADO_VFAD_PROMOTE_SPEC(NS)
Definition: Sacado_Traits.hpp:245
Sacado::Value< Fad::ViewFad< ValueT, Size, Stride, Base > >::value_type
ValueType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type value_type
Definition: Sacado_Fad_ViewFadTraits.hpp:101
Sacado::Fad::DFad< double >
Sacado::ScalarValue< Fad::ViewFad< ValueT, Size, Stride, Base > >::scalar_type
ScalarType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type scalar_type
Definition: Sacado_Fad_ViewFadTraits.hpp:111
Sacado::IsScalarType
Base template specification for IsScalarType.
Definition: Sacado_Traits.hpp:346
Sacado::IsStaticallySized::value
static const bool value
Definition: Sacado_Traits.hpp:388
Sacado::ScalarValue
Base template specification for ScalarValue.
Definition: Sacado_Traits.hpp:364
Sacado_ConfigDefs.h
Sacado::StringName< Fad::ViewFad< ValueT, Size, Stride, Base > >::eval
static std::string eval()
Definition: Sacado_Fad_ViewFadTraits.hpp:120
Sacado::ScalarValue< Fad::ViewFad< ValueT, Size, Stride, Base > >::value_type
ValueType< Fad::ViewFad< ValueT, Size, Stride, Base > >::type value_type
Definition: Sacado_Fad_ViewFadTraits.hpp:110
Sacado::IsADType
Base template specification for IsADType.
Definition: Sacado_Traits.hpp:337
Sacado::IsScalarType::value
static const bool value
Definition: Sacado_Traits.hpp:347
Sacado::Fad::ViewFad
Definition: Sacado_Fad_ViewFadTraits.hpp:65