From: Timo Heister Date: Thu, 21 Nov 2013 21:31:42 +0000 (+0000) Subject: add test for issue 154 fixed in r31734 X-Git-Tag: v8.1.0~214 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19168efae5ad6ebd918d52740115aa6094b414a4;p=dealii.git add test for issue 154 fixed in r31734 git-svn-id: https://svn.dealii.org/trunk@31752 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/make_boundary_constraints_03.cc b/tests/bits/make_boundary_constraints_03.cc new file mode 100644 index 0000000000..9ba4455c91 --- /dev/null +++ b/tests/bits/make_boundary_constraints_03.cc @@ -0,0 +1,132 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2009 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// bug: https://code.google.com/p/dealii/issues/detail?id=154 +// fixed in r31734 + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +template +void test () +{ + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, -1, 1); + + FESystem fe(FE_Q<2>(1),1,FE_Q<2>(2),2); + + deallog << "Number of cells: " + << triangulation.n_active_cells() << std::endl; + + DoFHandler dof_handler (triangulation); + dof_handler.distribute_dofs (fe); + //DoFRenumbering::component_wise(dof_handler); + deallog << "Number of dofs: " + << dof_handler.n_dofs() << std::endl; + + ConstraintMatrix constraints; + FEValuesExtractors::Vector velocities(1); + ComponentMask mask = fe.component_mask (velocities); + + deallog << "ComponentMask " << mask[0] << mask[1] << mask[2] << std::endl; + DoFTools::make_zero_boundary_constraints(dof_handler, constraints, mask); + constraints.close(); + deallog << "Number of Constraints: " << constraints.n_constraints()< quadrature_formula(fe.get_unit_support_points()); + FEValues<2> fe_values (fe, quadrature_formula, + update_values | update_gradients | update_JxW_values|update_q_points); + + const unsigned int dofs_per_cell = fe.dofs_per_cell; + std::vector local_dof_indices (dofs_per_cell); + + DoFHandler<2>::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + { + fe_values.reinit (cell); + + std::vector > locations = fe_values.get_quadrature_points(); + cell->get_dof_indices (local_dof_indices); + + for (unsigned int i=0; i (); + } + catch (std::exception &exc) + { + deallog << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + deallog << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + deallog << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/bits/make_boundary_constraints_03.output b/tests/bits/make_boundary_constraints_03.output new file mode 100644 index 0000000000..5cb4d3e8f1 --- /dev/null +++ b/tests/bits/make_boundary_constraints_03.output @@ -0,0 +1,21 @@ + +DEAL::Number of cells: 1 +DEAL::Number of dofs: 22 +DEAL::ComponentMask 011 +DEAL::Number of Constraints: 16 +DEAL::DoF 1, copy 0, base element 1, index 0, position -1.00000 -1.00000 +DEAL::DoF 2, copy 1, base element 1, index 0, position -1.00000 -1.00000 +DEAL::DoF 4, copy 0, base element 1, index 1, position 1.00000 -1.00000 +DEAL::DoF 5, copy 1, base element 1, index 1, position 1.00000 -1.00000 +DEAL::DoF 7, copy 0, base element 1, index 2, position -1.00000 1.00000 +DEAL::DoF 8, copy 1, base element 1, index 2, position -1.00000 1.00000 +DEAL::DoF 10, copy 0, base element 1, index 3, position 1.00000 1.00000 +DEAL::DoF 11, copy 1, base element 1, index 3, position 1.00000 1.00000 +DEAL::DoF 12, copy 0, base element 1, index 4, position -1.00000 0.00000 +DEAL::DoF 13, copy 1, base element 1, index 4, position -1.00000 0.00000 +DEAL::DoF 14, copy 0, base element 1, index 5, position 1.00000 0.00000 +DEAL::DoF 15, copy 1, base element 1, index 5, position 1.00000 0.00000 +DEAL::DoF 16, copy 0, base element 1, index 6, position 0.00000 -1.00000 +DEAL::DoF 17, copy 1, base element 1, index 6, position 0.00000 -1.00000 +DEAL::DoF 18, copy 0, base element 1, index 7, position 0.00000 1.00000 +DEAL::DoF 19, copy 1, base element 1, index 7, position 0.00000 1.00000