]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Let the matrix subscribe to the sparsity pattern.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Aug 1999 13:16:13 +0000 (13:16 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Aug 1999 13:16:13 +0000 (13:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@1632 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/Todo
deal.II/lac/include/lac/sparse_matrix.templates.h

index 6f772a747965a449f165d51353c7202d140a138b..73e47b6b5dd30495a1c41f69ba0afa9dfdb9e64c 100644 (file)
@@ -17,10 +17,6 @@ Let dSMatrixStruct::compress free the memory of colnums which is
   no longer needed.
 
 
-Let dSMatrixStruct be derived from Subscriptor and let the dSMatrix
-  subscribe to that. The present behaviour is just about to dangerous.
-
-
 Use memcpy in dSMatrix::copy_from instead of elementwise copying.
   This should yield a significant speed-up.
 
index 3ebf0eca2fa3ec936cf1237260b8e3f9d35247aa..a8c60cc9de0630d4f59d3efea5294e202d80581d 100644 (file)
@@ -37,6 +37,8 @@ SparseMatrix<number>::SparseMatrix (const SparseMatrix &m) :
   Assert (m.max_len==0, ExcInvalidConstructorCall());
 };
 
+
+
 template <typename number>
 SparseMatrix<number>&
 SparseMatrix<number>::operator = (const SparseMatrix<number> &m)
@@ -47,7 +49,8 @@ SparseMatrix<number>::operator = (const SparseMatrix<number> &m)
 
   return *this;
 };
-  
+
+
 
 template <typename number>
 SparseMatrix<number>::SparseMatrix (const SparseMatrixStruct &c) :
@@ -55,6 +58,7 @@ SparseMatrix<number>::SparseMatrix (const SparseMatrixStruct &c) :
                val(0),
                max_len(0)
 {
+  cols->subscribe ();
   reinit();
 };
 
@@ -63,7 +67,11 @@ SparseMatrix<number>::SparseMatrix (const SparseMatrixStruct &c) :
 template <typename number>
 SparseMatrix<number>::~SparseMatrix ()
 {
-  delete[] val;
+  if (cols != 0)
+    cols->unsubscribe();
+  
+  if (val != 0)
+    delete[] val;
 };
 
 
@@ -100,7 +108,12 @@ template <typename number>
 void
 SparseMatrix<number>::reinit (const SparseMatrixStruct &sparsity)
 {
+  if (cols != 0)
+    cols->unsubscribe();
+  
   cols = &sparsity;
+  cols->subscribe();
+  
   reinit ();
 };
 

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.