]> https://gitweb.dealii.org/ - dealii.git/commitdiff
changes applied to EZ-matrices, exception moved, documentation fixed
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 18 May 2004 11:33:11 +0000 (11:33 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 18 May 2004 11:33:11 +0000 (11:33 +0000)
git-svn-id: https://svn.dealii.org/trunk@9252 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparse_matrix.h
deal.II/lac/include/lac/block_sparse_matrix_ez.h
deal.II/lac/include/lac/block_sparse_matrix_ez.templates.h
deal.II/lac/include/lac/full_matrix.h
deal.II/lac/include/lac/petsc_matrix_base.h
deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparse_matrix_ez.h
deal.II/lac/include/lac/sparse_matrix_ez.templates.h

index 92f2917c8ebaf8404cbe7c0bdee74ddfa74f3711..7c2b4346a53b78c48140175c74ee6c0c9d86da18 100644 (file)
@@ -896,10 +896,6 @@ class BlockSparseMatrix : public Subscriptor
                                      * Exception
                                      */
     DeclException0 (ExcMatrixNotInitialized);
-                                     /**
-                                      * Exception
-                                      */
-    DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
     
   private:
                                     /**
index 0d8ea22f7b9e2293f366ca9bf967ce035528ae12..ac7b949d1b0cb346d93f52ca2d6b372cb7a26e80 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -80,6 +80,25 @@ class BlockSparseMatrixEZ : public Subscriptor
                                      */
     BlockSparseMatrixEZ & operator = (const BlockSparseMatrixEZ<Number>&);
 
+                                    /**
+                                      * This operator assigns a scalar to
+                                      * a matrix. Since this does usually
+                                      * not make much sense (should we set
+                                      * all matrix entries to this value?
+                                      * Only the nonzero entries of the
+                                      * sparsity pattern?), this operation
+                                      * is only allowed if the actual
+                                      * value to be assigned is zero. This
+                                      * operator only exists to allow for
+                                      * the obvious notation
+                                      * <tt>matrix=0</tt>, which sets all
+                                      * elements of the matrix to zero,
+                                      * but keep the sparsity pattern
+                                      * previously used.
+                                      */
+    BlockSparseMatrixEZ & operator = (const double d);
+
+
                                     /**
                                      * Set matrix to zero dimensions
                                      * and release memory.
index 31dacb2e6aac553e3dd37f12d0f6b1f6dbd01da0..49d835bae15980b96899323bc1e1248d4103ba21 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -77,6 +77,21 @@ operator = (const BlockSparseMatrixEZ<number> &m)
 
  
 
+template <typename number>
+BlockSparseMatrixEZ<number> &
+BlockSparseMatrixEZ<number>::operator = (const double d)
+{
+  Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
+  
+  for (unsigned int r=0; r<n_block_rows(); ++r)
+    for (unsigned int c=0; c<n_block_cols(); ++c)
+      block(r,c) = 0;
+
+  return *this;
+}
+
+
+
 template <typename number>
 BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ (
   const BlockSparseMatrixEZ<number> &m)
index 9d0de45e918e74a1607f5e954fae79489ae09675..6bb359b3aa1962f243e641530fbc6faa8ca0c24e 100644 (file)
@@ -251,17 +251,11 @@ class FullMatrix : public Table<2,number>
     operator = (const FullMatrix<number2>&);
 
                                     /**
-                                     * This operator assigns a scalar to a
-                                     * matrix. Since this does usually not
-                                     * make much sense (should we set all
-                                     * matrix entries to this value? Only the
-                                     * nonzero entries of the sparsity
-                                     * pattern?), this operation is only
-                                     * allowed if the actual value to be
-                                     * assigned is zero. This operator only
-                                     * exists to allow for the obvious
-                                     * notation <tt>matrix=0</tt>, which sets
-                                     * all elements of the matrix to zero.
+                                     * This operator assigns a scalar
+                                     * to a matrix. To avoid
+                                     * confusion with constructors,
+                                     * zero is the only value allowed
+                                     * for <tt>d</tt>
                                      */
     FullMatrix<number> &
     operator = (const double d);
@@ -981,10 +975,6 @@ class FullMatrix : public Table<2,number>
                    << "Target region not in matrix: size in this direction="
                    << arg1 << ", size of new matrix=" << arg2
                    << ", offset=" << arg3);
-                                     /**
-                                      * Exception
-                                      */
-    DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
                                     /**
                                      * Exception
                                      */
index a5ab43a3f34a03391e829b1b415fd68a18a7be6f..f3d4ef3cd04aeefe671f2af808856be3fa940672 100644 (file)
@@ -657,10 +657,6 @@ namespace PETScWrappers
                                         * Exception
                                         */
       DeclException0 (ExcMatrixNotSquare);
-                                       /**
-                                        * Exception
-                                        */
-      DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
       
     protected:
                                        /**
index cf7c480450f8be8473bc8e75696ca0d754b59c61..a4f1243ec8f34f76a48ddf6913ebaad9c8cc35ff 100644 (file)
@@ -1504,10 +1504,6 @@ class SparseMatrix : public virtual Subscriptor
                                       * Exception
                                       */
     DeclException0 (ExcSourceEqualsDestination);
-                                     /**
-                                      * Exception
-                                      */
-    DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
     
   private:
                                     /**
index 187430774d5fadc9354243217024a96ce5872b0c..b7b306ada8767f335890e7526999b0f6b9f4f2bc 100644 (file)
@@ -385,6 +385,24 @@ class SparseMatrixEZ : public Subscriptor
                                      */
     SparseMatrixEZ<number>& operator = (const SparseMatrixEZ<number> &);
 
+                                     /**
+                                      * This operator assigns a scalar to
+                                      * a matrix. Since this does usually
+                                      * not make much sense (should we set
+                                      * all matrix entries to this value?
+                                      * Only the nonzero entries of the
+                                      * sparsity pattern?), this operation
+                                      * is only allowed if the actual
+                                      * value to be assigned is zero. This
+                                      * operator only exists to allow for
+                                      * the obvious notation
+                                      * <tt>matrix=0</tt>, which sets all
+                                      * elements of the matrix to zero,
+                                      * but keep the sparsity pattern
+                                      * previously used.
+                                      */
+    SparseMatrixEZ<number>& operator = (const double d);
+
                                     /**
                                      * Reinitialize the sparse matrix
                                      * to the dimensions provided.
index cd1ea7b5fd6050f4c7b9d49df0c62aa5f6190e10..8fbedad977117cef5066d91f142b5026389e43bf 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -63,6 +63,25 @@ SparseMatrixEZ<number>::operator= (const SparseMatrixEZ<number>& m)
 }
 
 
+template <typename number>
+SparseMatrixEZ<number> &
+SparseMatrixEZ<number>::operator = (const double d)
+{
+  Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
+
+  typename std::vector<Entry>::iterator e = data.begin();
+  const typename std::vector<Entry>::iterator end = data.end();
+  
+  while (e != end)
+    {
+      (e++)->value = 0.;
+    }
+  
+  return *this;
+}
+
+
+
 template <typename number>
 void
 SparseMatrixEZ<number>::reinit(const unsigned int n_rows,

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.