Reference documentation for deal.II version 9.4.1
\(\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\}}\)
Loading...
Searching...
No Matches
cmath.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2018 - 2020 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.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15#ifndef dealii_cxx17_cmath_h
16#define dealii_cxx17_cmath_h
17
18#include <deal.II/base/config.h>
19
20#if defined(DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS) || \
21 defined(DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS)
22# include <cmath>
23#endif
24
25#ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
26# include <boost/math/special_functions/bessel.hpp>
27#endif
28
29#ifndef DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS
31
32# include <boost/math/special_functions/legendre.hpp>
33
34# include <limits>
35#endif
36
37
39
40namespace std_cxx17
41{
42#ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
43
44 inline double
45 cyl_bessel_j(double nu, double x)
46 {
47 return boost::math::cyl_bessel_j(nu, x);
48 }
49
50
51
52 inline float
53 cyl_bessel_jf(float nu, float x)
54 {
55 return boost::math::cyl_bessel_j(nu, x);
56 }
57
58
59
60 inline long double
61 cyl_bessel_jl(long double nu, long double x)
62 {
63 return boost::math::cyl_bessel_j(nu, x);
64 }
65
66#else
67 using std::cyl_bessel_j;
68 using std::cyl_bessel_jf;
69 using std::cyl_bessel_jl;
70#endif
71
72#ifndef DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS
73
74 inline double
75 legendre(unsigned int l, double x)
76 {
77 Assert(static_cast<int>(l) >= 0,
78 ExcIndexRange(l, 0, std::numeric_limits<int>::max()));
79 return boost::math::legendre_p(static_cast<int>(l), x);
80 }
81
82
83
84 inline float
85 legendre(unsigned int l, float x)
86 {
87 Assert(static_cast<int>(l) >= 0,
88 ExcIndexRange(l, 0, std::numeric_limits<int>::max()));
89 return boost::math::legendre_p(static_cast<int>(l), x);
90 }
91
92
93
94 inline long double
95 legendre(unsigned int l, long double x)
96 {
97 Assert(static_cast<int>(l) >= 0,
98 ExcIndexRange(l, 0, std::numeric_limits<int>::max()));
99 return boost::math::legendre_p(static_cast<int>(l), x);
100 }
101
102
103
104 inline float
105 legendref(unsigned int l, float x)
106 {
107 Assert(static_cast<int>(l) >= 0,
108 ExcIndexRange(l, 0, std::numeric_limits<int>::max()));
109 return boost::math::legendre_p(static_cast<int>(l), x);
110 }
111
112
113
114 inline long double
115 legendrel(unsigned int l, long double x)
116 {
117 Assert(static_cast<int>(l) >= 0,
118 ExcIndexRange(l, 0, std::numeric_limits<int>::max()));
119 return boost::math::legendre_p(static_cast<int>(l), x);
120 }
121
122#else
123 using std::legendre;
124 using std::legendref;
125 using std::legendrel;
126#endif
127} // namespace std_cxx17
128
129
131
132#endif // dealii_cxx17_cmath_h
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
#define Assert(cond, exc)
Definition: exceptions.h:1473
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
Definition: c++.h:141
float legendref(unsigned int l, float x)
Definition: cmath.h:105
long double legendrel(unsigned int l, long double x)
Definition: cmath.h:115
double legendre(unsigned int l, double x)
Definition: cmath.h:75