]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add some timers to produce numbers for the paper.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 5 Mar 2007 17:27:34 +0000 (17:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 5 Mar 2007 17:27:34 +0000 (17:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@14520 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-27/step-27.cc

index 75d5f751ceef8fc0f97040128bcc5d9aa49df621..906d45f951ba47dd7662b90b8f3e42a88c154895 100644 (file)
@@ -21,6 +21,7 @@
 #include <base/function.h>
 #include <base/logstream.h>
 #include <base/utilities.h>
+#include <base/timer.h>
 #include <lac/vector.h>
 #include <lac/full_matrix.h>
 #include <lac/sparse_matrix.h>
@@ -86,6 +87,8 @@ class LaplaceProblem
 
     Vector<double>       solution;
     Vector<double>       system_rhs;
+
+    Timer distr, condense, hang;
 };
 
 
@@ -137,23 +140,33 @@ LaplaceProblem<dim>::~LaplaceProblem ()
 template <int dim>
 void LaplaceProblem<dim>::setup_system ()
 {
+  distr.reset();
+  distr.start();
   dof_handler.distribute_dofs (fe_collection);
-
+  distr.stop();
+  
   sparsity_pattern.reinit (dof_handler.n_dofs(),
                           dof_handler.n_dofs(),
                           dof_handler.max_couplings_between_dofs());
   DoFTools::make_sparsity_pattern (dof_handler, sparsity_pattern);
-
+  hang.stop();
+  
   solution.reinit (dof_handler.n_dofs());
   system_rhs.reinit (dof_handler.n_dofs());
 
   hanging_node_constraints.clear ();
+  hang.reset();
+  hang.start();
   DoFTools::make_hanging_node_constraints (dof_handler,
                                           hanging_node_constraints);
 
   hanging_node_constraints.close ();
-
+  hang.stop();
+  
+  condense.reset();
+  condense.start();
   hanging_node_constraints.condense (sparsity_pattern);
+  condense.stop();
   sparsity_pattern.compress();
 
   system_matrix.reinit (sparsity_pattern);
@@ -216,8 +229,10 @@ void LaplaceProblem<dim>::assemble_system ()
        }
     }
 
+  condense.start();
   hanging_node_constraints.condense (system_matrix);
   hanging_node_constraints.condense (system_rhs);
+  condense.stop();
   std::map<unsigned int,double> boundary_values;
   VectorTools::interpolate_boundary_values (dof_handler,
                                            0,
@@ -606,6 +621,8 @@ void LaplaceProblem<dim>::run ()
                << triangulation.n_active_cells()
                << std::endl;
 
+      Timer all;
+      all.start();
       setup_system ();
 
       std::cout << "   Number of degrees of freedom: "
@@ -617,6 +634,14 @@ void LaplaceProblem<dim>::run ()
       
       assemble_system ();
       solve ();
+      all.stop();
+
+      std::cout << "   All: " << all()
+               << ", distr: " << distr()
+               << ", hang: " << hang()
+               << ", condense: " << condense()
+               << std::endl;
+      
       output_results (cycle);
     }
 }

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.