Sacado Package Browser (Single Doxygen Collection)  Version of the Day
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::Fad::Exp::ExprLevel::value
static constexpr unsigned value
Definition: Sacado_Fad_Exp_Expression.hpp:94
KOKKOS_INLINE_FUNCTION
#define KOKKOS_INLINE_FUNCTION
Definition: Sacado_ConfigDefs.h:90
Sacado::Fad::Exp::ExprSpecDefault
Definition: Sacado_Fad_Exp_Expression.hpp:115
Sacado::IsExpr::value
static const bool value
Definition: Sacado_Traits.hpp:78
Sacado::BaseExprType< Fad::Exp::Expr< T > >::type
BaseExprType< T >::type type
Definition: Sacado_Fad_Exp_Expression.hpp:127
Sacado::Fad::Exp::GeneralFad
Forward-mode AD class templated on the storage for the derivative array.
Definition: Sacado_Fad_Exp_GeneralFad.hpp:51
T
#define T
Definition: Sacado_rad.hpp:573
Sacado_Traits.hpp
Sacado::Fad::Exp::ExprLevel
Meta-function for determining nesting with an expression.
Definition: Sacado_Fad_Exp_Expression.hpp:93
Sacado::Fad::Exp::IsFadExpr::value
static constexpr bool value
Definition: Sacado_Fad_Exp_Expression.hpp:106
Sacado::Fad::Exp::Expr
Wrapper for a generic expression template.
Definition: Sacado_Fad_Exp_Expression.hpp:55
Sacado::BaseExprType
Get the base Fad type from a view/expression.
Definition: Sacado_Traits.hpp:89
Sacado
Definition: Sacado_mpl_apply.hpp:39
Sacado::Fad::Exp::Expr::derived_type
T derived_type
Typename of derived object, returned by derived()
Definition: Sacado_Fad_Exp_Expression.hpp:63
Sacado::BaseExprType::type
T type
Definition: Sacado_Traits.hpp:90
Sacado_SFINAE_Macros.hpp
Sacado::Fad::Exp::Expr::derived
const KOKKOS_INLINE_FUNCTION derived_type & derived() const
Return derived object.
Definition: Sacado_Fad_Exp_Expression.hpp:71
Sacado::IsExpr
Is a type an expression.
Definition: Sacado_Traits.hpp:77
Sacado::Fad::Exp::IsFadExpr
Determine whether a given type is an expression.
Definition: Sacado_Fad_Exp_Expression.hpp:105
Sacado::Fad::Exp::Expr::derived
const KOKKOS_INLINE_FUNCTION volatile derived_type & derived() const volatile
Return derived object.
Definition: Sacado_Fad_Exp_Expression.hpp:81