From 9a97b22c25297497682cde44f9853328ba585815 Mon Sep 17 00:00:00 2001 From: grahambenharper Date: Sun, 1 Sep 2019 15:06:02 -0600 Subject: [PATCH] Update PolynomialsBDM degree and pass the degree to the base class constructor --- include/deal.II/base/polynomials_bdm.h | 15 --------------- source/base/polynomials_bdm.cc | 5 +++-- tests/base/polynomials_bdm_01.cc | 8 ++++---- tests/base/polynomials_bdm_02.cc | 10 +++++----- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/include/deal.II/base/polynomials_bdm.h b/include/deal.II/base/polynomials_bdm.h index 4e8219ecfd..7e4cd085a7 100644 --- a/include/deal.II/base/polynomials_bdm.h +++ b/include/deal.II/base/polynomials_bdm.h @@ -131,13 +131,6 @@ public: std::vector> &third_derivatives, std::vector> &fourth_derivatives) const override; - /** - * Return the degree of the BDM space, which is one less than the highest - * polynomial degree. - */ - unsigned int - degree() const; - /** * Return the name of the space, which is BDM. */ @@ -203,14 +196,6 @@ private: }; -template -inline unsigned int -PolynomialsBDM::degree() const -{ - return polynomial_space.degree() - 1; -} - - template inline std::string PolynomialsBDM::name() const diff --git a/source/base/polynomials_bdm.cc b/source/base/polynomials_bdm.cc index 80a2abe0c1..953201b086 100644 --- a/source/base/polynomials_bdm.cc +++ b/source/base/polynomials_bdm.cc @@ -28,7 +28,7 @@ DEAL_II_NAMESPACE_OPEN template PolynomialsBDM::PolynomialsBDM(const unsigned int k) - : TensorPolynomialsBase(k, n_polynomials(k)) + : TensorPolynomialsBase(k + 1, n_polynomials(k)) , polynomial_space(Polynomials::Legendre::generate_complete_basis(k)) , monomials((dim == 2) ? (1) : (k + 2)) , p_values(polynomial_space.n()) @@ -193,7 +193,8 @@ PolynomialsBDM::evaluate( // p(t) = t^(i+1) monomials[i + 1].value(unit_point(d), monovali[d]); // q(t) = t^(k-i) - monomials[degree() - i].value(unit_point(d), monovalk[d]); + monomials[this->degree() - 1 - i].value(unit_point(d), + monovalk[d]); } if (values.size() != 0) { diff --git a/tests/base/polynomials_bdm_01.cc b/tests/base/polynomials_bdm_01.cc index 093185cf83..bc4043b459 100644 --- a/tests/base/polynomials_bdm_01.cc +++ b/tests/base/polynomials_bdm_01.cc @@ -32,7 +32,7 @@ void plot(const PolynomialsBDM &poly) { QTrapez<1> base_quadrature; - QIterated quadrature(base_quadrature, poly.degree() + 4); + QIterated quadrature(base_quadrature, poly.degree() + 3); std::vector> values(poly.n()); std::vector> grads; std::vector> grads2; @@ -41,10 +41,10 @@ plot(const PolynomialsBDM &poly) for (unsigned int k = 0; k < quadrature.size(); ++k) { - if (k % (poly.degree() + 5) == 0) - deallog << "BDM" << poly.degree() << '<' << dim << '>' << std::endl; + if (k % (poly.degree() + 4) == 0) + deallog << "BDM" << poly.degree() - 1 << '<' << dim << '>' << std::endl; - deallog << "BDM" << poly.degree() << '<' << dim << '>' << '\t' + deallog << "BDM" << poly.degree() - 1 << '<' << dim << '>' << '\t' << quadrature.point(k); poly.evaluate( quadrature.point(k), values, grads, grads2, thirds, fourths); diff --git a/tests/base/polynomials_bdm_02.cc b/tests/base/polynomials_bdm_02.cc index 68834f1cdb..6c3a0dcbb6 100644 --- a/tests/base/polynomials_bdm_02.cc +++ b/tests/base/polynomials_bdm_02.cc @@ -32,7 +32,7 @@ void plot(const PolynomialsBDM &poly) { const PolynomialSpace legendre_poly_space = - Polynomials::Legendre::generate_complete_basis(poly.degree()); + Polynomials::Legendre::generate_complete_basis(poly.degree() - 1); const Point<3> p0(0, 0, 0); const Point<3> p1(0.25, 0.5, 0.75); @@ -57,16 +57,16 @@ plot(const PolynomialsBDM &poly) for (unsigned int k = 0; k < points.size(); ++k) { - if (k % (poly.degree() + 4) == 0) - deallog << "BDM" << poly.degree() << '<' << dim << '>' << std::endl; + if (k % (poly.degree() + 3) == 0) + deallog << "BDM" << poly.degree() - 1 << '<' << dim << '>' << std::endl; unsigned int start = dim * n_sub; - deallog << "BDM" << poly.degree() << '<' << dim << '>' << points[k] + deallog << "BDM" << poly.degree() - 1 << '<' << dim << '>' << points[k] << std::endl; poly.evaluate(points[k], values, grads, grads2, thirds, fourths); - for (unsigned int i = 0; i < poly.degree() + 1; ++i, start += dim) + for (unsigned int i = 0; i < poly.degree(); ++i, start += dim) for (unsigned int j = 0; j < dim; ++j) { for (unsigned int d1 = 0; d1 < dim; ++d1) -- 2.39.5