]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test index access and finer mesh
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 May 2007 05:18:02 +0000 (05:18 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 May 2007 05:18:02 +0000 (05:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@14723 0785d39b-7218-0410-832d-ea1e28bc413d

tests/benchmarks/dof_handler_size.cc

index b772ffecdba2667216b66068d74b2ad0f85b5213..d80980c325919dae8a648f0ffbf62d0b3faae02b 100644 (file)
 #include <grid/tria.h>
 #include <grid/grid_generator.h>
 #include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
 #include <fe/fe_q.h>
 #include <fe/fe_dgq.h>
 #include <fe/fe_system.h>
 
 using namespace dealii;
 
+template <int dim>
+void indices (const DoFHandler<dim>& dof)
+{
+  typedef typename DoFHandler<dim>::active_cell_iterator I;
+  
+  std::vector<unsigned int> dofs(dof.get_fe().dofs_per_cell);
+  const I end = dof.end();
+  
+  for (I i=dof.begin_active(); i!=end;++i)
+    {
+      i->get_dof_indices(dofs);
+    }
+}
+
 
 template <int dim>
 void check ()
@@ -30,7 +45,7 @@ void check ()
   deallog << "Dimension " << dim << std::endl;
   Triangulation<dim> tr;
   GridGenerator::hyper_cube(tr);
-  tr.refine_global(18/dim);
+  tr.refine_global(21/dim);
 
   deallog << "Cells " << std::setw(12)  << tr.n_cells()
          << " active " << std::setw(12)  << tr.n_active_cells()
@@ -50,12 +65,22 @@ void check ()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;
   
+  indices(dof);
+  deallog << "Index1" << std::endl;
+  indices(dof);
+  deallog << "Index2" << std::endl;
+  
   dof.distribute_dofs(q3);
   deallog << "Dofs Q3   " << std::setw(12) << dof.n_dofs()
          << " memory " << std::setw(12) << dof.memory_consumption()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;
   
+  indices(dof);
+  deallog << "Index1" << std::endl;
+  indices(dof);
+  deallog << "Index2" << std::endl;
+  
   dof.distribute_dofs(sys1);
   deallog << "Dofs Sys1 " << std::setw(12) << dof.n_dofs()
          << " memory " << std::setw(12) << dof.memory_consumption()
@@ -67,11 +92,17 @@ void check ()
          << " memory " << std::setw(12) << dof.memory_consumption()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;  
+  
+  indices(dof);
+  deallog << "Index1" << std::endl;
+  indices(dof);
+  deallog << "Index2" << std::endl;
 }
 
 int main()
 {
   deallog.log_execution_time(true);
+  deallog.log_time_differences(true);
   check<2>();
   check<3>();
 }

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.