From 09808cabe366b7c4bca41fd025382d1be927638f Mon Sep 17 00:00:00 2001 From: kanschat Date: Mon, 26 Apr 2010 15:22:00 +0000 Subject: [PATCH] store another GrowingVectorMemory in the MGSmoother git-svn-id: https://svn.dealii.org/trunk@21041 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/multigrid/mg_smoother.h | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_smoother.h b/deal.II/deal.II/include/multigrid/mg_smoother.h index ee61655ec2..a08409466f 100644 --- a/deal.II/deal.II/include/multigrid/mg_smoother.h +++ b/deal.II/deal.II/include/multigrid/mg_smoother.h @@ -47,6 +47,24 @@ class MGSmoother : public MGSmootherBase { public: /** + * Constructor. Sets smoothing + * parameters and creates a + * private GrowingVectorMemory + * object to be used to retrieve vectors. + */ + MGSmoother(const unsigned int steps = 1, + const bool variable = false, + const bool symmetric = false, + const bool transpose = false); + + /** + * @deprecated Since + * GrowingVectorMemory now uses a + * joint memory pool, it is + * recommended to use the + * constructor without the memory + * object. + * * Constructor. Sets memory and * smoothing parameters. */ @@ -130,11 +148,13 @@ class MGSmoother : public MGSmootherBase * nonzero. */ unsigned int debug; - /** * Memory for auxiliary vectors. */ SmartPointer, MGSmoother > mem; + + private: + GrowingVectorMemory my_memory; }; @@ -533,6 +553,23 @@ MGSmootherIdentity::clear () //--------------------------------------------------------------------------- +template +inline +MGSmoother::MGSmoother( + const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose) + : + steps(steps), + variable(variable), + symmetric(symmetric), + transpose(transpose), + debug(0), + mem(&my_memory) +{} + + template inline MGSmoother::MGSmoother( @@ -727,9 +764,8 @@ MGSmootherRelaxation::smooth( if (this->variable) steps2 *= (1<<(maxlevel-level)); - GrowingVectorMemory mem2; - typename VectorMemory::Pointer r((this->mem) ? *this->mem : mem2); - typename VectorMemory::Pointer d((this->mem) ? *this->mem : mem2); + typename VectorMemory::Pointer r(*this->mem); + typename VectorMemory::Pointer d(*this->mem); r->reinit(u); d->reinit(u); @@ -963,9 +999,8 @@ MGSmootherPrecondition::smooth( if (this->variable) steps2 *= (1<<(maxlevel-level)); - GrowingVectorMemory mem2; - typename VectorMemory::Pointer r((this->mem) ? *this->mem : mem2); - typename VectorMemory::Pointer d((this->mem) ? *this->mem : mem2); + typename VectorMemory::Pointer r(*this->mem); + typename VectorMemory::Pointer d(*this->mem); r->reinit(u,true); d->reinit(u,true); -- 2.39.5