From bb8c58efcf041f45d9c00668983e7dd08d397ac8 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 22 Feb 2001 21:12:53 +0000 Subject: [PATCH] performance test git-svn-id: https://svn.dealii.org/trunk@4019 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/Makefile.in | 15 ++++++- tests/fe/performance.cc | 87 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 tests/fe/performance.cc diff --git a/tests/fe/Makefile.in b/tests/fe/Makefile.in index b52405854f..6b8c025437 100644 --- a/tests/fe/Makefile.in +++ b/tests/fe/Makefile.in @@ -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 index 0000000000..dbbdfc3494 --- /dev/null +++ b/tests/fe/performance.cc @@ -0,0 +1,87 @@ +// $Id$ +// (c) Guido Kanschat +// +// Check performance of finite elements + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +void performance (Triangulation& tr, + const FiniteElement& fe, + const Quadrature& quadrature, + UpdateFlags flags) +{ + deallog << "Create dofs" << endl; + DoFHandler dof (tr); + dof.distribute_dofs (fe); + + deallog << "Create FEValues" << endl; + + FEValues val (fe, quadrature, flags); + + DoFHandler::active_cell_iterator cell = dof.begin_active(); + DoFHandler::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(); +} -- 2.39.5