From 420a64613d7591d0cd720bfaf97279af5426a306 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 24 Oct 2010 15:30:42 +0000 Subject: [PATCH] Move a utility function out of a class that had only a single (static) member and into the surrounding namespace. git-svn-id: https://svn.dealii.org/trunk@22450 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/polynomial.h | 76 +++++++++++--------------- deal.II/base/source/polynomial.cc | 2 +- deal.II/deal.II/source/fe/fe_dgq.cc | 2 +- deal.II/deal.II/source/fe/fe_q.cc | 6 +- 4 files changed, 38 insertions(+), 48 deletions(-) diff --git a/deal.II/base/include/base/polynomial.h b/deal.II/base/include/base/polynomial.h index 274c311cb8..4b98d27b66 100644 --- a/deal.II/base/include/base/polynomial.h +++ b/deal.II/base/include/base/polynomial.h @@ -80,7 +80,7 @@ namespace Polynomials * an illegal object. */ Polynomial (); - + /** * Return the value of this * polynomial at the given point. @@ -90,7 +90,7 @@ namespace Polynomials * of the evaluation. */ number value (const number x) const; - + /** * Return the values and the * derivatives of the @@ -194,12 +194,12 @@ namespace Polynomials * Add a second polynomial. */ Polynomial& operator += (const Polynomial& p); - + /** * Subtract a second polynomial. */ Polynomial& operator -= (const Polynomial& p); - + /** * Print coefficients. */ @@ -227,7 +227,7 @@ namespace Polynomials */ static void multiply (std::vector& coefficients, const number factor); - + /** * Coefficients of the polynomial * $\sum_i a_i x^i$. This vector @@ -251,8 +251,7 @@ namespace Polynomials * @author Guido Kanschat, 2004 */ template - class Monomial : - public Polynomial + class Monomial : public Polynomial { public: /** @@ -279,7 +278,7 @@ namespace Polynomials static std::vector > generate_complete_basis (const unsigned int degree); - + private: /** * Needed by constructor. @@ -287,7 +286,7 @@ namespace Polynomials static std::vector make_vector(unsigned int n, const double coefficient); }; - + /** * Lagrange polynomials with equidistant interpolation points in @@ -341,7 +340,7 @@ namespace Polynomials static std::vector > generate_complete_basis (const unsigned int degree); - + private: /** @@ -359,31 +358,22 @@ namespace Polynomials std::vector& a); }; -/** - * Lagrange polynomials for an arbistrary set of interpolation points. - * - * @author Guido Kanschat, 2005 - */ - class Lagrange - { - public: - /** - * Given a set of points, this - * function returns all - * Lagrange polynomials for - * interpolation of these - * points. The number of - * polynomials is equal to the - * number of points and the - * maximum degree is one less. - */ - static - std::vector > - generate_complete_basis (const std::vector >& points); - }; - - - + + /** + * Given a set of points along the + * real axis, this function returns + * all Lagrange polynomials for + * interpolation of these + * points. The number of + * polynomials is equal to the + * number of points and the maximum + * degree is one less. + */ + std::vector > + generate_complete_Lagrange_basis (const std::vector >& points); + + + /** * Legendre polynomials of arbitrary degree on [0,1]. * @@ -420,7 +410,7 @@ namespace Polynomials static std::vector > generate_complete_basis (const unsigned int degree); - + private: /** * Coefficients for the interval $[0,1]$. @@ -441,12 +431,12 @@ namespace Polynomials * the global destructor is called. */ static std::vector > > recursive_coefficients; - + /** * Compute coefficients recursively. */ static void compute_coefficients (const unsigned int p); - + /** * Get coefficients for * constructor. This way, it can @@ -507,7 +497,7 @@ namespace Polynomials std::vector compute_coefficients (const unsigned int p); }; - + /** * Hierarchical polynomials of arbitrary degree on [0,1]. * @@ -581,7 +571,7 @@ namespace Polynomials static std::vector > generate_complete_basis (const unsigned int degree); - + private: /** * Compute coefficients recursively. @@ -597,9 +587,9 @@ namespace Polynomials */ static const std::vector & get_coefficients (const unsigned int p); - + static std::vector *> recursive_coefficients; - }; + }; } /** @} */ @@ -612,7 +602,7 @@ namespace Polynomials inline Polynomial::Polynomial () {} - + template inline unsigned int diff --git a/deal.II/base/source/polynomial.cc b/deal.II/base/source/polynomial.cc index fe39146858..4dd58d8c0e 100644 --- a/deal.II/base/source/polynomial.cc +++ b/deal.II/base/source/polynomial.cc @@ -646,7 +646,7 @@ namespace Polynomials std::vector > - Lagrange::generate_complete_basis (const std::vector >& points) + generate_complete_Lagrange_basis (const std::vector >& points) { std::vector > p(points.size()); // polynomials are built as diff --git a/deal.II/deal.II/source/fe/fe_dgq.cc b/deal.II/deal.II/source/fe/fe_dgq.cc index 8f1176535f..6afd3a0832 100644 --- a/deal.II/deal.II/source/fe/fe_dgq.cc +++ b/deal.II/deal.II/source/fe/fe_dgq.cc @@ -196,7 +196,7 @@ template FE_DGQ::FE_DGQ (const Quadrature<1>& points) : FE_Poly, dim, spacedim> ( - TensorProductPolynomials(Polynomials::Lagrange::generate_complete_basis(points.get_points())), + TensorProductPolynomials(Polynomials::generate_complete_Lagrange_basis(points.get_points())), FiniteElementData(get_dpo_vector(points.size()-1), 1, points.size()-1, FiniteElementData::L2), std::vector(FiniteElementData(get_dpo_vector(points.size()-1),1, points.size()-1).dofs_per_cell, true), std::vector >(FiniteElementData( diff --git a/deal.II/deal.II/source/fe/fe_q.cc b/deal.II/deal.II/source/fe/fe_q.cc index 049a262235..e924afe60c 100644 --- a/deal.II/deal.II/source/fe/fe_q.cc +++ b/deal.II/deal.II/source/fe/fe_q.cc @@ -300,7 +300,7 @@ struct FE_Q::Implementation // destination (child) and source (mother) // dofs. const std::vector > polynomials= - Polynomials::Lagrange::generate_complete_basis(points.get_points()); + Polynomials::generate_complete_Lagrange_basis(points.get_points()); fe.interface_constraints .TableBase<2,double>::reinit (fe.interface_constraints_size()); @@ -429,7 +429,7 @@ struct FE_Q::Implementation // dofs. const unsigned int pnts=(fe.degree+1)*(fe.degree+1); const std::vector > polynomial_basis= - Polynomials::Lagrange::generate_complete_basis(points.get_points()); + Polynomials::generate_complete_Lagrange_basis(points.get_points()); const TensorProductPolynomials face_polynomials(polynomial_basis); @@ -587,7 +587,7 @@ template FE_Q::FE_Q (const Quadrature<1> &points) : FE_Poly, dim, spacedim> ( - TensorProductPolynomials(Polynomials::Lagrange::generate_complete_basis(points.get_points())), + TensorProductPolynomials(Polynomials::generate_complete_Lagrange_basis(points.get_points())), FiniteElementData(get_dpo_vector(points.n_quadrature_points-1), 1, points.n_quadrature_points-1, FiniteElementData::H1), -- 2.39.5