]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix BlockVectorBase::memory_consumption. 3432/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Nov 2016 16:57:28 +0000 (11:57 -0500)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Nov 2016 16:57:28 +0000 (11:57 -0500)
The existing implementation forgot to add the memory required for
the std::vector of blocks, it only added the memory required for
the blocks themselves. It turns out that fixing this also allows
to simplify the code significantly.

include/deal.II/lac/block_vector_base.h

index 0bc19dd96a5441f0ff234253f5cf83c6f2ff716b..7ebd90efbe17241f16677b8988f3c18b59d74d60 100644 (file)
@@ -2049,11 +2049,9 @@ template <class VectorType>
 std::size_t
 BlockVectorBase<VectorType>::memory_consumption () const
 {
-  std::size_t mem = MemoryConsumption::memory_consumption (this->block_indices);
-  for (size_type i=0; i<this->components.size(); ++i)
-    mem += MemoryConsumption::memory_consumption (this->components[i]);
-
-  return mem;
+  return (MemoryConsumption::memory_consumption (this->block_indices)
+          +
+          MemoryConsumption::memory_consumption (this->components));
 }
 
 

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.