From 3706d11104baa414ea31c9957ba8f63aaabd0c96 Mon Sep 17 00:00:00 2001 From: kanschat Date: Wed, 30 May 2007 21:03:22 +0000 Subject: [PATCH] add MGDoFHandler::memory_consumption git-svn-id: https://svn.dealii.org/trunk@14734 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/multigrid/mg_dof_handler.h | 17 ++++++++++++- .../source/multigrid/mg_dof_handler.cc | 24 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_dof_handler.h b/deal.II/deal.II/include/multigrid/mg_dof_handler.h index e6430092c8..7c152eea99 100644 --- a/deal.II/deal.II/include/multigrid/mg_dof_handler.h +++ b/deal.II/deal.II/include/multigrid/mg_dof_handler.h @@ -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 @@ class MGDoFHandler : public DoFHandler */ 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. */ diff --git a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc index 1b30ab5afe..773c608b1d 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc @@ -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 @@ DEAL_II_NAMESPACE_OPEN /* ------------------------ MGVertexDoFs ----------------------------------- */ +//TODO: This seems horrible memory fragmentation! template MGDoFHandler::MGVertexDoFs::MGVertexDoFs () @@ -124,6 +125,25 @@ MGDoFHandler::~MGDoFHandler () } +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 -- 2.39.5