From 4aa6216173d1fbfa982b75398582ec79ede23a33 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 29 Dec 2014 20:57:46 -0600 Subject: [PATCH] Now that we no longer take a VectorMemory object as argument, simplify the functioning of the MGSmoother class and its derivatives. --- include/deal.II/multigrid/mg_smoother.h | 31 +++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/include/deal.II/multigrid/mg_smoother.h b/include/deal.II/multigrid/mg_smoother.h index 24fdd64c6c..87b5da9ee1 100644 --- a/include/deal.II/multigrid/mg_smoother.h +++ b/include/deal.II/multigrid/mg_smoother.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 1999 - 2013 by the deal.II authors +// Copyright (C) 1999 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -81,13 +81,16 @@ public: */ void set_debug (const unsigned int level); -private: +protected: /** - * The memory object to be used if none is given to the constructor. + * A memory object to be used for temporary vectors. + * + * The object is marked as mutable since we will need to use it + * to allocate temporary vectors also in functions that are + * const. */ - GrowingVectorMemory my_memory; + mutable GrowingVectorMemory vector_memory; -protected: /** * Number of smoothing steps on the finest level. If no #variable smoothing * is chosen, this is the number of steps on all levels. @@ -116,11 +119,6 @@ protected: * Output debugging information to @p deallog if this is nonzero. */ unsigned int debug; - - /** - * Memory for auxiliary vectors. - */ - SmartPointer, MGSmoother > mem; }; @@ -544,8 +542,7 @@ MGSmoother::MGSmoother( variable(variable), symmetric(symmetric), transpose(transpose), - debug(0), - mem(&my_memory) + debug(0) {} @@ -685,7 +682,7 @@ namespace mg return sizeof(*this) -sizeof(MGLevelObject) + MGLevelObject::memory_consumption() - + this->mem->memory_consumption(); + + this->vector_memory.memory_consumption(); } } @@ -854,7 +851,7 @@ memory_consumption () const return sizeof(*this) + matrices.memory_consumption() + smoothers.memory_consumption() - + this->mem->memory_consumption(); + + this->vector_memory.memory_consumption(); } @@ -1002,8 +999,8 @@ MGSmootherPrecondition::smooth( if (this->variable) steps2 *= (1<<(maxlevel-level)); - typename VectorMemory::Pointer r(*this->mem); - typename VectorMemory::Pointer d(*this->mem); + typename VectorMemory::Pointer r(this->vector_memory); + typename VectorMemory::Pointer d(this->vector_memory); r->reinit(u,true); d->reinit(u,true); @@ -1069,7 +1066,7 @@ memory_consumption () const return sizeof(*this) + matrices.memory_consumption() + smoothers.memory_consumption() - + this->mem->memory_consumption(); + + this->vector_memory.memory_consumption(); } -- 2.39.5