Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_CacheFad_ExpressionTraits.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 // @HEADER
9 
10 #ifndef SACADO_CACHEFAD_EXPRESSIONTRAITS_HPP
11 #define SACADO_CACHEFAD_EXPRESSIONTRAITS_HPP
12 
13 #include "Sacado_Traits.hpp"
14 
15 // Forward declarations
16 namespace Sacado {
17  namespace CacheFad {
18  template <typename T> class Expr;
19  }
20 }
21 
22 namespace Sacado {
23 
25  SACADO_EXPR_PROMOTE_SPEC( CacheFad )
26 
27 
28  template <typename T>
29  struct ScalarType< CacheFad::Expr<T> > {
31  };
32 
34  template <typename T>
35  struct ValueType< CacheFad::Expr<T> > {
37  };
38 
40  template <typename T>
41  struct IsADType< CacheFad::Expr<T> > {
42  static const bool value = true;
43  };
44 
46  template <typename T>
47  struct IsScalarType< CacheFad::Expr<T> > {
48  static const bool value = false;
49  };
50 
52  template <typename T>
53  struct Value< CacheFad::Expr<T> > {
54  typedef typename ValueType< CacheFad::Expr<T> >::type value_type;
56  static const value_type& eval(const CacheFad::Expr<T>& x) {
57  return x.val(); }
58  };
59 
61  template <typename T>
62  struct ScalarValue< CacheFad::Expr<T> > {
63  typedef typename ValueType< CacheFad::Expr<T> >::type value_type;
64  typedef typename ScalarType< CacheFad::Expr<T> >::type scalar_type;
66  static const scalar_type& eval(const CacheFad::Expr<T>& x) {
67  return ScalarValue<value_type>::eval(x.val()); }
68  };
69 
70 } // namespace Sacado
71 
72 #endif // SACADO_CACHEFAD_EXPRESSIONTRAITS_HPP
static SACADO_INLINE_FUNCTION const T & eval(const T &x)
ValueType< CacheFad::Expr< T > >::type value_type
ScalarType< typename CacheFad::Expr< T >::value_type >::type type
Base template specification for ScalarValue.
Base template specification for ScalarType.
Base template specification for IsADType.
static SACADO_INLINE_FUNCTION const scalar_type & eval(const CacheFad::Expr< T > &x)
Base template specification for Value.
#define T
Definition: Sacado_rad.hpp:553
static const bool value
#define SACADO_EXPR_PROMOTE_SPEC(NS)
static const bool value
Base template specification for IsScalarType.
#define SACADO_INLINE_FUNCTION
Wrapper for a generic expression template.
static SACADO_INLINE_FUNCTION const value_type & eval(const CacheFad::Expr< T > &x)
Base template specification for ValueType.
ScalarType< CacheFad::Expr< T > >::type scalar_type