Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
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"
35
36// Note: Sacado::Fad::Ops are forward-declared here, instead of in macros
37// below.
39
40#define UNARYFUNC_MACRO(OP,FADOP) \
41namespace Sacado { \
42 \
43 namespace Fad { \
44 namespace Exp { \
45 template <typename T> class Expr; \
46 template <typename T> \
47 SACADO_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 \
56namespace std { \
57 using Sacado::Fad::Exp::OP; \
58}
59
80
81#undef UNARYFUNC_MACRO
82
83#define BINARYFUNC_MACRO(OP,FADOP) \
84namespace 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 SACADO_INLINE_FUNCTION \
93 SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(FADOP) \
94 OP (const T1&, const T2&); \
95 \
96 template <typename T> \
97 SACADO_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 SACADO_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 SACADO_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 SACADO_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 \
122namespace std { \
123 using Sacado::Fad::Exp::OP; \
124}
125
130
131#undef BINARYFUNC_MACRO
132
133#if defined(HAVE_SACADO_KOKKOSCORE)
134
135namespace 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 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 template <typename S>
150 SACADO_INLINE_FUNCTION GeneralFad<S>
151 atomic_max_fetch(GeneralFad<S>* dest, const GeneralFad<S>& val);
152 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
154 atomic_max_fetch(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
155 template <typename S>
156 SACADO_INLINE_FUNCTION GeneralFad<S>
157 atomic_min_fetch(GeneralFad<S>* dest, const GeneralFad<S>& val);
158 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
160 atomic_min_fetch(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
161 template <typename S>
162 SACADO_INLINE_FUNCTION GeneralFad<S>
163 atomic_add_fetch(GeneralFad<S>* dst, const GeneralFad<S>& x);
164 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
166 atomic_add_fetch(ViewFadPtr<ValT,sl,ss,U> dst, const Expr<T>& x);
167 template <typename S>
168 SACADO_INLINE_FUNCTION GeneralFad<S>
169 atomic_sub_fetch(GeneralFad<S>* dest, const GeneralFad<S>& val);
170 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
172 atomic_sub_fetch(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
173 template <typename S>
174 SACADO_INLINE_FUNCTION GeneralFad<S>
175 atomic_mul_fetch(GeneralFad<S>* dest, const GeneralFad<S>& val);
176 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
178 atomic_mul_fetch(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
179 template <typename S>
180 SACADO_INLINE_FUNCTION GeneralFad<S>
181 atomic_div_fetch(GeneralFad<S>* dest, const GeneralFad<S>& val);
182 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
184 atomic_div_fetch(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
185
186 template <typename S>
187 SACADO_INLINE_FUNCTION GeneralFad<S>
188 atomic_fetch_max(GeneralFad<S>* dest, const GeneralFad<S>& val);
189 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
191 atomic_fetch_max(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
192 template <typename S>
193 SACADO_INLINE_FUNCTION GeneralFad<S>
194 atomic_fetch_min(GeneralFad<S>* dest, const GeneralFad<S>& val);
195 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
197 atomic_fetch_min(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
198 template <typename S>
199 SACADO_INLINE_FUNCTION GeneralFad<S>
200 atomic_fetch_add(GeneralFad<S>* dst, const GeneralFad<S>& x);
201 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
203 atomic_fetch_add(ViewFadPtr<ValT,sl,ss,U> dst, const Expr<T>& x);
204 template <typename S>
205 SACADO_INLINE_FUNCTION GeneralFad<S>
206 atomic_fetch_sub(GeneralFad<S>* dest, const GeneralFad<S>& val);
207 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
209 atomic_fetch_sub(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
210 template <typename S>
211 SACADO_INLINE_FUNCTION GeneralFad<S>
212 atomic_fetch_mul(GeneralFad<S>* dest, const GeneralFad<S>& val);
213 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
215 atomic_fetch_mul(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
216 template <typename S>
217 SACADO_INLINE_FUNCTION GeneralFad<S>
218 atomic_fetch_div(GeneralFad<S>* dest, const GeneralFad<S>& val);
219 template <typename ValT, unsigned sl, unsigned ss, typename U, typename T>
221 atomic_fetch_div(ViewFadPtr<ValT,sl,ss,U> dest, const Expr<T>& val);
222 }
223 }
224}
225
226namespace Kokkos {
227 using Sacado::Fad::Exp::atomic_add;
228 using Sacado::Fad::Exp::atomic_max_fetch;
229 using Sacado::Fad::Exp::atomic_min_fetch;
230 using Sacado::Fad::Exp::atomic_add_fetch;
231 using Sacado::Fad::Exp::atomic_sub_fetch;
232 using Sacado::Fad::Exp::atomic_mul_fetch;
233 using Sacado::Fad::Exp::atomic_div_fetch;
234 using Sacado::Fad::Exp::atomic_fetch_max;
235 using Sacado::Fad::Exp::atomic_fetch_min;
236 using Sacado::Fad::Exp::atomic_fetch_add;
237 using Sacado::Fad::Exp::atomic_fetch_sub;
238 using Sacado::Fad::Exp::atomic_fetch_mul;
239 using Sacado::Fad::Exp::atomic_fetch_div;
240}
241
242#endif
243
244#endif // SACADO_FAD_EXP_MATHFUNCTIONS_HPP
#define SACADO_INLINE_FUNCTION
#define UNARYFUNC_MACRO(OP, FADOP)
#define BINARYFUNC_MACRO(OP, FADOP)
expr expr SinOp
expr expr SinhOp
expr expr SqrtOp
expr expr ACosOp
expr2 expr1 expr2 expr2 c *expr2 c *expr1 c *expr2 c *expr1 MaxOp
expr expr ATanOp
expr expr ACoshOp
expr expr ASinOp
expr expr TanhOp
expr expr TanOp
expr expr CoshOp
expr expr ASinhOp
expr expr Log10Op
expr expr expr ExpOp
expr expr AbsOp
expr val()
expr expr ATanhOp
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 CosOp
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