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_Exp_Expression.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 // @HEADER
29 
30 #ifndef SACADO_FAD_EXP_EXPRESSION_HPP
31 #define SACADO_FAD_EXP_EXPRESSION_HPP
32 
33 #include "Sacado_Traits.hpp"
34 
35 namespace Sacado {
36 
37  namespace Fad {
38  namespace Exp {
39 
41 
54  template <typename T>
55  class Expr {
56  public:
57 
59 
63  typedef T derived_type;
64 
66 
71  const derived_type& derived() const {
72  return static_cast<const derived_type&>(*this);
73  }
74 
76 
81  const volatile derived_type& derived() const volatile {
82  return static_cast<const volatile derived_type&>(*this);
83  }
84  };
85 
87 
92  template <typename T>
93  struct ExprLevel {
94  static constexpr unsigned value = 0;
95  };
96 
97  template <typename T>
98  struct ExprLevel< Expr<T> > {
99  static constexpr unsigned value =
101  };
102 
104  template <typename T>
105  struct IsFadExpr {
106  static constexpr bool value = false;
107  };
108 
109  template <typename T>
110  struct IsFadExpr< Expr<T> > {
111  static constexpr bool value = true;
112  };
113 
114  // Tag for delegating expression template specializations
115  class ExprSpecDefault {};
116 
117  } // namespace Exp
118  } // namespace Fad
119 
120  template <typename T>
121  struct IsExpr< Fad::Exp::Expr<T> > {
122  static constexpr bool value = true;
123  };
124 
125  template <typename T>
126  struct BaseExprType< Fad::Exp::Expr<T> > {
127  typedef typename BaseExprType<T>::type type;
128  };
129 
130 } // namespace Sacado
131 
132 #include "Sacado_SFINAE_Macros.hpp"
133 
134 #endif // SACADO_FAD_EXP_EXPRESSION_HPP
SACADO_INLINE_FUNCTION const volatile derived_type & derived() const volatile
Return derived object.
Determine whether a given type is an expression.
static const bool value
Wrapper for a generic expression template.
Is a type an expression.
#define T
Definition: Sacado_rad.hpp:573
SACADO_INLINE_FUNCTION const derived_type & derived() const
Return derived object.
Forward-mode AD class templated on the storage for the derivative array.
Get the base Fad type from a view/expression.
T derived_type
Typename of derived object, returned by derived()
Meta-function for determining nesting with an expression.
#define SACADO_INLINE_FUNCTION