From 7fe6f1535f908b69a2861d33057f5143da785a9b Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 18 Feb 2006 04:45:01 +0000 Subject: [PATCH] Make things run in 1d, 2d, 3d git-svn-id: https://svn.dealii.org/trunk@12411 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/crash_01.cc | 61 ++++++++++++++++++-------------------------- tests/hp/crash_02.cc | 41 +++++++++++++---------------- 2 files changed, 43 insertions(+), 59 deletions(-) diff --git a/tests/hp/crash_01.cc b/tests/hp/crash_01.cc index b5bcb84dd6..c439c681a9 100644 --- a/tests/hp/crash_01.cc +++ b/tests/hp/crash_01.cc @@ -28,6 +28,27 @@ #include + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + + hp::FECollection fe_collection; + fe_collection.push_back (FE_DGQ (1)); + + hp::DoFHandler dof_handler(tria); + tria.refine_global(1); + for (hp::DoFHandler::active_cell_iterator + cell=dof_handler.begin_active(); + cell!=dof_handler.end(); ++cell) + cell->set_active_fe_index (0); + + dof_handler.distribute_dofs(fe_collection); +} + + int main () { std::ofstream logfile("crash_01/output"); @@ -35,43 +56,11 @@ int main () deallog.attach(logfile); deallog.depth_console(0); - deallog.threshold_double(1.e-10); - - { - const unsigned int dim=2; - Triangulation tria; - GridGenerator::hyper_cube(tria); - - hp::FECollection fe_collection; - fe_collection.push_back (FE_DGQ (1)); - - hp::DoFHandler dof_handler(tria); - tria.refine_global(1); - for (hp::DoFHandler::active_cell_iterator - cell=dof_handler.begin_active(); - cell!=dof_handler.end(); ++cell) - cell->set_active_fe_index (0); - - dof_handler.distribute_dofs(fe_collection); - } - - { - const unsigned int dim=3; - Triangulation tria; - GridGenerator::hyper_cube(tria); - - hp::FECollection fe_collection; - fe_collection.push_back (FE_DGQ (1)); - - hp::DoFHandler dof_handler(tria); - tria.refine_global(1); - for (hp::DoFHandler::active_cell_iterator - cell=dof_handler.begin_active(); - cell!=dof_handler.end(); ++cell) - cell->set_active_fe_index (0); + deallog.threshold_double(1.e-10); - dof_handler.distribute_dofs(fe_collection); - } + test<1> (); + test<2> (); + test<3> (); deallog << "OK" << std::endl; } diff --git a/tests/hp/crash_02.cc b/tests/hp/crash_02.cc index 758abf8921..84c1af5f97 100644 --- a/tests/hp/crash_02.cc +++ b/tests/hp/crash_02.cc @@ -30,6 +30,21 @@ #include +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + + hp::FECollection fe_collection; + fe_collection.push_back (FE_DGQ (1)); + + hp::DoFHandler dof_handler(tria); + dof_handler.begin_active()->set_active_fe_index(0); +} + + + int main () { std::ofstream logfile("crash_02/output"); @@ -39,29 +54,9 @@ int main () deallog.depth_console(0); deallog.threshold_double(1.e-10); - { - const unsigned int dim=2; - Triangulation tria; - GridGenerator::hyper_cube(tria); - - hp::FECollection fe_collection; - fe_collection.push_back (FE_DGQ (1)); - - hp::DoFHandler dof_handler(tria); - dof_handler.begin_active()->set_active_fe_index(0); - } - - { - const unsigned int dim=3; - Triangulation tria; - GridGenerator::hyper_cube(tria); - - hp::FECollection fe_collection; - fe_collection.push_back (FE_DGQ (1)); - - hp::DoFHandler dof_handler(tria); - dof_handler.begin_active()->set_active_fe_index(0); - } + test<1> (); + test<2> (); + test<3> (); deallog << "OK" << std::endl; } -- 2.39.5