]> https://gitweb.dealii.org/ - dealii.git/commitdiff
performance test
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 22 Feb 2001 21:12:53 +0000 (21:12 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 22 Feb 2001 21:12:53 +0000 (21:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@4019 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/Makefile.in
tests/fe/performance.cc [new file with mode: 0644]

index b52405854f1797931da3aadac87c65ff32a38d5a..6b8c025437899dc6cb88d8973c3ff13d7a51c91e 100644 (file)
@@ -1,6 +1,6 @@
 ############################################################
 # $Id$
-# Copyright (C) 2000 by the deal.II authors
+# Copyright (C) 2000, 2001 by the deal.II authors
 ############################################################
 
 ############################################################
@@ -102,6 +102,19 @@ show_transform: $(show_transform-o-files) $(libraries)
 
 ############################################################
 
+performance-cc-files = performance.cc
+
+ifeq ($(debug-mode),on)
+performance-o-files = $(performance-cc-files:.cc=.go)
+else
+performance-o-files = $(performance-cc-files:.cc=.o)
+endif
+
+performance: $(performance-o-files) $(libraries)
+       @$(CXX) $(flags) -o $@ $^
+
+############################################################
+
 internals-cc-files = internals.cc
 
 ifeq ($(debug-mode),on)
diff --git a/tests/fe/performance.cc b/tests/fe/performance.cc
new file mode 100644 (file)
index 0000000..dbbdfc3
--- /dev/null
@@ -0,0 +1,87 @@
+// $Id$
+// (c) Guido Kanschat
+//
+// Check performance of finite elements
+
+#include <base/quadrature_lib.h>
+#include <base/logstream.h>
+#include <lac/vector.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <dofs/dof_accessor.h>
+#include <grid/grid_generator.h>
+#include <fe/fe_lib.lagrange.h>
+#include <fe/fe_lib.dg.h>
+#include <fe/fe_system.h>
+#include <fe/fe_values.h>
+#include <vector>
+#include <fstream>
+#include <string>
+
+template <int dim>
+void performance (Triangulation<dim>& tr,
+                 const FiniteElement<dim>& fe,
+                 const Quadrature<dim>& quadrature,
+                 UpdateFlags flags)
+{
+  deallog << "Create dofs" << endl;
+  DoFHandler<dim> dof (tr);
+  dof.distribute_dofs (fe);
+
+  deallog << "Create FEValues" << endl;
+  
+  FEValues<dim> val (fe, quadrature, flags);
+
+  DoFHandler<dim>::active_cell_iterator cell = dof.begin_active();
+  DoFHandler<dim>::active_cell_iterator end = dof.end();
+
+  deallog << "Loop" << endl;
+  
+  for (;cell != end ; ++cell)
+    val.reinit(cell);
+
+  deallog << "End" << endl;
+}
+
+int main ()
+{
+  deallog.log_execution_time(true);
+  Triangulation<2> tr;
+  GridGenerator::hyper_ball (tr);
+  tr.refine_global (9);
+  
+  QGauss<2> gauss (3);
+  
+  FEQ2<2> element;
+
+  deallog.push("points");
+  performance (tr, element, gauss, update_q_points);
+  deallog.pop();
+  
+  deallog.push("values");
+  performance (tr, element, gauss, update_values);
+  deallog.pop();
+  
+  deallog.push("grads-");
+  performance (tr, element, gauss, update_gradients);
+  deallog.pop();
+  
+  deallog.push("2nd---");
+  performance (tr, element, gauss, update_second_derivatives);
+  deallog.pop();
+
+  deallog.push("matrix");
+  performance (tr, element, gauss, UpdateFlags (update_q_points
+              | update_JxW_values
+              | update_values
+              | update_gradients));
+  deallog.pop();
+
+  deallog.push("all---");
+  performance (tr, element, gauss, UpdateFlags (update_q_points
+              | update_JxW_values
+              | update_values
+              | update_gradients
+              | update_second_derivatives));
+  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.