]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a problem with the newly introduced copy operator.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 8 Jun 1999 16:02:28 +0000 (16:02 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 8 Jun 1999 16:02:28 +0000 (16:02 +0000)
git-svn-id: https://svn.dealii.org/trunk@1386 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/source/sparse_matrix.cc

index 7304fae8afbbfa7c442a3394b0b0e8960b1ba534..f2fbec3589fcbd537d67aebe94466b4d25cde5e0 100644 (file)
@@ -88,6 +88,14 @@ class SparseMatrixStruct : public Subscriptor
     SparseMatrixStruct (const unsigned int n,
                        const unsigned int max_per_row);
 
+                                    /**
+                                     * Copy operator. For this the same holds
+                                     * as for the copy constructor: it is
+                                     * declared, defined and fine to be called,
+                                     * but the latter only for empty objects.
+                                     */
+    SparseMatrixStruct & operator = (const SparseMatrixStruct &);
+
                                     /**
                                      * Make a copy with extra off-diagonals.
                                      *
@@ -535,14 +543,6 @@ class SparseMatrixStruct : public Subscriptor
                                      */
     bool compressed;
 
-                                    /**
-                                     * Copy operator. Declare but don't
-                                     * define it and make it private above
-                                     * that to avoid that anyone tries to
-                                     * use this operator.
-                                     */
-    SparseMatrixStruct & operator = (const SparseMatrixStruct &);
-
     
     template <typename number> friend class SparseMatrix;
 };
index d1ae0644c541874a50af15bf4a265e1ba2610e18..63650cbe30b8f6e11323eee1bc4636779d7eb14f 100644 (file)
@@ -164,6 +164,26 @@ SparseMatrixStruct::~SparseMatrixStruct ()
 
 
 
+SparseMatrixStruct &
+SparseMatrixStruct::opertor = (const SparseMatrixStruct &s)
+{
+  Assert (s.rowstart == 0, ExcInvalidConstructorCall());
+  Assert (s.colnums == 0, ExcInvalidConstructorCall());
+  Assert (s.rows == 0, ExcInvalidConstructorCall());
+  Assert (s.cols == 0, ExcInvalidConstructorCall());
+
+                                  // no need to free existing arrays, since we
+                                  // should never get here.
+  max_dim = 0;
+  max_vec_len = 0;
+  rowstart = 0;
+  colnums = 0;
+  
+  reinit (0,0,0);
+};
+
+
+
 
 void
 SparseMatrixStruct::reinit (const unsigned int m,

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.