MathUtils.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef MATHUTILS_H
8 #define MATHUTILS_H
9
10 #include "Moose.h"
11 #include "libmesh/libmesh.h"
12 #include "libmesh/utility.h"
13
14 namespace MathUtils
15 {
16
17 inline Real
18 round(Real x)
19 {
20  return ::round(x); // use round from math.h
21 }
22
23 inline Real
24 sign(Real x)
25 {
26  return x >= 0.0 ? 1.0 : -1.0;
27 }
28
29 Real poly1Log(Real x, Real tol, int deriv);
30 Real poly2Log(Real x, Real tol, int deriv);
31 Real poly3Log(Real x, Real tol, int order);
32 Real poly4Log(Real x, Real tol, int order);
33 Real taylorLog(Real x);
34
35 Real pow(Real x, unsigned int e);
36
37 inline Real
38 heavyside(Real x)
39 {
40  return x < 0.0 ? 0.0 : 1.0;
41 }
42 inline Real
43 positivePart(Real x)
44 {
45  return x > 0.0 ? x : 0.0;
46 }
47 inline Real
48 negativePart(Real x)
49 {
50  return x < 0.0 ? x : 0.0;
51 }
52
53 } // namespace MathUtils
54
55 #endif // MATHUTILS_H
Real heavyside(Real x)
Definition: MathUtils.h:38
Real sign(Real x)
Definition: MathUtils.h:24
Real round(Real x)
Definition: MathUtils.h:18
Real poly1Log(Real x, Real tol, int deriv)
Definition: MathUtils.C:15
Real poly3Log(Real x, Real tol, int order)
Definition: MathUtils.C:96
Real pow(Real x, unsigned int e)
Definition: MathUtils.C:209
Real poly2Log(Real x, Real tol, int deriv)
Definition: MathUtils.C:55
Real poly4Log(Real x, Real tol, int order)
Definition: MathUtils.C:137
Real taylorLog(Real x)
Definition: MathUtils.C:194
static const double tol
Definition: XFEMFuncs.h:26
Real negativePart(Real x)
Definition: MathUtils.h:48
Real positivePart(Real x)
Definition: MathUtils.h:43