Debian Codegraph @

packages/stokhos/src/sacado/kokkos/vector/Sacado_MP_ExpressionTraits.hpp

raw
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_MP_EXPRESSIONTRAITS_HPP
11 #define SACADO_MP_EXPRESSIONTRAITS_HPP
12
13 #include "Sacado_Traits.hpp"
14
15 // Forward declarations
16 namespace Sacado {
17 namespace MP {
18 template <typename T> class Expr;
19 }
20 }
21
22 namespace Sacado {
23
24 //! Specialization of %ScalarType to Expr types
25 template <typename T>
26 struct ScalarType< MP::Expr<T> > {
27 typedef typename ScalarType< typename MP::Expr<T>::value_type >::type type;
28 };
29
30 //! Specialization of %ValueType to Expr types
31 template <typename T>
32 struct ValueType< MP::Expr<T> > {
33 typedef typename MP::Expr<T>::value_type type;
34 };
35
36 //! Specialization of %IsADType to Expr types
37 template <typename T>
38 struct IsADType< MP::Expr<T> > {
39 static const bool value = true;
40 };
41
42 //! Specialization of %IsADType to Expr types
43 template <typename T>
44 struct IsScalarType< MP::Expr<T> > {
45 static const bool value = false;
46 };
47
48 //! Specialization of %Value to Expr types
49 template <typename T>
50 struct Value< MP::Expr<T> > {
51 typedef typename ValueType< MP::Expr<T> >::type value_type;
52 static const value_type& eval(const MP::Expr<T>& x) {
53 return x.val(); }
54 };
55
56 //! Specialization of %ScalarValue to Expr types
57 template <typename T>
58 struct ScalarValue< MP::Expr<T> > {
59 typedef typename ValueType< MP::Expr<T> >::type value_type;
60 typedef typename ScalarType< MP::Expr<T> >::type scalar_type;
61 static const scalar_type& eval(const MP::Expr<T>& x) {
62 return ScalarValue<value_type>::eval(x.val()); }
63 };
64
65 } // namespace Sacado
66
67 #endif // SACADO_MP_EXPRESSIONTRAITS_HPP