]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implementation of add function. add_scaled is now deprecated.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 16 Feb 2006 09:59:26 +0000 (09:59 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 16 Feb 2006 09:59:26 +0000 (09:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@12387 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_matrix_base.h
deal.II/lac/include/lac/full_matrix.h
deal.II/lac/include/lac/full_matrix.templates.h
deal.II/lac/include/lac/sparse_matrix.h
deal.II/lac/include/lac/sparse_matrix.templates.h
deal.II/lac/include/lac/sparse_matrix_ez.h
deal.II/lac/source/full_matrix.double.cc
deal.II/lac/source/full_matrix.float.cc

index 0eea778a9239e10f0028f71c99f3619aa3a49a24..2beb4499b35b10bb7aa8d56ab3b33302210fbc73 100644 (file)
@@ -510,9 +510,29 @@ class BlockMatrixBase : public Subscriptor
                                      * this matrix.
                                      */
     template <class BlockMatrixType>
+    void add (const value_type       factor,
+             const BlockMatrixType &matrix);    
+  
+    
+                                    /**
+                                     * @deprecated Add
+                                     * <tt>matrix</tt> scaled by
+                                     * <tt>factor</tt> to this
+                                     * matrix, i.e. the matrix
+                                     * <tt>factor*matrix</tt> is
+                                     * added to <tt>this</tt>.
+                                     *
+                                     * This function is
+                                     * deprecated. Use <tt>add</tt>
+                                     * instead, since this has the
+                                     * same interface as the other
+                                     * matrix and vector classes in
+                                     * the library.
+                                     */
+    template <class BlockMatrixType>
     void add_scaled (const value_type       factor,
                     const BlockMatrixType &matrix);    
-  
+    
                                     /**
                                      * Adding Matrix-vector
                                      * multiplication. Add $M*src$ on
@@ -1469,7 +1489,7 @@ add_scaled (const value_type factor,
 {
   for (unsigned int r=0; r<n_block_rows(); ++r)
     for (unsigned int c=0; c<n_block_cols(); ++c)
-      block(r,c).add_scaled (factor, matrix.block(r,c));
+      block(r,c).add (factor, matrix.block(r,c));
 }
 
 
index c9c921db3c6f01427bfd177a87e4bbb93a6bd8f1..b0be192c326e2cc6da1e098e3ff4b3ff9f1842e4 100644 (file)
@@ -584,11 +584,9 @@ class FullMatrix : public Table<2,number>
                                      */
     FullMatrix & operator /= (const double factor);
     
-                                    /**
-                                     * Add <tt>matrix</tt> scaled by
-                                     * <tt>factor</tt> to this matrix,
-                                     * i.e. the matrix <tt>factor*matrix</tt>
-                                     * is added to <tt>this</tt>.
+                                     /**
+                                     * Weighted addition. The matrix
+                                     * <tt>s*B</tt> is added to <tt>this</tt>.
                                      *
                                      * The source matrix may be a full matrix
                                      * over an arbitrary underlying scalar
@@ -596,23 +594,27 @@ class FullMatrix : public Table<2,number>
                                      * convertible to the data type of this
                                      * matrix.
                                      */
-    template <typename somenumber>
-    void add_scaled (const number factor,
-                    const FullMatrix<somenumber> &matrix);
-
-                                     /**
-                                     * Weighted addition. The matrix
-                                     * <tt>s*B</tt> is added to <tt>this</tt>.
-                                     *
-                                     * This function is deprecated. Use
-                                     * <tt>add_scaled</tt> instead, since
-                                     * this has the same interface as the
-                                     * other matrix classes in the library.
-                                     */
     template<typename number2>
     void add (const number               s,
              const FullMatrix<number2> &B);
 
+                                    /**
+                                     * @deprecated Weighted
+                                     * addition. The matrix
+                                     * <tt>s*B</tt> is added to
+                                     * <tt>this</tt>.
+                                     *
+                                     * This function is
+                                     * deprecated. Use <tt>add</tt>
+                                     * instead, since this has the
+                                     * same interface as the other
+                                     * matrix and vector classes in
+                                     * the library.
+                                     */
+    template <typename somenumber>
+    void add_scaled (const number factor,
+                    const FullMatrix<somenumber> &matrix);
+
                                     /**
                                      * Add rectangular block.
                                      *
index 610a0650c75bbf2a91ce7d88ee9af4f17c99f9b1..856a7656eaeea7388d35a5ea0c387575e2208d5e 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -750,8 +750,8 @@ FullMatrix<number>::print (STREAM             &s,
 template <typename number>
 template <typename number2>
 void
-FullMatrix<number>::add_scaled (const number               s,
-                                const FullMatrix<number2> &src)
+FullMatrix<number>::add (const number               s,
+                        const FullMatrix<number2> &src)
 {
   Assert (!this->empty(), ExcEmptyMatrix());
   
@@ -925,12 +925,13 @@ void FullMatrix<number>::Tadd (const FullMatrix<number2> &src,
 template <typename number>
 template <typename number2>
 void
-FullMatrix<number>::add (const number               s,
-                        const FullMatrix<number2> &src)
+FullMatrix<number>::add_scaled (const number               s,
+                               const FullMatrix<number2> &src)
 {
-                                   // this function is deprecated. forward to
-                                   // the other one
-  add_scaled (s, src);
+                                   // this function is
+                                   // deprecated. forward to the other
+                                   // one
+  add (s, src);
 }
 
 
index c32dd0312fbab4b08894c788e8ab6f6a3b654389..eb75aa6c62bae337a0215f11e1eeb692a32eedea 100644 (file)
@@ -844,6 +844,25 @@ class SparseMatrix : public virtual Subscriptor
                                      * this matrix.
                                      */
     template <typename somenumber>
+    void add (const number factor,
+             const SparseMatrix<somenumber> &matrix);    
+    
+                                    /**
+                                     * @deprecated Add
+                                     * <tt>matrix</tt> scaled by
+                                     * <tt>factor</tt> to this
+                                     * matrix, i.e. the matrix
+                                     * <tt>factor*matrix</tt> is
+                                     * added to <tt>this</tt>.
+                                     *
+                                     * This function is
+                                     * deprecated. Use <tt>add</tt>
+                                     * instead, since this has the
+                                     * same interface as the other
+                                     * matrix and vector classes in
+                                     * the library.
+                                     */
+    template <typename somenumber>
     void add_scaled (const number factor,
                     const SparseMatrix<somenumber> &matrix);
     
index 6d01e4cccbf595eef20faa3a7a08daaa909480ee..1bf79f2d9e5685575ef9d39bfc3baf838a46669e 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -272,8 +272,8 @@ SparseMatrix<number>::copy_from (const FullMatrix<somenumber> &matrix)
 template <typename number>
 template <typename somenumber>
 void
-SparseMatrix<number>::add_scaled (const number factor,
-                                 const SparseMatrix<somenumber> &matrix)
+SparseMatrix<number>::add (const number factor,
+                          const SparseMatrix<somenumber> &matrix)
 {
   Assert (cols != 0, ExcNotInitialized());
   Assert (val != 0, ExcNotInitialized());
@@ -288,6 +288,16 @@ SparseMatrix<number>::add_scaled (const number factor,
 }
 
 
+template <typename number>
+template <typename somenumber>
+void
+SparseMatrix<number>::add_scaled (const number factor,
+                                 const SparseMatrix<somenumber> &matrix)
+{
+  add(factor, matrix);
+}
+
+
 template <typename number>
 template <class OutVector, class InVector>
 void
index cd27fa1f6eafbc256f01c6ddeb276d10e677c4d0..2af048481502d5c1251200f844100b0d7aab129f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -593,6 +593,22 @@ class SparseMatrixEZ : public Subscriptor
                                      * standard @p const_iterator.
                                      */
     template <class MATRIX>
+    void add (const number factor,
+             const MATRIX &matrix);
+
+                                    /**
+                                     * @deprecated Add @p matrix
+                                     * scaled by @p factor to this
+                                     * matrix.
+                                     *
+                                     * This function is
+                                     * deprecated. Use <tt>add</tt>
+                                     * instead, since this has the
+                                     * same interface as the other
+                                     * matrix and vector classes in
+                                     * the library.
+                                     */
+    template <class MATRIX>
     void add_scaled (const number factor,
                     const MATRIX &matrix);
     
@@ -1584,8 +1600,8 @@ template<typename number>
 template <class MATRIX>
 inline
 void
-SparseMatrixEZ<number>::add_scaled (const number factor,
-                                   const MATRIX& M)
+SparseMatrixEZ<number>::add (const number factor,
+                            const MATRIX& M)
 {
   Assert (M.m() == m(), ExcDimensionMismatch(M.m(), m()));
   Assert (M.n() == n(), ExcDimensionMismatch(M.n(), n()));
@@ -1605,6 +1621,17 @@ SparseMatrixEZ<number>::add_scaled (const number factor,
 }
 
 
+template<typename number>
+template <class MATRIX>
+inline
+void
+SparseMatrixEZ<number>::add_scaled (const number factor,
+                                   const MATRIX& M)
+{
+  add (factor, M);
+}
+
+
 template<typename number>
 template <class MATRIXA, class MATRIXB>
 inline void
index ed96b2275091cb25d38cb13e520cc76c734e7ebc..0e80525e22374baf80d3a256173f74519e2e979c 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -32,9 +32,9 @@ template FullMatrix<TYPEMAT>& FullMatrix<TYPEMAT>::operator =(
 template void FullMatrix<TYPEMAT>::fill<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, unsigned, unsigned, unsigned, unsigned);
 template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
+template void FullMatrix<TYPEMAT>::add_scaled<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
-template void FullMatrix<TYPEMAT>::add_scaled<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
index c9fe30d339e5fb020eb0549203debd1a8e7b38a9..d77b4df006fe81790a0c28424ab96c4175446085 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -33,9 +33,9 @@ template FullMatrix<TYPEMAT>& FullMatrix<TYPEMAT>::operator =(
 template void FullMatrix<TYPEMAT>::fill<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, unsigned, unsigned, unsigned, unsigned);
 template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
+template void FullMatrix<TYPEMAT>::add_scaled<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
-template void FullMatrix<TYPEMAT>::add_scaled<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
 template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (
   const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);

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.