Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_ETPCE_ExpressionTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef SACADO_ETPCE_EXPRESSIONTRAITS_HPP
11 #define SACADO_ETPCE_EXPRESSIONTRAITS_HPP
12 
13 #include "Sacado_Traits.hpp"
14 
15 // Forward declarations
16 namespace Sacado {
17  namespace ETPCE {
18  template <typename T> class Expr;
19  }
20 }
21 
22 namespace Sacado {
23 
24  // We don't specialize Promote because otherwise we can get ambiguous
25  // partial specializations with the OrthogPoly classes.
26 
28  template <typename T>
29  struct ScalarType< ETPCE::Expr<T> > {
31  };
32 
34  template <typename T>
35  struct ValueType< ETPCE::Expr<T> > {
36  typedef typename ETPCE::Expr<T>::value_type type;
37  };
38 
40  template <typename T>
41  struct IsADType< ETPCE::Expr<T> > {
42  static const bool value = true;
43  };
44 
46  template <typename T>
47  struct IsScalarType< ETPCE::Expr<T> > {
48  static const bool value = false;
49  };
50 
52  template <typename T>
53  struct Value< ETPCE::Expr<T> > {
54  typedef typename ValueType< ETPCE::Expr<T> >::type value_type;
55  static const value_type& eval(const ETPCE::Expr<T>& x) {
56  return x.val(); }
57  };
58 
60  template <typename T>
61  struct ScalarValue< ETPCE::Expr<T> > {
62  typedef typename ValueType< ETPCE::Expr<T> >::type value_type;
63  typedef typename ScalarType< ETPCE::Expr<T> >::type scalar_type;
64  static const scalar_type& eval(const ETPCE::Expr<T>& x) {
65  return ScalarValue<value_type>::eval(x.val()); }
66  };
67 
68 } // namespace Sacado
69 
70 #endif // SACADO_ETPCE_EXPRESSIONTRAITS_HPP
ValueType< ETPCE::Expr< T > >::type value_type
static const scalar_type & eval(const ETPCE::Expr< T > &x)
ScalarType< ETPCE::Expr< T > >::type scalar_type
ValueType< ETPCE::Expr< T > >::type value_type
static const value_type & eval(const ETPCE::Expr< T > &x)
ScalarType< typename ETPCE::Expr< T >::value_type >::type type