From: kanschat Date: Tue, 18 Sep 2007 22:56:02 +0000 (+0000) Subject: PointerMatrixAux has own memory just in case X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db7f68b6c438e5f4b2b00be72861087aadc26656;p=dealii-svn.git PointerMatrixAux has own memory just in case git-svn-id: https://svn.dealii.org/trunk@15221 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index 382b255699..9bec2c89d8 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -16,6 +16,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -267,6 +268,10 @@ class PointerMatrixAux : public PointerMatrixBase * * If M is zero, no * matrix is stored. + * + * If mem is zero, a + * PrimitiveVectorMemory is + * generated. */ PointerMatrixAux (VectorMemory* mem = 0, const MATRIX* M=0); @@ -348,6 +353,11 @@ class PointerMatrixAux : public PointerMatrixBase */ virtual const void* get() const; + /** + * The backup memory if none was provided. + */ + PrimitiveVectorMemory my_memory; + /** * Object for getting the * auxiliary vector. @@ -836,7 +846,10 @@ PointerMatrixAux::PointerMatrixAux ( const MATRIX* M) : mem(mem, typeid(*this).name()), m(M, typeid(*this).name()) -{} +{ + if (mem == 0) + mem = &my_memory; +} template @@ -845,7 +858,10 @@ PointerMatrixAux::PointerMatrixAux ( const char* name) : mem(mem, name), m(0, name) -{} +{ + if (mem == 0) + mem = &my_memory; +} template @@ -855,7 +871,10 @@ PointerMatrixAux::PointerMatrixAux ( const char* name) : mem(mem, name), m(M, name) -{} +{ + if (mem == 0) + mem = &my_memory; +} template @@ -880,6 +899,8 @@ inline void PointerMatrixAux::set_memory(VectorMemory* M) { mem = M; + if (mem == 0) + mem = &my_memory; }