]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
BIG test for refinement and dof handler setup
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 May 2007 18:07:22 +0000 (18:07 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 May 2007 18:07:22 +0000 (18:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@14738 0785d39b-7218-0410-832d-ea1e28bc413d

tests/benchmarks/dof_handler_size.cc
tests/benchmarks/dof_handler_timing_01.cc [new file with mode: 0644]

index 50bccecd3adb49f20004178dae0ed20c192dcd3b..4d5d10602979ca0e3b5aa230b03a2b74fe51fa40 100644 (file)
@@ -12,6 +12,7 @@
 //----------------------------------------------------------------------
 
 #include <iomanip>
+#include <fstream>
 
 #include <base/logstream.h>
 #include <grid/tria.h>
@@ -103,6 +104,8 @@ void check (bool local)
 
 int main()
 {
+  std::ofstream out("dof_handler_size/output");
+  deallog.attach(out);
   deallog.push("local");
   check<2>(true);
   check<3>(true);
diff --git a/tests/benchmarks/dof_handler_timing_01.cc b/tests/benchmarks/dof_handler_timing_01.cc
new file mode 100644 (file)
index 0000000..713efbf
--- /dev/null
@@ -0,0 +1,106 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2007 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 <iomanip>
+#include <fstream>
+
+#include <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <multigrid/mg_dof_handler.h>
+#include <multigrid/mg_dof_accessor.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_system.h>
+
+using namespace dealii;
+
+
+// Fill dof handlers for different elements and see how large they get.
+template <class DOF>
+void check_dofs(DOF& dof, unsigned int repeat)
+{
+  FE_Q<DOF::dimension> q1(1);
+  
+  deallog << "Start" << std::endl;
+  for (unsigned int i=1;i<6;++i)
+    {
+      FE_Q<DOF::dimension> fe(i);
+      for (unsigned int i=0;i<repeat;++i)
+       dof.distribute_dofs(fe);
+      deallog << dof.get_fe().get_name()
+             << " memory " << dof.memory_consumption()/1.e6 << std::endl;
+    }
+  
+  for (unsigned int i=1;i<6;++i)
+    {
+      FESystem<DOF::dimension> fe(q1, 1 << i);
+      for (unsigned int i=0;i<repeat;++i)
+       dof.distribute_dofs(fe);
+      deallog << dof.get_fe().get_name()
+             << " memory " << dof.memory_consumption()/1.e6 << std::endl;
+    }
+  dof.clear();
+}
+
+
+template <int dim>
+void check (bool local)
+{
+  deallog << "Dimension " << dim << std::endl;
+  Triangulation<dim> tr(Triangulation<dim>::maximum_smoothing);
+  GridGenerator::hyper_cube(tr);
+
+  if (local)
+    for (unsigned int i=0;i<1800/dim;++i)
+      {
+       tr.last_active()->set_refine_flag();
+       tr.execute_coarsening_and_refinement();
+      }
+  else
+    tr.refine_global(21/dim);
+  
+  deallog << "Levels " << tr.n_levels() << " Cells "<< tr.n_cells()
+         << std::endl
+         << " active " << tr.n_active_cells()
+         << " memory " << tr.memory_consumption()/1.e6
+         << std::endl;
+  
+  deallog.push("DoF");
+  DoFHandler<dim> dof(tr);
+  check_dofs(dof, (local ? 10 : 1));
+  deallog.pop();
+  deallog.push("MGDoF");
+  MGDoFHandler<dim> mgdof(tr);
+  check_dofs(mgdof, (local ? 10 : 1));
+  deallog.pop();
+}
+
+int main()
+{
+  std::ofstream out("dof_handler_timing_01/output");
+  deallog.log_execution_time(true);
+  deallog.log_time_differences(true);
+  deallog.attach(out);
+  deallog.push("local");
+  check<2>(true);
+  check<3>(true);
+  deallog.pop();
+  deallog.push("global");  
+  check<2>(false);
+  check<3>(false);
+  deallog.pop();
+}
+

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.