From 84d69e8c1b6b9b5892925277b88900e326c56abf Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 29 Oct 2023 17:07:20 -0500 Subject: [PATCH] base/lazy.h: add memory_consumption method to Lazy --- include/deal.II/base/lazy.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/deal.II/base/lazy.h b/include/deal.II/base/lazy.h index 307fbc9708..450230cd0a 100644 --- a/include/deal.II/base/lazy.h +++ b/include/deal.II/base/lazy.h @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -194,6 +195,12 @@ public: value_or_initialize(const Callable &creator); + /** + * Compute the memory consumption of this structure. + */ + std::size_t + memory_consumption() const; + private: /** * The lazily initialized object stored as a std::optional. @@ -396,5 +403,14 @@ Lazy::value_or_initialize(const Callable &creator) } +template +std::size_t +Lazy::memory_consumption() const +{ + return MemoryConsumption::memory_consumption(object) + // + sizeof(*this) - sizeof(object); +} + + DEAL_II_NAMESPACE_CLOSE #endif -- 2.39.5