From: wolf Date: Wed, 11 Apr 2001 22:16:51 +0000 (+0000) Subject: New test: dof_renumbering. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dfdffe2c9c3f52c2a327e37f5b24787b7adfe0f;p=dealii-svn.git New test: dof_renumbering. git-svn-id: https://svn.dealii.org/trunk@4442 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/Makefile.in b/tests/deal.II/Makefile.in index 52f4f5971a..6ff2594c72 100644 --- a/tests/deal.II/Makefile.in +++ b/tests/deal.II/Makefile.in @@ -28,6 +28,7 @@ data_out.exe : data_out.go $(lib-2d) $ derivative_approximation.exe : derivative_approximation.go $(lib-1d) $(lib-2d) $(lib-3d) $(libraries) derivatives.exe : derivatives.go $(lib-1d) $(lib-2d) $(lib-3d) $(libraries) dof_test.exe : dof_test.go $(lib-2d) $(lib-3d) $(libraries) +dof_renumbering.exe : dof_renumbering.go $(lib-1d) $(lib-2d) $(lib-3d) $(libraries) error_estimator.exe : error_estimator.go $(lib-1d) $(lib-2d) $(lib-3d) $(libraries) gradients.exe : gradients.go $(lib-2d) $(libraries) grid_test.exe : grid_test.go $(lib-2d) $(lib-3d) $(libraries) @@ -44,7 +45,7 @@ wave-test-3.exe : wave-test-3.go $(lib-2d) tests = grid_test dof_test data_out derivatives gradients constraints mg \ mglocal block_matrices second_derivatives derivative_approximation \ matrices error_estimator intergrid_constraints intergrid_map \ - wave-test-3 + wave-test-3 dof_renumbering ############################################################ diff --git a/tests/deal.II/dof_renumbering.cc b/tests/deal.II/dof_renumbering.cc new file mode 100644 index 0000000000..65f4100525 --- /dev/null +++ b/tests/deal.II/dof_renumbering.cc @@ -0,0 +1,109 @@ +//---------------------------- dof_renumbering.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2000, 2001 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_renumbering.cc --------------------------- + + +/* Author: Wolfgang Bangerth, University of Heidelberg, 2001 */ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +template +void +print_dofs (const DoFHandler &dof) +{ + std::vector v (dof.get_fe().dofs_per_cell); + for (typename DoFHandler::active_cell_iterator cell=dof.begin_active(); + cell != dof.end(); ++cell) + { + deallog << "Cell " << cell << std::endl; + cell->get_dof_indices (v); + for (unsigned int i=0; i +void +check () +{ + CosineFunction cosine; + + Triangulation tr; + if (dim==2) + GridGenerator::hyper_ball(tr); + else + GridGenerator::hyper_cube(tr, -1,1); + tr.refine_global (1); + tr.begin_active()->set_refine_flag (); + tr.execute_coarsening_and_refinement (); + if (dim==1) + tr.refine_global(2); + + FESystem element (FE_Q(3), 2, FE_DGQ(1), 1); + DoFHandler dof(tr); + dof.distribute_dofs(element); + + print_dofs (dof); + + DoFRenumbering::Cuthill_McKee (dof); print_dofs (dof); + DoFRenumbering::Cuthill_McKee (dof, true); print_dofs (dof); + DoFRenumbering::Cuthill_McKee (dof, true, true); print_dofs (dof); + + std::vector order(element.n_components()); + for (unsigned int i=0; i selected_dofs (dof.n_dofs(), false); + for (unsigned int i=0; i (); + deallog.pop (); + deallog.push ("2d"); + check<2> (); + deallog.pop (); + deallog.push ("3d"); + check<3> (); + deallog.pop (); +}