#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/std_cxx17/cmath.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/numerics/vector_tools.h>
-#include <gsl/gsl_sf_legendre.h>
-
#include <iostream>
#include "../tests.h"
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;
// 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
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/std_cxx17/cmath.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/numerics/vector_tools.h>
-#include <gsl/gsl_sf_legendre.h>
-
#include <iostream>
#include "../tests.h"
/**
- * 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
{
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;
}
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;
// coefficients.
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/std_cxx17/cmath.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/numerics/vector_tools.h>
-#include <gsl/gsl_sf_legendre.h>
-
#include <iostream>
#include "../tests.h"
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;
}
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/std_cxx17/cmath.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/numerics/smoothness_estimator.h>
#include <deal.II/numerics/vector_tools.h>
-#include <gsl/gsl_sf_legendre.h>
-
#include <iostream>
#include "../tests.h"
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;
}