]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make things run in 1d, 2d, 3d
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 18 Feb 2006 04:45:01 +0000 (04:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 18 Feb 2006 04:45:01 +0000 (04:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@12411 0785d39b-7218-0410-832d-ea1e28bc413d

tests/hp/crash_01.cc
tests/hp/crash_02.cc

index b5bcb84dd661320461f245531a3618fabf4963e2..c439c681a958aaccbb1f2b00718c600124ce7ce7 100644 (file)
 #include <fstream>
 
 
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube(tria);
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back (FE_DGQ<dim> (1));
+
+  hp::DoFHandler<dim> dof_handler(tria);
+  tria.refine_global(1);
+  for (hp::DoFHandler<dim>::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<dim> tria;
-    GridGenerator::hyper_cube(tria);
-
-    hp::FECollection<dim> fe_collection;
-    fe_collection.push_back (FE_DGQ<dim> (1));
-
-    hp::DoFHandler<dim> dof_handler(tria);
-    tria.refine_global(1);
-    for (hp::DoFHandler<dim>::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<dim> tria;
-    GridGenerator::hyper_cube(tria);
-
-    hp::FECollection<dim> fe_collection;
-    fe_collection.push_back (FE_DGQ<dim> (1));
-
-    hp::DoFHandler<dim> dof_handler(tria);
-    tria.refine_global(1);
-    for (hp::DoFHandler<dim>::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;
 }
index 758abf89212a153827015bfe8f2b5ef70711eafc..84c1af5f972e2369c0b77232d4854b7043f0c23b 100644 (file)
 #include <fstream>
 
 
+template <int dim>
+void test ()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube(tria);
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back (FE_DGQ<dim> (1));
+
+  hp::DoFHandler<dim> 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<dim> tria;
-    GridGenerator::hyper_cube(tria);
-
-    hp::FECollection<dim> fe_collection;
-    fe_collection.push_back (FE_DGQ<dim> (1));
-
-    hp::DoFHandler<dim> dof_handler(tria);
-    dof_handler.begin_active()->set_active_fe_index(0);
-  }
-  
-  {
-    const unsigned int dim=3;
-    Triangulation<dim> tria;
-    GridGenerator::hyper_cube(tria);
-
-    hp::FECollection<dim> fe_collection;
-    fe_collection.push_back (FE_DGQ<dim> (1));
-
-    hp::DoFHandler<dim> dof_handler(tria);
-    dof_handler.begin_active()->set_active_fe_index(0);
-  }
+  test<1> ();
+  test<2> ();
+  test<3> ();
   
   deallog << "OK" << std::endl;
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.