]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add MGDoFHandler::memory_consumption
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 30 May 2007 21:03:22 +0000 (21:03 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 30 May 2007 21:03:22 +0000 (21:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@14734 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/multigrid/mg_dof_handler.h
deal.II/deal.II/source/multigrid/mg_dof_handler.cc

index e6430092c805b4913c38fa71f436a951cd41a2f2..7c152eea998b5b38180ebae07dab6051d0e831d3 100644 (file)
@@ -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<dim>
                                      */
     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.
                                      */
index 1b30ab5afe495c333c5487067afde29d04ae2f87..773c608b1d1b628ab4b9cc91ee049ed5f0719851 100644 (file)
@@ -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 <base/memory_consumption.h>
 #include <dofs/dof_levels.h>
 #include <dofs/dof_faces.h>
 #include <dofs/dof_constraints.h>
@@ -33,6 +33,7 @@ DEAL_II_NAMESPACE_OPEN
 
 
 /* ------------------------ MGVertexDoFs ----------------------------------- */
+//TODO: This seems horrible memory fragmentation!
 
 template <int dim>
 MGDoFHandler<dim>::MGVertexDoFs::MGVertexDoFs ()
@@ -124,6 +125,25 @@ MGDoFHandler<dim>::~MGDoFHandler ()
 }
 
 
+template <int dim>
+unsigned int
+MGDoFHandler<dim>::memory_consumption() const
+{
+  unsigned int mem = DoFHandler<dim>::memory_consumption();
+  for (unsigned int l=0;l<mg_levels.size();++l)
+    mem += mg_levels[l]->memory_consumption();
+  
+  mem += MemoryConsumption::memory_consumption(*mg_faces);
+  
+  for (unsigned int l=0;l<mg_vertex_dofs.size();++l)
+    mem += sizeof(MGVertexDoFs)
+          + (1+mg_vertex_dofs[l].get_finest_level()-mg_vertex_dofs[l].get_coarsest_level())
+          * sizeof(unsigned int);
+  mem += MemoryConsumption::memory_consumption(mg_used_dofs);
+  return mem;
+}
+
+
 #if deal_II_dimension == 1
 
 template <>

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.