From: guido Date: Fri, 9 Jun 2006 07:33:39 +0000 (+0000) Subject: add a directory with useful functions for tests X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=955fa39e578891585553cfbfc703d411bbaea5ac;p=dealii-svn.git add a directory with useful functions for tests git-svn-id: https://svn.dealii.org/trunk@13212 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lib/dof_tools_frame.h b/tests/lib/dof_tools_frame.h new file mode 100644 index 0000000000..859389e45e --- /dev/null +++ b/tests/lib/dof_tools_frame.h @@ -0,0 +1,127 @@ +//---------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003, 2004, 2005, 2006 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. +// +//---------------------------------------------------------------------- + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +// forward declaration of the function that must be provided in the +// .cc files +template +void +check_this (const DoFHandler &dof_handler); + + +void +output_vector (std::vector &v) +{ +for (unsigned int i=0; i &v) +{ +for (unsigned int i=0; i +void +check (const Triangulation& tria, + const FiniteElement &fe) +{ + deallog << fe.get_name() << std::endl; + + DoFHandler dof_handler (tria); + dof_handler.distribute_dofs (fe); + + // call main function in .cc files + check_this (dof_handler); +} + + +template +void check_grid(const Triangulation& tr) +{ + FE_Q q1(1); + check(tr, q1); + FE_Q q2(2); + check(tr, q2); + FE_Q q3(3); + check(tr, q3); + + FE_DGQ dgq0(0); + check(tr, dgq0); + FE_DGQ dgq1(1); + check(tr, dgq1); + FE_DGQ dgq2(2); + check(tr, dgq2); + + FE_DGP dgp1(1); + check(tr, dgp1); + FE_DGP dgp2(2); + check(tr, dgp2); + + FE_Nedelec nedelec1(1); + check(tr, nedelec1); + + FE_RaviartThomas rt0(0); + check(tr, rt0); + FE_RaviartThomas rt1(1); + check(tr, rt1); + FE_RaviartThomas rt2(2); + check(tr, rt2); + + FESystem s1(q1, 3); + check(tr, s1); + FESystem s2(dgq1, 2, q1, 1); + check(tr, s2); + FESystem s3(q1, 2, dgq0, 3); + check(tr, s3); + FESystem s4(q1, 3, dgq0, 2, dgp1, 1); + check(tr, s4); + + FESystem s10(rt1, 1, dgq1, 1); + check(tr, s10); + FESystem s11(rt0, 2, rt1, 1); + check(tr, s11); + + FESystem ss1(s1, 2, s3, 1); + check(tr, ss1); +} + + diff --git a/tests/lib/test_grids.h b/tests/lib/test_grids.h new file mode 100644 index 0000000000..dcd1564c3c --- /dev/null +++ b/tests/lib/test_grids.h @@ -0,0 +1,116 @@ +//---------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 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. +// +//---------------------------------------------------------------------- + +#include + +/** + * A set of test meshes for the deal.II test suite. + * + * These meshes exhibit certain key features for writing tests. If you + * want to test certain properties of algorithms, the following table + * might be of help. + * + * + * + * + * + * + * + * + *
MeshFeature tested
#hypercube(tr)works at all on a single + * cell
#hypercube(tr,2)works on uniform meshes
#hypercube(tr,3,true)works with local + * refinement
#star_shaped(tr,1)method is robust if more than + * usual cells meet in one vertex
#star_shaped(tr,2,true)method is robust if more than + * usual cells meet in one vertex and local refinement exceeds one + * level
+ * + * @author Guido Kanschat, 2006 + */ +namespace TestGrids +{ + /** + * Generate grids based on + * hypercube. These meshes have a + * regular geometry and topology. + * + * @param refinement + * denotes the number of refinement + * steps of the root cell. + * + * @param if local is + * true, refine only the + * cell containing the corner with + * only negative coordinates. + */ + template + void hypercube(Triangulation& tr, + unsigned int refinement = 0, + bool local = false); + /** + * Create a star-shaped mesh, + * having more than the average + * 2dim cells + * in the central vertex. + * + * @param refinement + * denotes the number of refinement + * steps of the root mesh. + * + * @param if local is + * true, refine only one + * of the coarse cells. + */ + template + void star_shaped(Triangulation& tr, + unsigned int refinement = 0, + bool local = false); + /** + * Local refinement of every other + * cell in a checkerboard fashion. + */ + template + void checkers(Triangulation& tr); + /** + * Islands of local refinement + */ + template + void islands(Triangulation& tr); + /** + * Local refinement with an + * unrefined hole. + */ + template + void laguna(Triangulation& tr); + + + template + void hypercube(Triangulation& tr, + unsigned int refinement, + bool local) + { + GridGenerator::hyper_cube(tr); + if (!local) + { + if (refinement > 0) + tr.refine_global(refinement); + } + else + { + for (unsigned int i=0;iset_refine_flag(); + tr.execute_coarsening_and_refinement(); + } + } + } +}