Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
symengine_math.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/base/config.h>
18 
19 #ifdef DEAL_II_WITH_SYMENGINE
20 
22 // Number operations
23 # include <symengine/add.h>
24 # include <symengine/functions.h>
25 # include <symengine/mul.h>
26 # include <symengine/pow.h>
28 
30 
32 
33 namespace Differentiation
34 {
35  namespace SD
36  {
37  namespace SE = ::SymEngine;
38 
39  /* --------------------------- Math functions ------------------------- */
40 
41  Expression
42  pow(const Expression &base, const Expression &exponent)
43  {
44  return SE::pow(base.get_RCP(), exponent.get_RCP());
45  }
46 
47 
48  Expression
49  sqrt(const Expression &x)
50  {
51  return SE::sqrt(x.get_RCP());
52  }
53 
54 
55  Expression
56  cbrt(const Expression &x)
57  {
58  return SE::cbrt(x.get_RCP());
59  }
60 
61 
62  Expression
63  exp(const Expression &exponent)
64  {
65  return SE::exp(exponent.get_RCP());
66  }
67 
68 
69  Expression
70  log(const Expression &x)
71  {
72  return SE::log(x.get_RCP());
73  }
74 
75 
76  Expression
77  log(const Expression &x, const Expression &base)
78  {
79  return SE::log(x.get_RCP(), base.get_RCP());
80  }
81 
82 
83  Expression
84  log10(const Expression &x)
85  {
86  return log(x.get_RCP(), Expression(10.0));
87  }
88 
89 
90  Expression
91  sin(const Expression &x)
92  {
93  return SE::sin(x.get_RCP());
94  }
95 
96 
97  Expression
98  cos(const Expression &x)
99  {
100  return SE::cos(x.get_RCP());
101  }
102 
103 
104  Expression
105  tan(const Expression &x)
106  {
107  return SE::tan(x.get_RCP());
108  }
109 
110 
111  Expression
112  csc(const Expression &x)
113  {
114  return SE::csc(x.get_RCP());
115  }
116 
117 
118  Expression
119  sec(const Expression &x)
120  {
121  return SE::sec(x.get_RCP());
122  }
123 
124 
125  Expression
126  cot(const Expression &x)
127  {
128  return SE::cot(x.get_RCP());
129  }
130 
131 
132  Expression
133  asin(const Expression &x)
134  {
135  return SE::asin(x.get_RCP());
136  }
137 
138 
139  Expression
140  acos(const Expression &x)
141  {
142  return SE::acos(x.get_RCP());
143  }
144 
145 
146  Expression
147  atan(const Expression &x)
148  {
149  return SE::atan(x.get_RCP());
150  }
151 
152 
153  Expression
154  atan2(const Expression &y, const Expression &x)
155  {
156  return SE::atan2(y.get_RCP(), x.get_RCP());
157  }
158 
159 
160  Expression
161  acsc(const Expression &x)
162  {
163  return SE::acsc(x.get_RCP());
164  }
165 
166 
167  Expression
168  asec(const Expression &x)
169  {
170  return SE::asec(x.get_RCP());
171  }
172 
173 
174  Expression
175  acot(const Expression &x)
176  {
177  return SE::acot(x.get_RCP());
178  }
179 
180 
181  Expression
182  sinh(const Expression &x)
183  {
184  return SE::sinh(x.get_RCP());
185  }
186 
187 
188  Expression
189  cosh(const Expression &x)
190  {
191  return SE::cosh(x.get_RCP());
192  }
193 
194 
195  Expression
196  tanh(const Expression &x)
197  {
198  return SE::tanh(x.get_RCP());
199  }
200 
201 
202  Expression
203  csch(const Expression &x)
204  {
205  return SE::csch(x.get_RCP());
206  }
207 
208 
209  Expression
210  sech(const Expression &x)
211  {
212  return SE::sech(x.get_RCP());
213  }
214 
215 
216  Expression
217  coth(const Expression &x)
218  {
219  return SE::coth(x.get_RCP());
220  }
221 
222 
223  Expression
224  asinh(const Expression &x)
225  {
226  return SE::asinh(x.get_RCP());
227  }
228 
229 
230  Expression
231  acosh(const Expression &x)
232  {
233  return SE::acosh(x.get_RCP());
234  }
235 
236 
237  Expression
238  atanh(const Expression &x)
239  {
240  return SE::atanh(x.get_RCP());
241  }
242 
243 
244  Expression
245  acsch(const Expression &x)
246  {
247  return SE::acsch(x.get_RCP());
248  }
249 
250 
251  Expression
252  asech(const Expression &x)
253  {
254  return SE::asech(x.get_RCP());
255  }
256 
257 
258  Expression
259  acoth(const Expression &x)
260  {
261  return SE::acoth(x.get_RCP());
262  }
263 
264 
265  Expression
266  abs(const Expression &x)
267  {
268  return SE::abs(x.get_RCP());
269  }
270 
271 
272  Expression
273  fabs(const Expression &x)
274  {
275  return SE::abs(x.get_RCP());
276  }
277 
278 
279  Expression
280  sign(const Expression &x)
281  {
282  return SE::sign(x.get_RCP());
283  }
284 
285 
286  Expression
288  {
289  return value * Expression(SE::sign(sign.get_RCP()));
290  }
291 
292 
293  Expression
294  floor(const Expression &x)
295  {
296  return SE::floor(x.get_RCP());
297  }
298 
299 
300  Expression
301  ceil(const Expression &x)
302  {
303  return SE::ceiling(x.get_RCP());
304  }
305 
306 
307  Expression
308  max(const Expression &a, const Expression &b)
309  {
310  return SE::max({a.get_RCP(), b.get_RCP()});
311  }
312 
313 
314  Expression
315  min(const Expression &a, const Expression &b)
316  {
317  return SE::min({a.get_RCP(), b.get_RCP()});
318  }
319 
320 
321  Expression
322  erf(const Expression &x)
323  {
324  return SE::erf(x.get_RCP());
325  }
326 
327 
328  Expression
329  erfc(const Expression &x)
330  {
331  return SE::erfc(x.get_RCP());
332  }
333 
334  } // namespace SD
335 } // namespace Differentiation
336 
338 
339 #endif // DEAL_II_WITH_SYMENGINE
Differentiation::SD::floor
Expression floor(const Expression &x)
Definition: symengine_math.cc:294
Differentiation::SD::csch
Expression csch(const Expression &x)
Definition: symengine_math.cc:203
Differentiation::SD::copysign
Expression copysign(const Expression &value, const Expression &sign)
Definition: symengine_math.cc:287
Differentiation::SD::coth
Expression coth(const Expression &x)
Definition: symengine_math.cc:217
Differentiation::SD::atanh
Expression atanh(const Expression &x)
Definition: symengine_math.cc:238
Differentiation::SD::atan
Expression atan(const Expression &x)
Definition: symengine_math.cc:147
Differentiation::SD::erfc
Expression erfc(const Expression &x)
Definition: symengine_math.cc:329
Differentiation::SD::tanh
Expression tanh(const Expression &x)
Definition: symengine_math.cc:196
Differentiation::SD::erf
Expression erf(const Expression &x)
Definition: symengine_math.cc:322
Differentiation::SD::acoth
Expression acoth(const Expression &x)
Definition: symengine_math.cc:259
Differentiation::SD::sech
Expression sech(const Expression &x)
Definition: symengine_math.cc:210
Differentiation::SD::csc
Expression csc(const Expression &x)
Definition: symengine_math.cc:112
Differentiation::SD::asinh
Expression asinh(const Expression &x)
Definition: symengine_math.cc:224
Differentiation::SD::sinh
Expression sinh(const Expression &x)
Definition: symengine_math.cc:182
Differentiation::SD::cosh
Expression cosh(const Expression &x)
Definition: symengine_math.cc:189
Differentiation::SD::fabs
Expression fabs(const Expression &x)
Definition: symengine_math.cc:273
Differentiation::SD::max
Expression max(const Expression &a, const Expression &b)
Definition: symengine_math.cc:308
Differentiation::SD::atan2
Expression atan2(const Expression &y, const Expression &x)
Definition: symengine_math.cc:154
DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition: config.h:409
Differentiation::SD::min
Expression min(const Expression &a, const Expression &b)
Definition: symengine_math.cc:315
Differentiation::SD::Expression::get_RCP
const SymEngine::RCP< const SymEngine::Basic > & get_RCP() const
Definition: symengine_number_types.cc:234
Differentiation::SD::asech
Expression asech(const Expression &x)
Definition: symengine_math.cc:252
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Differentiation
Definition: numbers.h:645
Physics::Elasticity::Kinematics::b
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
Differentiation::SD::acot
Expression acot(const Expression &x)
Definition: symengine_math.cc:175
Differentiation::SD::abs
Expression abs(const Expression &x)
Definition: symengine_math.cc:266
symengine_math.h
Differentiation::SD::sin
Expression sin(const Expression &x)
Definition: symengine_math.cc:91
Differentiation::SD::cot
Expression cot(const Expression &x)
Definition: symengine_math.cc:126
Differentiation::SD::Expression
Definition: symengine_number_types.h:179
Differentiation::SD::ceil
Expression ceil(const Expression &x)
Definition: symengine_math.cc:301
Differentiation::SD::acosh
Expression acosh(const Expression &x)
Definition: symengine_math.cc:231
Differentiation::SD::sqrt
Expression sqrt(const Expression &x)
Definition: symengine_math.cc:49
value
static const bool value
Definition: dof_tools_constraints.cc:433
Differentiation::SD::pow
Expression pow(const Expression &base, const Expression &exponent)
Definition: symengine_math.cc:42
Differentiation::SD::asec
Expression asec(const Expression &x)
Definition: symengine_math.cc:168
Differentiation::SD::cbrt
Expression cbrt(const Expression &x)
Definition: symengine_math.cc:56
Utilities::MPI::min
T min(const T &t, const MPI_Comm &mpi_communicator)
Differentiation::SD::log
Expression log(const Expression &x)
Definition: symengine_math.cc:70
config.h
Differentiation::SD::sign
Expression sign(const Expression &x)
Definition: symengine_math.cc:280
Differentiation::SD::acsc
Expression acsc(const Expression &x)
Definition: symengine_math.cc:161
Differentiation::SD::acos
Expression acos(const Expression &x)
Definition: symengine_math.cc:140
Differentiation::SD::cos
Expression cos(const Expression &x)
Definition: symengine_math.cc:98
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Differentiation::SD::log10
Expression log10(const Expression &x)
Definition: symengine_math.cc:84
Differentiation::SD::sec
Expression sec(const Expression &x)
Definition: symengine_math.cc:119
Differentiation::SD::tan
Expression tan(const Expression &x)
Definition: symengine_math.cc:105
Differentiation::SD::exp
Expression exp(const Expression &exponent)
Definition: symengine_math.cc:63
Differentiation::SD::asin
Expression asin(const Expression &x)
Definition: symengine_math.cc:133
Utilities::MPI::max
T max(const T &t, const MPI_Comm &mpi_communicator)
DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition: config.h:372
Differentiation::SD::acsch
Expression acsch(const Expression &x)
Definition: symengine_math.cc:245