From: kanschat Date: Wed, 30 May 2007 21:03:46 +0000 (+0000) Subject: size of MGDoFHandler X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7773338f8458a198b048ee1951186415047bfd9;p=dealii-svn.git size of MGDoFHandler git-svn-id: https://svn.dealii.org/trunk@14735 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/benchmarks/dof_handler_size.cc b/tests/benchmarks/dof_handler_size.cc index e454b94de7..50bccecd3a 100644 --- a/tests/benchmarks/dof_handler_size.cc +++ b/tests/benchmarks/dof_handler_size.cc @@ -18,32 +18,24 @@ #include #include #include +#include +#include #include #include #include using namespace dealii; -template -void check () + +// Fill dof handlers for different elements and see how large they get. +template +void check_dofs(DOF& dof) { - deallog << "Dimension " << dim << std::endl; - Triangulation tr; - GridGenerator::hyper_cube(tr); - tr.refine_global(18/dim); - - deallog << "Cells " << std::setw(12) << tr.n_cells() - << " active " << std::setw(12) << tr.n_active_cells() - << " memory " << std::setw(12) << tr.memory_consumption() - << " quotient " << (1./tr.n_cells()*tr.memory_consumption()) - << std::endl; - - FE_Q q1(1); - FE_Q q3(3); - FESystem sys1(q3, 1); - FESystem sys2(q3, 10); - DoFHandler dof(tr); - + FE_Q q1(1); + FE_Q q3(3); + FESystem sys1(q3, 1); + FESystem sys2(q3, 10); + dof.distribute_dofs(q1); deallog << "Dofs Q1 " << std::setw(12) << dof.n_dofs() << " memory " << std::setw(12) << dof.memory_consumption() @@ -60,18 +52,64 @@ void check () deallog << "Dofs Sys1 " << std::setw(12) << dof.n_dofs() << " memory " << std::setw(12) << dof.memory_consumption() << " quotient " << (1./dof.n_dofs()*dof.memory_consumption()) - << std::endl; + << std::endl; dof.distribute_dofs(sys2); deallog << "Dofs Sys2 " << std::setw(12) << dof.n_dofs() << " memory " << std::setw(12) << dof.memory_consumption() << " quotient " << (1./dof.n_dofs()*dof.memory_consumption()) - << std::endl; + << std::endl; + + dof.clear(); +} + + +template +void check (bool local) +{ + deallog << "Dimension " << dim << std::endl; + Triangulation tr(Triangulation::maximum_smoothing); + GridGenerator::hyper_cube(tr); + + if (local) + for (unsigned int i=0;i<99/dim;++i) + { + tr.last_active()->set_refine_flag(); + tr.execute_coarsening_and_refinement(); + } + else + tr.refine_global(18/dim); + + deallog << "Levels " << tr.n_levels() << "Cells "<< tr.n_cells() + << std::endl + << " active " << std::setw(12) << tr.n_active_cells() + << " memory " << std::setw(12) << tr.memory_consumption() + << " quotient " << (1./tr.n_cells()*tr.memory_consumption()) + << std::endl; + + FE_Q q1(1); + FE_Q q3(3); + FESystem sys1(q3, 1); + FESystem sys2(q3, 10); + deallog.push("DoF"); + DoFHandler dof(tr); + check_dofs(dof); + deallog.pop(); + deallog.push("MGDoF"); + MGDoFHandler mgdof(tr); + check_dofs(mgdof); + deallog.pop(); } int main() { - check<2>(); - check<3>(); + deallog.push("local"); + check<2>(true); + check<3>(true); + deallog.pop(); + deallog.push("global"); + check<2>(false); + check<3>(false); + deallog.pop(); } diff --git a/tests/benchmarks/patches/library/2007-05-30 b/tests/benchmarks/patches/library/2007-05-30 new file mode 100644 index 0000000000..cd619e8c49 --- /dev/null +++ b/tests/benchmarks/patches/library/2007-05-30 @@ -0,0 +1,91 @@ +Index: deal.II/source/multigrid/mg_dof_handler.cc +=================================================================== +--- deal.II/source/multigrid/mg_dof_handler.cc (revision 14714) ++++ deal.II/source/multigrid/mg_dof_handler.cc (working copy) +@@ -2,7 +2,7 @@ + // $Id$ + // Version: $Name$ + // +-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors ++// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors + // + // This file is subject to QPL and may not be distributed + // without copyright and license information. Please refer +@@ -11,7 +11,7 @@ + // + //--------------------------------------------------------------------------- + +- ++#include + #include + #include + #include +@@ -33,6 +33,7 @@ + + + /* ------------------------ MGVertexDoFs ----------------------------------- */ ++//TODO: This seems horrible memory fragmentation! + + template + MGDoFHandler::MGVertexDoFs::MGVertexDoFs () +@@ -124,6 +125,25 @@ + } + + ++template ++unsigned int ++MGDoFHandler::memory_consumption() const ++{ ++ unsigned int mem = DoFHandler::memory_consumption(); ++ for (unsigned int l=0;lmemory_consumption(); ++ ++ mem += MemoryConsumption::memory_consumption(*mg_faces); ++ ++ for (unsigned int l=0;l +Index: deal.II/include/multigrid/mg_dof_handler.h +=================================================================== +--- deal.II/include/multigrid/mg_dof_handler.h (revision 14714) ++++ deal.II/include/multigrid/mg_dof_handler.h (working copy) +@@ -2,7 +2,7 @@ + // $Id$ + // Version: $Name$ + // +-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors ++// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors + // + // This file is subject to QPL and may not be distributed + // without copyright and license information. Please refer +@@ -711,6 +711,21 @@ + */ + unsigned int n_dofs () const; + ++ /** ++ * Determine an estimate for the ++ * memory consumption (in bytes) ++ * of this object. ++ * ++ * This function is made virtual, ++ * since a dof handler object ++ * might be accessed through a ++ * pointers to thisr base class, ++ * although the actual object ++ * might be a derived class. ++ */ ++ virtual unsigned int memory_consumption () const; ++ ++ + /** + * Exception. + */