From 7faca3c42354e69187ebb65199ec5545ae0850e7 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 22 Jan 2021 20:48:46 -0700 Subject: [PATCH] Replace gsl_sf_legendre_Pl withstc_cxx17::legendre in tests. --- tests/fe/fe_series_02.cc | 7 +++---- tests/fe/fe_series_04.cc | 13 ++++++------- tests/fe/fe_series_05.cc | 7 +++---- tests/numerics/smoothness_estimator_01.cc | 7 +++---- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/fe/fe_series_02.cc b/tests/fe/fe_series_02.cc index ac1b0a84cc..f008bb17d1 100644 --- a/tests/fe/fe_series_02.cc +++ b/tests/fe/fe_series_02.cc @@ -18,6 +18,7 @@ #include #include +#include #include @@ -33,8 +34,6 @@ #include -#include - #include #include "../tests.h" @@ -75,12 +74,12 @@ LegendreFunction::value(const dealii::Point &point, double f = 0.0; - for (int l = 0; l < int(coefficients.size()); l++) + for (unsigned int l = 0; l < coefficients.size(); ++l) { const double m = 0.5; // mid-point const double h = 0.5; // half-length const double x = (point[0] - m) / h; // 1D only - f += sqrt(1.0 / h) * gsl_sf_legendre_Pl(l, x) * coefficients[l]; + f += sqrt(1.0 / h) * std_cxx17::legendre(l, x) * coefficients[l]; } return f; diff --git a/tests/fe/fe_series_04.cc b/tests/fe/fe_series_04.cc index 37aa20627a..b361924b85 100644 --- a/tests/fe/fe_series_04.cc +++ b/tests/fe/fe_series_04.cc @@ -15,7 +15,7 @@ // Test Legendre expansion in 1D for quadratic function coming from FE. -// Also test that our interpretation of GSL function is correct to have +// Also test that our interpretation of Legendre function is correct to have // an orthogonal basis. // MWE in Maxima @@ -35,6 +35,7 @@ bfloat(C(3)), nouns; #include #include +#include #include @@ -50,8 +51,6 @@ bfloat(C(3)), nouns; #include -#include - #include #include "../tests.h" @@ -152,7 +151,7 @@ test(const LegendreFunction &func, const unsigned int poly_degree) /** - * Small test to first output Legendre coefficients from GSL at -1,0,1 + * Small test to first output Legendre coefficients at -1,0,1 * and then check that they are orthonormal */ void @@ -164,7 +163,7 @@ test_legendre_orthonormal(const unsigned int N) { deallog << "l=" << l << ": "; for (double x = -1.0; x <= 1.0; x += 1.0) - deallog << gsl_sf_legendre_Pl(l, x) << " "; + deallog << std_cxx17::legendre(l, x) << " "; deallog << std::endl; } @@ -182,8 +181,8 @@ test_legendre_orthonormal(const unsigned int N) const double h = 0.5; // half-length const double x = (x_q[0] - m) / h; // 1D only Assert(std::fabs(x) < 1.0, dealii::ExcInternalError()); - const double L1 = std::sqrt(1.0 / h) * gsl_sf_legendre_Pl(k1, x); - const double L2 = std::sqrt(1.0 / h) * gsl_sf_legendre_Pl(k2, x); + const double L1 = std::sqrt(1.0 / h) * std_cxx17::legendre(k1, x); + const double L2 = std::sqrt(1.0 / h) * std_cxx17::legendre(k2, x); ortho += L1 * L2 * quadrature.weight(q); } ortho *= (1.0 + k1 + k2) / 2.0; diff --git a/tests/fe/fe_series_05.cc b/tests/fe/fe_series_05.cc index 30d0e2ecb6..a171ad6386 100644 --- a/tests/fe/fe_series_05.cc +++ b/tests/fe/fe_series_05.cc @@ -18,6 +18,7 @@ // coefficients. #include #include +#include #include @@ -33,8 +34,6 @@ #include -#include - #include #include "../tests.h" @@ -73,8 +72,8 @@ Lh(const Point &x_q, const TableIndices &indices) const double x = 2.0 * (x_q[d] - 0.5); Assert((x_q[d] <= 1.0) && (x_q[d] >= 0.), ExcMessage("x_q is not in [0,1]" + Utilities::to_string(x_q[d]))); - const int ind = indices[d]; - res *= sqrt(2.0) * gsl_sf_legendre_Pl(ind, x); + const unsigned int ind = indices[d]; + res *= sqrt(2.0) * std_cxx17::legendre(ind, x); } return res; } diff --git a/tests/numerics/smoothness_estimator_01.cc b/tests/numerics/smoothness_estimator_01.cc index ddb576c32e..acb0cf48f8 100644 --- a/tests/numerics/smoothness_estimator_01.cc +++ b/tests/numerics/smoothness_estimator_01.cc @@ -20,6 +20,7 @@ #include #include +#include #include @@ -37,8 +38,6 @@ #include #include -#include - #include #include "../tests.h" @@ -82,8 +81,8 @@ Lh(const Point &x_q, const TableIndices &indices) const double x = 2.0 * (x_q[d] - 0.5); Assert((x_q[d] <= 1.0) && (x_q[d] >= 0.), ExcMessage("x_q is not in [0,1]" + Utilities::to_string(x_q[d]))); - const int ind = indices[d]; - res *= sqrt(2.0) * gsl_sf_legendre_Pl(ind, x); + const unsigned int ind = indices[d]; + res *= sqrt(2.0) * std_cxx17::legendre(ind, x); } return res; } -- 2.39.5