From eb050d0f6fbcb7135e50c8320692768c2e1f5e17 Mon Sep 17 00:00:00 2001 From: heister Date: Tue, 22 Jun 2010 08:09:20 +0000 Subject: [PATCH] memory_consumption() for IndexSet. git-svn-id: https://svn.dealii.org/trunk@21263 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/index_set.h | 14 ++++++++++++++ deal.II/base/source/index_set.cc | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/deal.II/base/include/base/index_set.h b/deal.II/base/include/base/index_set.h index 19311fefb1..c427183c37 100644 --- a/deal.II/base/include/base/index_set.h +++ b/deal.II/base/include/base/index_set.h @@ -312,6 +312,14 @@ class IndexSet const bool overlapping = false) const; #endif + + /** + * Determine an estimate for the memory + * consumption (in bytes) of this + * object. + */ + unsigned int memory_consumption () const; + private: /** * A type that denotes the half @@ -362,6 +370,12 @@ class IndexSet || (range_1.begin == range_2.begin)); } + + unsigned int memory_consumption () const + { + return sizeof(Range); + } + }; /** diff --git a/deal.II/base/source/index_set.cc b/deal.II/base/source/index_set.cc index 174c9ff591..0c3d652822 100644 --- a/deal.II/base/source/index_set.cc +++ b/deal.II/base/source/index_set.cc @@ -12,6 +12,7 @@ //--------------------------------------------------------------------------- +#include #include #include @@ -338,4 +339,15 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, #endif + +unsigned int +IndexSet::memory_consumption () const +{ + return MemoryConsumption::memory_consumption (ranges) + + MemoryConsumption::memory_consumption (is_compressed) + + MemoryConsumption::memory_consumption (index_space_size); +} + + + DEAL_II_NAMESPACE_CLOSE -- 2.39.5