From: kayser-herold Date: Fri, 4 Aug 2006 20:56:04 +0000 (+0000) Subject: Added a new dof_tools testcase, which leads to a couple X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f56eb9d3a8f874c1c0b3cd9bc693a91cfda903d8;p=dealii-svn.git Added a new dof_tools testcase, which leads to a couple of internal errors. One of the errors is in VectorTools::project which leads to problems when used in 1D. The second is somehow related to the make_hanging_nodes procedure. git-svn-id: https://svn.dealii.org/trunk@13602 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/dof_tools_19.cc b/tests/bits/dof_tools_19.cc new file mode 100644 index 0000000000..79dc547544 --- /dev/null +++ b/tests/bits/dof_tools_19.cc @@ -0,0 +1,71 @@ +//---------------------------- dof_tools_3.cc --------------------------- +// $Id: dof_tools_03.cc 11749 2005-11-09 19:11:20Z wolf $ +// Version: $Name$ +// +// Copyright (C) 2003, 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- dof_tools_3.cc --------------------------- + +#include "../tests.h" +#include "dof_tools_common.cc" +#include +#include +#include +#include +#include +#include + +// check +// DoFTools:: +// make_hanging_node_constraints (const DoFHandler &, +// ConstraintMatrix &); +// +// As the results of dof_tools_03 seem unclear, this test aims +// at verifying the constraints by projecting a constant function +// onto the FE space and afterwards evaluating the L_2 error. +// This should reveal errors in the constraint matrix. + +std::string output_file_name = "dof_tools_19/output"; + + +template +void +check_this (const DoFHandler &dof_handler) +{ + ConstantFunction test_func (1, dof_handler.get_fe().n_components ()); + + // don't run this test if hanging + // nodes are not implemented + if (dof_handler.get_fe().constraints_are_implemented() == false) + return; + + ConstraintMatrix cm; + DoFTools::make_hanging_node_constraints (dof_handler, cm); + cm.close (); + + deallog << cm.n_constraints () << std::endl; + deallog << cm.max_constraint_indirections () << std::endl; + + // L_2 project constant function onto field + QGauss quadrature (6); + Vector solution (dof_handler.n_dofs ()); + + VectorTools::project (dof_handler, cm, + quadrature, test_func, + solution); + cm.distribute (solution); + + // Evaluate error + Vector cellwise_errors (dof_handler.get_tria ().n_active_cells()); + VectorTools::integrate_difference (dof_handler, solution, test_func, + cellwise_errors, quadrature, + VectorTools::L2_norm); + const double p_l2_error = cellwise_errors.l2_norm(); + + deallog << "L2_Error : " << p_l2_error << std::endl; +}