From: bangerth Date: Tue, 9 Jul 2013 21:39:19 +0000 (+0000) Subject: Undo accidental part of previous patch. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fa454f3e9c1ff249435a59c19fd8b625fbafe6a;p=dealii-svn.git Undo accidental part of previous patch. git-svn-id: https://svn.dealii.org/trunk@29960 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/project_common.h b/tests/deal.II/project_common.h index e3196d4155..09b0f2cc2e 100644 --- a/tests/deal.II/project_common.h +++ b/tests/deal.II/project_common.h @@ -136,12 +136,9 @@ void do_project (const Triangulation &triangulation, if (q<=p-order_difference) if (error.l2_norm() > 1e-10*projection.l2_norm()) - { deallog << "Projection failed with relative error " << error.l2_norm() / projection.l2_norm() << std::endl; - Assert (false, ExcInternalError()); - } } } diff --git a/tests/deal.II/project_q_01.cc b/tests/deal.II/project_q_01.cc index 607cb56221..e2ea51574e 100644 --- a/tests/deal.II/project_q_01.cc +++ b/tests/deal.II/project_q_01.cc @@ -14,152 +14,10 @@ // check that VectorTools::project works for Q elements correctly -#include "../tests.h" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - char logname[] = "project_q_01/output"; -template -class F : public Function -{ - public: - F (const unsigned int q, - const unsigned int n_components) - : - Function(n_components), - q(q) - {} - - virtual double value (const Point &p, - const unsigned int component) const - { - Assert ((component == 0) && (this->n_components == 1), - ExcInternalError()); - double val = 0; - for (unsigned int d=0; d &p, - Vector &v) const - { - for (unsigned int c=0; c -void do_project (const Triangulation &triangulation, - const FiniteElement &fe, - const unsigned int p, - const unsigned int order_difference) -{ - DoFHandler dof_handler(triangulation); - dof_handler.distribute_dofs (fe); - - deallog << "n_dofs=" << dof_handler.n_dofs() << std::endl; - - ConstraintMatrix constraints; - DoFTools::make_hanging_node_constraints (dof_handler, - constraints); - constraints.close (); - - Vector projection (dof_handler.n_dofs()); - Vector error (triangulation.n_active_cells()); - for (unsigned int q=0; q<=p+2-order_difference; ++q) - { - // project the function - VectorTools::project (dof_handler, - constraints, - QGauss(p+2), - F (q, fe.n_components()), - projection); - // just to make sure it doesn't get - // forgotten: handle hanging node - // constraints - constraints.distribute (projection); - - // then compute the interpolation error - VectorTools::integrate_difference (dof_handler, - projection, - F (q, fe.n_components()), - error, - QGauss(std::max(p,q)+1), - VectorTools::L2_norm); - deallog << fe.get_name() << ", P_" << q - << ", rel. error=" << error.l2_norm() / projection.l2_norm() - << std::endl; - - if (q<=p-order_difference) - if (error.l2_norm() > 1e-10*projection.l2_norm()) - { - deallog << "Projection failed with relative error " - << error.l2_norm() / projection.l2_norm() - << std::endl; - Assert (false, ExcInternalError()); - } - } -} - - - -// check the given element of polynomial order p. the last parameter, if -// given, denotes a gap in convergence order; for example, the Nedelec element -// of polynomial degree p has normal components of degree p-1 and therefore -// can only represent polynomials of degree p-1 exactly. the gap is then 1. -template -void test_no_hanging_nodes (const FiniteElement &fe, - const unsigned int p, - const unsigned int order_difference = 0) -{ - Triangulation triangulation; - GridGenerator::hyper_cube (triangulation); - triangulation.refine_global (3); - - do_project (triangulation, fe, p, order_difference); -} - +#include "project_common.h" template @@ -168,18 +26,3 @@ void test () for (unsigned int p=1; p<6-dim; ++p) test_no_hanging_nodes (FE_Q(p), p); } - - -int main () -{ - std::ofstream logfile(logname); - deallog << std::setprecision (3); - - deallog.attach(logfile); - deallog.depth_console(0); - deallog.threshold_double(1.e-10); - - test<1>(); - test<2>(); - test<3>(); -}