]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fix missing memory pool
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Sep 2007 01:24:55 +0000 (01:24 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Sep 2007 01:24:55 +0000 (01:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@15229 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/pointer_matrix.h

index 9bec2c89d8db779e44651be30ec38db27dfad122..a2ca02167dec5bdc40a12a9c21bd9faa8175e44a 100644 (file)
@@ -269,21 +269,22 @@ class PointerMatrixAux : public PointerMatrixBase<VECTOR>
                                      * If <tt>M</tt> is zero, no
                                      * matrix is stored.
                                      *
-                                     * If <tt>mem</tt> is zero, a
-                                     * PrimitiveVectorMemory is
-                                     * generated.
+                                     * If <tt>mem</tt> is zero, the
+                                     * VectorMemory::default_pool()
+                                     * is used.
                                      */
     PointerMatrixAux (VectorMemory<VECTOR>* 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<VECTOR>* mem,
                     const char* name);
-    
+
                                     /**
                                      * Constructor. <tt>M</tt> points
                                      * to a matrix which must live
@@ -356,13 +357,13 @@ class PointerMatrixAux : public PointerMatrixBase<VECTOR>
                                     /**
                                      * The backup memory if none was provided.
                                      */
-    PrimitiveVectorMemory<VECTOR> my_memory;
+    mutable PrimitiveVectorMemory<VECTOR> my_memory;
 
                                     /**
                                      * Object for getting the
                                      * auxiliary vector.
                                      */
-    SmartPointer<VectorMemory<VECTOR> > mem;
+    mutable SmartPointer<VectorMemory<VECTOR> > mem;
     
                                     /**
                                      * The pointer to the actual matrix.
@@ -848,7 +849,7 @@ PointerMatrixAux<MATRIX, VECTOR>::PointerMatrixAux (
                  m(M, typeid(*this).name())
 {
   if (mem == 0)
-    mem = &my_memory;
+    mem = &VectorMemory<VECTOR>::default_pool();
 }
 
 
@@ -860,7 +861,7 @@ PointerMatrixAux<MATRIX, VECTOR>::PointerMatrixAux (
                  m(0, name)
 {
   if (mem == 0)
-    mem = &my_memory;
+    mem = &VectorMemory<VECTOR>::default_pool();
 }
 
 
@@ -873,7 +874,7 @@ PointerMatrixAux<MATRIX, VECTOR>::PointerMatrixAux (
                  m(M, name)
 {
   if (mem == 0)
-    mem = &my_memory;
+    mem = &VectorMemory<VECTOR>::default_pool();
 }
 
 
@@ -918,6 +919,8 @@ inline void
 PointerMatrixAux<MATRIX, VECTOR>::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<MATRIX, VECTOR>::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<MATRIX, VECTOR>::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<MATRIX, VECTOR>::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();

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.