| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2018 - 2024 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
#ifndef dealii_cxx17_cmath_h |
| 15 |
#define dealii_cxx17_cmath_h |
| 16 |
|
| 17 |
#include <deal.II/base/config.h> |
| 18 |
|
| 19 |
#if defined(DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS) || \ |
| 20 |
defined(DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS) |
| 21 |
# include <cmath> |
| 22 |
#endif |
| 23 |
|
| 24 |
#ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS |
| 25 |
# include <boost/math/special_functions/bessel.hpp> |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifndef DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS |
| 29 |
# include <deal.II/base/exceptions.h> |
| 30 |
|
| 31 |
# include <boost/math/special_functions/legendre.hpp> |
| 32 |
|
| 33 |
# include <limits> |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
DEAL_II_NAMESPACE_OPEN |
| 38 |
|
| 39 |
namespace std_cxx17 |
| 40 |
{ |
| 41 |
#ifndef DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS |
| 42 |
|
| 43 |
inline double |
| 44 |
cyl_bessel_j(double nu, double x) |
| 45 |
{ |
| 46 |
return boost::math::cyl_bessel_j(nu, x); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
inline float |
| 52 |
cyl_bessel_jf(float nu, float x) |
| 53 |
{ |
| 54 |
return boost::math::cyl_bessel_j(nu, x); |
| 55 |
} |
| 56 |
|
| 57 |
#else |
| 58 |
using std::cyl_bessel_j; |
| 59 |
using std::cyl_bessel_jf; |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifndef DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS |
| 63 |
|
| 64 |
inline double |
| 65 |
legendre(unsigned int l, double x) |
| 66 |
{ |
| 67 |
Assert(static_cast<int>(l) >= 0, |
| 68 |
ExcIndexRange(l, 0, std::numeric_limits<int>::max())); |
| 69 |
return boost::math::legendre_p(static_cast<int>(l), x); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
inline float |
| 75 |
legendre(unsigned int l, float 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 |
legendref(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 |
#else |
| 93 |
using std::legendre; |
| 94 |
using std::legendref; |
| 95 |
#endif |
| 96 |
} // namespace std_cxx17 |
| 97 |
|
| 98 |
|
| 99 |
DEAL_II_NAMESPACE_CLOSE |
| 100 |
|
| 101 |
#endif // dealii_cxx17_cmath_h |