From 8764cf2033e18c9371d4b054b7f68d5e394925e4 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 21 Sep 2007 01:24:55 +0000 Subject: [PATCH] fix missing memory pool git-svn-id: https://svn.dealii.org/trunk@15229 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/pointer_matrix.h | 31 +++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index 9bec2c89d8..a2ca02167d 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -269,21 +269,22 @@ class PointerMatrixAux : public PointerMatrixBase * If M is zero, no * matrix is stored. * - * If mem is zero, a - * PrimitiveVectorMemory is - * generated. + * If mem is zero, the + * VectorMemory::default_pool() + * is used. */ PointerMatrixAux (VectorMemory* mem = 0, const MATRIX* M=0); /** - * Constructor. The name argument - * is used to identify the + * Constructor not using a + * matrix. The name argument is + * used to identify the * SmartPointer for this object. */ PointerMatrixAux(VectorMemory* mem, const char* name); - + /** * Constructor. M points * to a matrix which must live @@ -356,13 +357,13 @@ class PointerMatrixAux : public PointerMatrixBase /** * The backup memory if none was provided. */ - PrimitiveVectorMemory my_memory; + mutable PrimitiveVectorMemory my_memory; /** * Object for getting the * auxiliary vector. */ - SmartPointer > mem; + mutable SmartPointer > mem; /** * The pointer to the actual matrix. @@ -848,7 +849,7 @@ PointerMatrixAux::PointerMatrixAux ( m(M, typeid(*this).name()) { if (mem == 0) - mem = &my_memory; + mem = &VectorMemory::default_pool(); } @@ -860,7 +861,7 @@ PointerMatrixAux::PointerMatrixAux ( m(0, name) { if (mem == 0) - mem = &my_memory; + mem = &VectorMemory::default_pool(); } @@ -873,7 +874,7 @@ PointerMatrixAux::PointerMatrixAux ( m(M, name) { if (mem == 0) - mem = &my_memory; + mem = &VectorMemory::default_pool(); } @@ -918,6 +919,8 @@ inline void PointerMatrixAux::vmult (VECTOR& dst, const VECTOR& src) const { + if (mem == 0) + mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); Assert (m != 0, ExcNotInitialized()); m->vmult (dst, src); @@ -929,6 +932,8 @@ inline void PointerMatrixAux::Tvmult (VECTOR& dst, const VECTOR& src) const { + if (mem == 0) + mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); Assert (m != 0, ExcNotInitialized()); m->Tvmult (dst, src); @@ -940,6 +945,8 @@ inline void PointerMatrixAux::vmult_add (VECTOR& dst, const VECTOR& src) const { + if (mem == 0) + mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); Assert (m != 0, ExcNotInitialized()); VECTOR* v = mem->alloc(); @@ -955,6 +962,8 @@ inline void PointerMatrixAux::Tvmult_add (VECTOR& dst, const VECTOR& src) const { + if (mem == 0) + mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); Assert (m != 0, ExcNotInitialized()); VECTOR* v = mem->alloc(); -- 2.39.5