From b10e98d2abd213a9f674f3bc02b1c3bae813f3d6 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 22 Jul 2013 06:03:33 +0000 Subject: [PATCH] Simplify test case git-svn-id: https://svn.dealii.org/trunk@30087 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/gauss_lobatto.cc | 175 +----------------------------------- 1 file changed, 3 insertions(+), 172 deletions(-) diff --git a/tests/base/gauss_lobatto.cc b/tests/base/gauss_lobatto.cc index 69c56353da..466d3dfa36 100644 --- a/tests/base/gauss_lobatto.cc +++ b/tests/base/gauss_lobatto.cc @@ -15,11 +15,7 @@ // --------------------------------------------------------------------- - -// check accuracy of various quadrature formulas by using them to -// integrate polynomials of increasing degree, and finding the degree -// until which they integrate exactly - +// check points and weights for Gauss-Lobatto quadrature formula #include "../tests.h" #include @@ -27,170 +23,8 @@ #include #include -#include #include -template -void -fill_vector (std::vector *> &quadratures) -{ - quadratures.push_back (new QMidpoint()); - quadratures.push_back (new QTrapez()); - quadratures.push_back (new QSimpson()); - quadratures.push_back (new QMilne()); - quadratures.push_back (new QWeddle()); - for (unsigned int i=0; i<9; ++i) - { - quadratures.push_back (new QGauss(i)); - } - QMilne<1> q1d; - quadratures.push_back (new Quadrature(q1d)); - for (unsigned int i=2; i<8; ++i) - { - quadratures.push_back (new QGaussLobatto(i)); - } -} - -template -void -check_cells (std::vector*> &quadratures) -{ - Quadrature quadrature; - for (unsigned int n=0; n > &points=quadrature.get_points(); - const std::vector &weights=quadrature.get_weights(); - - deallog << "Quadrature no." << n; - - unsigned int i=0; - double quadrature_int=0; - double exact_int=0; - double err = 0; - - do - { - ++i; - - quadrature_int=0; - // Check the polynomial x^i*y^i - - for (unsigned int x=0; x(points[x](2)), i*1.0); - case 2: - f *= std::pow(static_cast(points[x](1)), i*1.0); - case 1: - f *= std::pow(static_cast(points[x](0)), i*1.0); - } - quadrature_int+=f*weights[x]; - } - - // the exact integral is 1/(i+1) - exact_int=1./std::pow(static_cast(i+1),dim); - err = std::fabs(quadrature_int-exact_int); - } - while (err<1e-14); - // Uncomment here for testing -// deallog << " (Int " << quadrature_int << ',' << exact_int << ")"; - deallog << " is exact for polynomials of degree " << i-1 << std::endl; - - if (dim==1) - { - // check the ordering of - // the quadrature points - bool in_order=true; - for (unsigned int x=1; x -void -check_faces (const std::vector*>& quadratures, const bool sub) -{ - if (sub) - deallog.push("subfaces"); - else - deallog.push("faces"); - - for (unsigned int n=0; n quadrature (sub == false? - QProjector::project_to_all_faces(*quadratures[n]) : - QProjector::project_to_all_subfaces(*quadratures[n])); - const std::vector > &points=quadrature.get_points(); - const std::vector &weights=quadrature.get_weights(); - - deallog << "Quadrature no." << n; - - unsigned int i=0; - long double quadrature_int=0; - double exact_int=0; - double err = 0; - - do - { - ++i; - - quadrature_int=0; - // Check the polynomial - // x^i*y^i*z^i - - for (unsigned int x=0; x