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_MathFunctions.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_MATHFUNCTIONS_HPP
31 #define SACADO_FAD_EXP_MATHFUNCTIONS_HPP
32 
33 #include "Sacado_cmath.hpp"
34 #include "Sacado_SFINAE_Macros.hpp"
35 
36 // Note: Sacado::Fad::Ops are forward-declared here, instead of in macros
37 // below.
39 
40 #define UNARYFUNC_MACRO(OP,FADOP) \
41 namespace Sacado { \
42  \
43  namespace Fad { \
44  namespace Exp { \
45  template <typename T> class Expr; \
46  template <typename T> \
47  KOKKOS_INLINE_FUNCTION \
48  FADOP< typename Expr<T>::derived_type, \
49  typename T::expr_spec_type > \
50  OP (const Expr<T>&); \
51  } \
52  } \
53  \
54 } \
55  \
56 namespace std { \
57  using Sacado::Fad::Exp::OP; \
58 }
59 
79 
80 #undef UNARYFUNC_MACRO
81 
82 #define BINARYFUNC_MACRO(OP,FADOP) \
83 namespace Sacado { \
84  \
85  namespace Fad { \
86  namespace Exp { \
87  template <typename T> class Expr; \
88  template <typename T> struct IsFadExpr; \
89  template <typename T> struct ExprLevel; \
90  template <typename T1, typename T2> \
91  KOKKOS_INLINE_FUNCTION \
92  SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(FADOP) \
93  OP (const T1&, const T2&); \
94  \
95  template <typename T> \
96  KOKKOS_INLINE_FUNCTION \
97  FADOP< typename T::value_type, typename Expr<T>::derived_type, \
98  true, false, typename T::expr_spec_type > \
99  OP (const typename T::value_type&, const Expr<T>&); \
100  \
101  template <typename T> \
102  KOKKOS_INLINE_FUNCTION \
103  FADOP< typename Expr<T>::derived_type, typename T::value_type, \
104  false, true, typename T::expr_spec_type > \
105  OP (const Expr<T>&, const typename T::value_type&); \
106  \
107  template <typename T> \
108  KOKKOS_INLINE_FUNCTION \
109  SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(FADOP) \
110  OP (const typename T::scalar_type&, const Expr<T>&); \
111  \
112  template <typename T> \
113  KOKKOS_INLINE_FUNCTION \
114  SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(FADOP) \
115  OP (const Expr<T>&, const typename T::scalar_type&); \
116  } \
117  } \
118  \
119 } \
120  \
121 namespace std { \
122  using Sacado::Fad::Exp::OP; \
123 }
124 
129 
130 #undef BINARYFUNC_MACRO
131 
132 #if defined(HAVE_SACADO_KOKKOSCORE)
133 
134 namespace Sacado {
135  namespace Fad {
136  namespace Exp {
137  template <typename S> class GeneralFad;
138  template <typename ValT, unsigned sl, unsigned ss, typename U>
139  class ViewFadPtr;
140 
141  template <typename S>
143  void atomic_add(GeneralFad<S>* dst, const GeneralFad<S>& x);
144 
145  template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
147  void atomic_add(ViewFadPtr<ValT,sl,ss,U> dst, const Expr<T>& x);
148  }
149  }
150 }
151 
152 namespace Kokkos {
153  using Sacado::Fad::Exp::atomic_add;
154 }
155 
156 #endif
157 
158 #endif // SACADO_FAD_EXP_MATHFUNCTIONS_HPP
cbrt(expr.val())
expr expr SinOp
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
asinh(expr.val())
asin(expr.val())
cosh(expr.val())
abs(expr.val())
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MinOp
atanh(expr.val())
expr expr expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 expr1 expr1 c *expr2 expr1 c *expr2 expr1 c *expr2 expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 Atan2Op
expr expr CoshOp
expr expr ATanhOp
expr expr TanhOp
expr expr SqrtOp
expr expr ASinhOp
atan(expr.val())
#define BINARYFUNC_MACRO(OP, FADOP)
KOKKOS_INLINE_FUNCTION mpl::enable_if_c< ExprLevel< Expr< T1 > >::value==ExprLevel< Expr< T2 > >::value, Expr< PowerOp< Expr< T1 >, Expr< T2 > > > >::type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
#define KOKKOS_INLINE_FUNCTION
tanh(expr.val())
expr expr CosOp
#define UNARYFUNC_MACRO(OP, FADOP)
expr expr ATanOp
SimpleFad< ValueT > min(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
expr expr ACosOp
sqrt(expr.val())
sinh(expr.val())
tan(expr.val())
atan2(expr1.val(), expr2.val())
sin(expr.val())
log(expr.val())
expr expr ACoshOp
expr expr Log10Op
expr expr SinhOp
acosh(expr.val())
acos(expr.val())
SimpleFad< ValueT > max(const SimpleFad< ValueT > &a, const SimpleFad< ValueT > &b)
expr expr ASinOp
exp(expr.val())
expr expr expr ExpOp
fabs(expr.val())
expr expr AbsOp
expr expr TanOp
log10(expr.val())
cos(expr.val())
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 PowerOp