]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add BlockSparsityPatternBase::memory_consumption(). 14397/head
authorDavid Wells <drwells@email.unc.edu>
Sun, 30 Oct 2022 00:59:46 +0000 (20:59 -0400)
committerDavid Wells <drwells@email.unc.edu>
Mon, 7 Nov 2022 12:56:35 +0000 (07:56 -0500)
None of the inheriting classes add any class members so this should be here
instead of in BlockSparsityPattern.

include/deal.II/lac/block_sparsity_pattern.h
source/lac/block_sparsity_pattern.cc

index f1b9298a711e005e4fbed9a6b242b4ae202fa869..469c84bc45230498725ccd31af133e1eb0b9e540 100644 (file)
@@ -310,6 +310,13 @@ public:
   void
   print_svg(std::ostream &out) const;
 
+  /**
+   * Determine an estimate for the memory consumption (in bytes) of this
+   * object.
+   */
+  std::size_t
+  memory_consumption() const;
+
   /**
    * @addtogroup Exceptions
    * @{
@@ -464,13 +471,6 @@ public:
   bool
   is_compressed() const;
 
-  /**
-   * Determine an estimate for the memory consumption (in bytes) of this
-   * object.
-   */
-  std::size_t
-  memory_consumption() const;
-
   /**
    * Copy data from an object of type BlockDynamicSparsityPattern, i.e. resize
    * this object to the size of the given argument, and copy over the contents
index 0f4d67a4e91934c847fad293d2fccdf6eb9bf166..676f9d51419ad3e83526df9a0cbbe460ef10da37 100644 (file)
@@ -362,6 +362,25 @@ BlockSparsityPatternBase<SparsityPatternType>::print_svg(
 
 
 
+template <class SparsityPatternType>
+std::size_t
+BlockSparsityPatternBase<SparsityPatternType>::memory_consumption() const
+{
+  std::size_t mem = 0;
+  mem += (MemoryConsumption::memory_consumption(n_block_rows()) +
+          MemoryConsumption::memory_consumption(n_block_cols()) +
+          MemoryConsumption::memory_consumption(sub_objects) +
+          MemoryConsumption::memory_consumption(row_indices) +
+          MemoryConsumption::memory_consumption(column_indices));
+  for (size_type r = 0; r < n_block_rows(); ++r)
+    for (size_type c = 0; c < n_block_cols(); ++c)
+      mem += MemoryConsumption::memory_consumption(*sub_objects[r][c]);
+
+  return mem;
+}
+
+
+
 BlockSparsityPattern::BlockSparsityPattern(const size_type n_rows,
                                            const size_type n_columns)
   : BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns)
@@ -417,23 +436,6 @@ BlockSparsityPattern::is_compressed() const
 }
 
 
-std::size_t
-BlockSparsityPattern::memory_consumption() const
-{
-  std::size_t mem = 0;
-  mem += (MemoryConsumption::memory_consumption(n_block_rows()) +
-          MemoryConsumption::memory_consumption(n_block_cols()) +
-          MemoryConsumption::memory_consumption(sub_objects) +
-          MemoryConsumption::memory_consumption(row_indices) +
-          MemoryConsumption::memory_consumption(column_indices));
-  for (size_type r = 0; r < n_block_rows(); ++r)
-    for (size_type c = 0; c < n_block_cols(); ++c)
-      mem += MemoryConsumption::memory_consumption(*sub_objects[r][c]);
-
-  return mem;
-}
-
-
 
 void
 BlockSparsityPattern::copy_from(const BlockDynamicSparsityPattern &dsp)

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.