]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
benchmark for triangulation and dof handler sizes
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 May 2007 23:00:55 +0000 (23:00 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 27 May 2007 23:00:55 +0000 (23:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@14718 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/benchmarks/Makefile b/tests/benchmarks/Makefile
new file mode 100644 (file)
index 0000000..8a6cf43
--- /dev/null
@@ -0,0 +1,82 @@
+############################################################
+# $Id$
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+############################################################
+
+############################################################
+# Include general settings for including DEAL libraries
+############################################################
+
+D=../../deal.II
+include $D/common/Make.global_options
+debug-mode = on
+
+libraries += $(lib-deal2-2d.g) $(lib-deal2-3d.g) $(lib-lac) $(lib-base)
+
+default: run-tests 
+
+############################################################
+
+tests_x =  dof_handler_size
+
+# from above list of regular expressions, generate the real set of
+# tests
+expand = $(shell echo $(addsuffix .cc,$(1)) \
+           | $(PERL) -pi -e 's/\.cc//g;')
+tests = $(call expand,$(tests_x))
+
+
+############################################################
+# First how to create executables, including all necessary
+# flags:
+############################################################
+
+flags     = $(CXXFLAGS.g)
+
+ifeq ($(findstring gcc,$(GXX_VERSION)),gcc)
+flags += -Wno-missing-noreturn
+endif
+
+%/obj.g.$(OBJEXT) : %.cc
+       @echo =====debug========= $<
+       @echo Compiling > $*/status
+       @$(CXX) $(flags) -c $< -o $@
+
+%/obj.$(OBJEXT) : %.cc
+       @echo =====optimized===== $<
+       @echo Compiling > $*/status
+       @$(CXX) $(CXXFLAGS.o) -c $< -o $@
+
+######################################################################
+# Don't put $(libraries) into this line since it is already in $^
+######################################################################
+%/exe : %/obj.$(OBJEXT)
+       @echo =====linking======= $@
+       @echo Linking > $*/status
+       @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+
+############################################################
+# After all these general rules, here is the target to be
+# executed by make: for each entry in the list $(tests)
+# perform a check.
+############################################################
+run-tests: $(tests:%=%/output)
+
+build: $(tests:%=%/exe)
+
+refs: $(tests:%=%/ref)
+
+
+Makefile.tests: Makefile $(shell echo *.cc)
+       @echo =====Targets======= $@
+       @for i in $(tests) ; do \
+               echo "$$i/exe : $$i/obj.\$$(OBJEXT) \$$(libraries)"; \
+        done \
+               > $@
+
+
+
+
+include Makefile.depend
+include Makefile.tests
diff --git a/tests/benchmarks/dof_handler_size.cc b/tests/benchmarks/dof_handler_size.cc
new file mode 100644 (file)
index 0000000..e40e3bb
--- /dev/null
@@ -0,0 +1,71 @@
+//----------------------------------------------------------------------
+//    $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 <base/logstream.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_system.h>
+
+using namespace dealii;
+
+
+template <int dim>
+void check ()
+{
+  deallog << "Dimension " << dim << std::endl;
+  Triangulation<dim> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(18/dim);
+
+  deallog << "Cells " << tr.n_cells()
+         << " active " << tr.n_active_cells()
+         << " memory " << tr.memory_consumption()
+         << std::endl;
+
+  FE_Q<dim> q1(1);
+  FE_Q<dim> q3(3);
+  FESystem<dim> sys1(q3, 1);
+  FESystem<dim> sys2(q3, 10);
+  DoFHandler<dim> dof(tr);
+  
+  dof.distribute_dofs(q1);
+  deallog << "Dofs Q1 " << dof.n_dofs()
+         << " memory " << dof.memory_consumption()
+         << std::endl;
+  
+  dof.distribute_dofs(q3);
+  deallog << "Dofs Q3 " << dof.n_dofs()
+         << " memory " << dof.memory_consumption()
+         << std::endl;
+  
+  dof.distribute_dofs(sys1);
+  deallog << "Dofs Sys1 " << dof.n_dofs()
+         << " memory " << dof.memory_consumption()
+         << std::endl;  
+  
+  dof.distribute_dofs(sys2);
+  deallog << "Dofs Sys2 " << dof.n_dofs()
+         << " memory " << dof.memory_consumption()
+         << std::endl;  
+}
+
+int main()
+{
+  deallog.log_execution_time(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.