From ed016c2d011bb8b817b8a9c2fef08e410de53904 Mon Sep 17 00:00:00 2001 From: turcksin Date: Tue, 27 Aug 2013 16:36:30 +0000 Subject: [PATCH] Convert integrators tests to ctest. Lots of timeout. git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30507 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/integrators/CMakeLists.txt | 1 + tests/integrators/Makefile | 10 -- .../integrators/assembler_simple_matrix_01.cc | 2 +- ...eric => assembler_simple_matrix_01.output} | 0 .../integrators/assembler_simple_matrix_02.cc | 2 +- ...eric => assembler_simple_matrix_02.output} | 0 .../integrators/assembler_simple_matrix_03.cc | 2 +- ...eric => assembler_simple_matrix_03.output} | 0 .../assembler_simple_matrix_03tri.cc | 2 +- ...c => assembler_simple_matrix_03tri.output} | 0 .../integrators/assembler_simple_matrix_04.cc | 2 +- ...eric => assembler_simple_matrix_04.output} | 0 .../assembler_simple_mgmatrix_01.cc | 2 +- ...ic => assembler_simple_mgmatrix_01.output} | 0 .../assembler_simple_mgmatrix_02.cc | 2 +- ...ic => assembler_simple_mgmatrix_02.output} | 0 .../assembler_simple_mgmatrix_03.cc | 2 +- ...ic => assembler_simple_mgmatrix_03.output} | 0 tests/integrators/cells_and_faces_01.cc | 2 +- .../cmp/generic => cells_and_faces_01.output} | 0 tests/integrators/cochain_01.cc | 2 +- .../cmp/generic => cochain_01.output} | 0 tests/integrators/divergence_01.cc | 2 +- .../cmp/generic => divergence_01.output} | 0 tests/integrators/elasticity_01.cc | 2 +- .../cmp/generic => elasticity_01.output} | 0 tests/integrators/functional_01.cc | 2 +- .../cmp/generic => functional_01.output} | 0 tests/integrators/laplacian_01.cc | 2 +- .../cmp/generic => laplacian_01.output} | 0 tests/integrators/mesh_worker_01.cc | 2 +- .../cmp/generic => mesh_worker_01.output} | 0 tests/integrators/mesh_worker_02.cc | 2 +- .../cmp/generic => mesh_worker_02.output} | 0 tests/integrators/mesh_worker_03.cc | 2 +- .../cmp/generic => mesh_worker_03.output} | 0 tests/integrators/mesh_worker_1d_dg.cc | 2 +- .../cmp/generic => mesh_worker_1d_dg.output} | 0 tests/integrators/mesh_worker_matrix_01.cc | 2 +- .../generic => mesh_worker_matrix_01.output} | 0 tests/lib/dof_tools_frame.h | 130 ++++++++++++++++++ tests/lib/test_grids.h | 130 ++++++++++++++++++ 42 files changed, 280 insertions(+), 29 deletions(-) create mode 100644 tests/integrators/CMakeLists.txt delete mode 100644 tests/integrators/Makefile rename tests/integrators/{assembler_simple_matrix_01/cmp/generic => assembler_simple_matrix_01.output} (100%) rename tests/integrators/{assembler_simple_matrix_02/cmp/generic => assembler_simple_matrix_02.output} (100%) rename tests/integrators/{assembler_simple_matrix_03/cmp/generic => assembler_simple_matrix_03.output} (100%) rename tests/integrators/{assembler_simple_matrix_03tri/cmp/generic => assembler_simple_matrix_03tri.output} (100%) rename tests/integrators/{assembler_simple_matrix_04/cmp/generic => assembler_simple_matrix_04.output} (100%) rename tests/integrators/{assembler_simple_mgmatrix_01/cmp/generic => assembler_simple_mgmatrix_01.output} (100%) rename tests/integrators/{assembler_simple_mgmatrix_02/cmp/generic => assembler_simple_mgmatrix_02.output} (100%) rename tests/integrators/{assembler_simple_mgmatrix_03/cmp/generic => assembler_simple_mgmatrix_03.output} (100%) rename tests/integrators/{cells_and_faces_01/cmp/generic => cells_and_faces_01.output} (100%) rename tests/integrators/{cochain_01/cmp/generic => cochain_01.output} (100%) rename tests/integrators/{divergence_01/cmp/generic => divergence_01.output} (100%) rename tests/integrators/{elasticity_01/cmp/generic => elasticity_01.output} (100%) rename tests/integrators/{functional_01/cmp/generic => functional_01.output} (100%) rename tests/integrators/{laplacian_01/cmp/generic => laplacian_01.output} (100%) rename tests/integrators/{mesh_worker_01/cmp/generic => mesh_worker_01.output} (100%) rename tests/integrators/{mesh_worker_02/cmp/generic => mesh_worker_02.output} (100%) rename tests/integrators/{mesh_worker_03/cmp/generic => mesh_worker_03.output} (100%) rename tests/integrators/{mesh_worker_1d_dg/cmp/generic => mesh_worker_1d_dg.output} (100%) rename tests/integrators/{mesh_worker_matrix_01/cmp/generic => mesh_worker_matrix_01.output} (100%) create mode 100644 tests/lib/dof_tools_frame.h create mode 100644 tests/lib/test_grids.h diff --git a/tests/integrators/CMakeLists.txt b/tests/integrators/CMakeLists.txt new file mode 100644 index 0000000000..0efb828f2c --- /dev/null +++ b/tests/integrators/CMakeLists.txt @@ -0,0 +1 @@ +DEAL_II_PICKUP_TESTS() diff --git a/tests/integrators/Makefile b/tests/integrators/Makefile deleted file mode 100644 index 810bdc8a1b..0000000000 --- a/tests/integrators/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -############################################################ -# $Id$ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors -############################################################ - -include ../Makefile.paths -include $D/common/Make.global_options -include ../Makefile.rules --include Makefile.depend --include Makefile.tests diff --git a/tests/integrators/assembler_simple_matrix_01.cc b/tests/integrators/assembler_simple_matrix_01.cc index 8ecaec7d24..bd08ef0623 100644 --- a/tests/integrators/assembler_simple_matrix_01.cc +++ b/tests/integrators/assembler_simple_matrix_01.cc @@ -50,7 +50,7 @@ void test(DOFINFO &info, MeshWorker::Assembler::MatrixSimple &ass) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_matrix_01/cmp/generic b/tests/integrators/assembler_simple_matrix_01.output similarity index 100% rename from tests/integrators/assembler_simple_matrix_01/cmp/generic rename to tests/integrators/assembler_simple_matrix_01.output diff --git a/tests/integrators/assembler_simple_matrix_02.cc b/tests/integrators/assembler_simple_matrix_02.cc index 47144e3fa4..8ab2c270c7 100644 --- a/tests/integrators/assembler_simple_matrix_02.cc +++ b/tests/integrators/assembler_simple_matrix_02.cc @@ -79,7 +79,7 @@ void test(FiniteElement &fe) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_matrix_02/cmp/generic b/tests/integrators/assembler_simple_matrix_02.output similarity index 100% rename from tests/integrators/assembler_simple_matrix_02/cmp/generic rename to tests/integrators/assembler_simple_matrix_02.output diff --git a/tests/integrators/assembler_simple_matrix_03.cc b/tests/integrators/assembler_simple_matrix_03.cc index 5cf602c096..458a2e22c1 100644 --- a/tests/integrators/assembler_simple_matrix_03.cc +++ b/tests/integrators/assembler_simple_matrix_03.cc @@ -111,7 +111,7 @@ void test(FiniteElement &fe) int main() { - initlog(__FILE__); + initlog(); FE_DGP<2> p0(0); FE_DGP<2> p1(1); diff --git a/tests/integrators/assembler_simple_matrix_03/cmp/generic b/tests/integrators/assembler_simple_matrix_03.output similarity index 100% rename from tests/integrators/assembler_simple_matrix_03/cmp/generic rename to tests/integrators/assembler_simple_matrix_03.output diff --git a/tests/integrators/assembler_simple_matrix_03tri.cc b/tests/integrators/assembler_simple_matrix_03tri.cc index fcd3f3204f..00dc84626c 100644 --- a/tests/integrators/assembler_simple_matrix_03tri.cc +++ b/tests/integrators/assembler_simple_matrix_03tri.cc @@ -112,7 +112,7 @@ void test(FiniteElement &fe) int main(int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv); - initlog(__FILE__); + initlog(); FE_DGP<2> p0(0); FE_DGP<2> p1(1); diff --git a/tests/integrators/assembler_simple_matrix_03tri/cmp/generic b/tests/integrators/assembler_simple_matrix_03tri.output similarity index 100% rename from tests/integrators/assembler_simple_matrix_03tri/cmp/generic rename to tests/integrators/assembler_simple_matrix_03tri.output diff --git a/tests/integrators/assembler_simple_matrix_04.cc b/tests/integrators/assembler_simple_matrix_04.cc index f52b7feb13..22d1698ce6 100644 --- a/tests/integrators/assembler_simple_matrix_04.cc +++ b/tests/integrators/assembler_simple_matrix_04.cc @@ -111,7 +111,7 @@ void test(FiniteElement &fe) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_matrix_04/cmp/generic b/tests/integrators/assembler_simple_matrix_04.output similarity index 100% rename from tests/integrators/assembler_simple_matrix_04/cmp/generic rename to tests/integrators/assembler_simple_matrix_04.output diff --git a/tests/integrators/assembler_simple_mgmatrix_01.cc b/tests/integrators/assembler_simple_mgmatrix_01.cc index c7cdbef5f4..b8e63805d8 100644 --- a/tests/integrators/assembler_simple_mgmatrix_01.cc +++ b/tests/integrators/assembler_simple_mgmatrix_01.cc @@ -50,7 +50,7 @@ void test(DOFINFO &info, MeshWorker::Assembler::MGMatrixSimple &ass) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_mgmatrix_01/cmp/generic b/tests/integrators/assembler_simple_mgmatrix_01.output similarity index 100% rename from tests/integrators/assembler_simple_mgmatrix_01/cmp/generic rename to tests/integrators/assembler_simple_mgmatrix_01.output diff --git a/tests/integrators/assembler_simple_mgmatrix_02.cc b/tests/integrators/assembler_simple_mgmatrix_02.cc index 6499fe8e10..bdd607403e 100644 --- a/tests/integrators/assembler_simple_mgmatrix_02.cc +++ b/tests/integrators/assembler_simple_mgmatrix_02.cc @@ -79,7 +79,7 @@ void test(FiniteElement &fe) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_mgmatrix_02/cmp/generic b/tests/integrators/assembler_simple_mgmatrix_02.output similarity index 100% rename from tests/integrators/assembler_simple_mgmatrix_02/cmp/generic rename to tests/integrators/assembler_simple_mgmatrix_02.output diff --git a/tests/integrators/assembler_simple_mgmatrix_03.cc b/tests/integrators/assembler_simple_mgmatrix_03.cc index 2ec9a66783..dbbe2f7b1c 100644 --- a/tests/integrators/assembler_simple_mgmatrix_03.cc +++ b/tests/integrators/assembler_simple_mgmatrix_03.cc @@ -117,7 +117,7 @@ void test(FiniteElement &fe) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/assembler_simple_mgmatrix_03/cmp/generic b/tests/integrators/assembler_simple_mgmatrix_03.output similarity index 100% rename from tests/integrators/assembler_simple_mgmatrix_03/cmp/generic rename to tests/integrators/assembler_simple_mgmatrix_03.output diff --git a/tests/integrators/cells_and_faces_01.cc b/tests/integrators/cells_and_faces_01.cc index 0e63ac9a04..5a4063ae60 100644 --- a/tests/integrators/cells_and_faces_01.cc +++ b/tests/integrators/cells_and_faces_01.cc @@ -184,7 +184,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/cells_and_faces_01/cmp/generic b/tests/integrators/cells_and_faces_01.output similarity index 100% rename from tests/integrators/cells_and_faces_01/cmp/generic rename to tests/integrators/cells_and_faces_01.output diff --git a/tests/integrators/cochain_01.cc b/tests/integrators/cochain_01.cc index 790a90e767..a1a8d52462 100644 --- a/tests/integrators/cochain_01.cc +++ b/tests/integrators/cochain_01.cc @@ -297,7 +297,7 @@ void run3d (unsigned int degree) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.log_execution_time(false); diff --git a/tests/integrators/cochain_01/cmp/generic b/tests/integrators/cochain_01.output similarity index 100% rename from tests/integrators/cochain_01/cmp/generic rename to tests/integrators/cochain_01.output diff --git a/tests/integrators/divergence_01.cc b/tests/integrators/divergence_01.cc index 8907be10e8..4a44b02966 100644 --- a/tests/integrators/divergence_01.cc +++ b/tests/integrators/divergence_01.cc @@ -269,7 +269,7 @@ test(Triangulation &tr) int main() { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/integrators/divergence_01/cmp/generic b/tests/integrators/divergence_01.output similarity index 100% rename from tests/integrators/divergence_01/cmp/generic rename to tests/integrators/divergence_01.output diff --git a/tests/integrators/elasticity_01.cc b/tests/integrators/elasticity_01.cc index e62f83aa53..f50aa9118f 100644 --- a/tests/integrators/elasticity_01.cc +++ b/tests/integrators/elasticity_01.cc @@ -255,7 +255,7 @@ test(Triangulation &tr) int main() { - initlog(__FILE__); + initlog(); deallog.threshold_double(1.e-10); Triangulation<2> tr2; diff --git a/tests/integrators/elasticity_01/cmp/generic b/tests/integrators/elasticity_01.output similarity index 100% rename from tests/integrators/elasticity_01/cmp/generic rename to tests/integrators/elasticity_01.output diff --git a/tests/integrators/functional_01.cc b/tests/integrators/functional_01.cc index a731e30354..f9053ceb23 100644 --- a/tests/integrators/functional_01.cc +++ b/tests/integrators/functional_01.cc @@ -155,7 +155,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/functional_01/cmp/generic b/tests/integrators/functional_01.output similarity index 100% rename from tests/integrators/functional_01/cmp/generic rename to tests/integrators/functional_01.output diff --git a/tests/integrators/laplacian_01.cc b/tests/integrators/laplacian_01.cc index f18d7f9e61..1c55d7249e 100644 --- a/tests/integrators/laplacian_01.cc +++ b/tests/integrators/laplacian_01.cc @@ -279,7 +279,7 @@ test(Triangulation &tr) int main() { - initlog(__FILE__); + initlog(); deallog.threshold_double(1.e-10); Triangulation<2> tr2; diff --git a/tests/integrators/laplacian_01/cmp/generic b/tests/integrators/laplacian_01.output similarity index 100% rename from tests/integrators/laplacian_01/cmp/generic rename to tests/integrators/laplacian_01.output diff --git a/tests/integrators/mesh_worker_01.cc b/tests/integrators/mesh_worker_01.cc index 66f81bbd66..8d5961a9fe 100644 --- a/tests/integrators/mesh_worker_01.cc +++ b/tests/integrators/mesh_worker_01.cc @@ -198,7 +198,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/mesh_worker_01/cmp/generic b/tests/integrators/mesh_worker_01.output similarity index 100% rename from tests/integrators/mesh_worker_01/cmp/generic rename to tests/integrators/mesh_worker_01.output diff --git a/tests/integrators/mesh_worker_02.cc b/tests/integrators/mesh_worker_02.cc index 3b7d9985d6..fc54726228 100644 --- a/tests/integrators/mesh_worker_02.cc +++ b/tests/integrators/mesh_worker_02.cc @@ -292,7 +292,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/mesh_worker_02/cmp/generic b/tests/integrators/mesh_worker_02.output similarity index 100% rename from tests/integrators/mesh_worker_02/cmp/generic rename to tests/integrators/mesh_worker_02.output diff --git a/tests/integrators/mesh_worker_03.cc b/tests/integrators/mesh_worker_03.cc index 609406761a..84be179ccf 100644 --- a/tests/integrators/mesh_worker_03.cc +++ b/tests/integrators/mesh_worker_03.cc @@ -306,7 +306,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/mesh_worker_03/cmp/generic b/tests/integrators/mesh_worker_03.output similarity index 100% rename from tests/integrators/mesh_worker_03/cmp/generic rename to tests/integrators/mesh_worker_03.output diff --git a/tests/integrators/mesh_worker_1d_dg.cc b/tests/integrators/mesh_worker_1d_dg.cc index 4e5734fee4..1db5ba294d 100644 --- a/tests/integrators/mesh_worker_1d_dg.cc +++ b/tests/integrators/mesh_worker_1d_dg.cc @@ -437,7 +437,7 @@ namespace Advection int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/mesh_worker_1d_dg/cmp/generic b/tests/integrators/mesh_worker_1d_dg.output similarity index 100% rename from tests/integrators/mesh_worker_1d_dg/cmp/generic rename to tests/integrators/mesh_worker_1d_dg.output diff --git a/tests/integrators/mesh_worker_matrix_01.cc b/tests/integrators/mesh_worker_matrix_01.cc index 2ed4bb5dad..004d6a3d4e 100644 --- a/tests/integrators/mesh_worker_matrix_01.cc +++ b/tests/integrators/mesh_worker_matrix_01.cc @@ -199,7 +199,7 @@ test(const FiniteElement &fe) int main () { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + const std::string logname = "output"; std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console (0); diff --git a/tests/integrators/mesh_worker_matrix_01/cmp/generic b/tests/integrators/mesh_worker_matrix_01.output similarity index 100% rename from tests/integrators/mesh_worker_matrix_01/cmp/generic rename to tests/integrators/mesh_worker_matrix_01.output diff --git a/tests/lib/dof_tools_frame.h b/tests/lib/dof_tools_frame.h new file mode 100644 index 0000000000..fbfcd5c0ea --- /dev/null +++ b/tests/lib/dof_tools_frame.h @@ -0,0 +1,130 @@ +// --------------------------------------------------------------------- +// $Id: dof_tools_frame.h 30048 2013-07-18 19:42:36Z maier $ +// +// Copyright (C) 2003 - 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. +// +// --------------------------------------------------------------------- + + +#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..c541b4178f --- /dev/null +++ b/tests/lib/test_grids.h @@ -0,0 +1,130 @@ +// --------------------------------------------------------------------- +// $Id: test_grids.h 30049 2013-07-18 19:42:40Z maier $ +// +// Copyright (C) 2006 - 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. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#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 + * @date 2006, 2010 + */ +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) + { + GridGenerator::hyper_cube(tr, -1., 1.); + if (refinement && !local) + tr.refine_global(refinement); + if (refinement && local) + { + tr.refine_global(1); + for (unsigned int i=1; i::active_cell_iterator + cell = tr.begin_active(); cell != tr.end(); ++cell) + { + const Point &p = cell->center(); + bool negative = true; + for (unsigned int d=0; d= 0.)negative = false; + if (negative) + cell->set_refine_flag(); + } + tr.execute_coarsening_and_refinement(); + } + } + deallog << "Triangulation hypercube " << dim << "D refinement " << refinement; + if (local) + deallog << " local "; + deallog << " steps " << tr.n_active_cells() << " active cells " + << tr.n_cells() << " total cells " << std::endl; + } + + /** + * 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); +} -- 2.39.5