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 
80 
81 #undef UNARYFUNC_MACRO
82 
83 #define BINARYFUNC_MACRO(OP,FADOP) \
84 namespace Sacado { \
85  \
86  namespace Fad { \
87  namespace Exp { \
88  template <typename T> class Expr; \
89  template <typename T> struct IsFadExpr; \
90  template <typename T> struct ExprLevel; \
91  template <typename T1, typename T2> \
92  KOKKOS_INLINE_FUNCTION \
93  SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(FADOP) \
94  OP (const T1&, const T2&); \
95  \
96  template <typename T> \
97  KOKKOS_INLINE_FUNCTION \
98  FADOP< typename T::value_type, typename Expr<T>::derived_type, \
99  true, false, typename T::expr_spec_type > \
100  OP (const typename T::value_type&, const Expr<T>&); \
101  \
102  template <typename T> \
103  KOKKOS_INLINE_FUNCTION \
104  FADOP< typename Expr<T>::derived_type, typename T::value_type, \
105  false, true, typename T::expr_spec_type > \
106  OP (const Expr<T>&, const typename T::value_type&); \
107  \
108  template <typename T> \
109  KOKKOS_INLINE_FUNCTION \
110  SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(FADOP) \
111  OP (const typename T::scalar_type&, const Expr<T>&); \
112  \
113  template <typename T> \
114  KOKKOS_INLINE_FUNCTION \
115  SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(FADOP) \
116  OP (const Expr<T>&, const typename T::scalar_type&); \
117  } \
118  } \
119  \
120 } \
121  \
122 namespace std { \
123  using Sacado::Fad::Exp::OP; \
124 }
125 
130 
131 #undef BINARYFUNC_MACRO
132 
133 #if defined(HAVE_SACADO_KOKKOSCORE)
134 
135 namespace Sacado {
136  namespace Fad {
137  namespace Exp {
138  template <typename S> class GeneralFad;
139  template <typename ValT, unsigned sl, unsigned ss, typename U>
140  class ViewFadPtr;
141 
142  template <typename S>
144  void atomic_add(GeneralFad<S>* dst, const GeneralFad<S>& x);
145 
146  template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
148  void atomic_add(ViewFadPtr<ValT,sl,ss,U> dst, const Expr<T>& x);
149  }
150  }
151 }
152 
153 namespace Kokkos {
154  using Sacado::Fad::Exp::atomic_add;
155 }
156 
157 #endif
158 
159 #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 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)
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
#define KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION T safe_sqrt(const T &x)
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