]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Extend block matrices.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 May 2000 11:28:42 +0000 (11:28 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 May 2000 11:28:42 +0000 (11:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@2824 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparse_matrix.h
deal.II/lac/include/lac/block_vector.h
deal.II/lac/source/block_vector.cc [new file with mode: 0644]

index 0172d1370577f550f85b35704d37f69ad201aebe..8f8e15c53f6a7367231ae98d1bdde2b66200f092 100644 (file)
@@ -326,7 +326,17 @@ class BlockSparseMatrix : public Subscriptor
                                      * be square for this operation.
                                      */
     template <typename somenumber>
-    somenumber matrix_norm_square (const BlockVector<rows,somenumber> &v) const;
+    somenumber
+    matrix_norm_square (const BlockVector<rows,somenumber> &v) const;
+
+                                    /**
+                                     * Compute the matrix scalar
+                                     * product $\left(u,Mv\right)$.
+                                     */    
+    template <typename somenumber>
+    somenumber
+    matrix_scalar_product (const BlockVector<rows,somenumber>    &u,
+                          const BlockVector<columns,somenumber> &v) const;
     
                                     /**
                                      * Return a (constant) reference
@@ -673,6 +683,23 @@ matrix_norm_square (const BlockVector<rows,somenumber> &v) const
 
 
 
+template <typename number, int  rows, int columns>
+template <typename somenumber>
+somenumber
+BlockSparseMatrix<number,rows,columns>::
+matrix_scalar_product (const BlockVector<rows,somenumber>    &u,
+                      const BlockVector<columns,somenumber> &v) const
+{
+  somenumber result = 0;
+  for (unsigned int row=0; row<rows; ++row)
+    for (unsigned int col=0; col<columns; ++col)
+      result += block(row,col).matrix_scalar_product (u.block(row),
+                                                     v.block(col));
+  return result;
+};
+
+
+
 template <typename number, int  rows, int columns>
 const BlockSparsityPattern<rows,columns> &
 BlockSparseMatrix<number,rows,columns>::get_sparsity_pattern () const
index d7e55fd8feb2064e0ce755c03495015feef63838..238a7bc9f1dfabacf8931754f93f96907d96cb13 100644 (file)
@@ -31,7 +31,7 @@
  * can do, plus the access to a single #Vector# inside the
  * #BlockVector# by #block(i)#.
  *
- * @author Guido Kanschat, 1999
+ * @author Guido Kanschat, 1999; Wolfgang Bangerth, 2000
  */
 template <int n_blocks, typename Number>
 class BlockVector
@@ -225,35 +225,6 @@ class BlockVector
                                      */
     bool all_zero () const;
 
-// See above.    
-//                                  /**
-//                                   * Make the #Vector# class a bit like the
-//                                   * #vector<># class of the C++ standard
-//                                   * library by returning iterators to
-//                                   * the start and end of the elements of this
-//                                   * vector.
-//                                   */
-//      iterator begin ();
-
-//                                  /**
-//                                   * Return constant iterator to the start of
-//                                   * the vectors.
-//                                   */
-//      const_iterator begin () const;
-
-//                                  /**
-//                                   * Return an iterator pointing to the
-//                                   * element past the end of the array.
-//                                   */
-//      iterator end ();
-
-//                                          /**
-//                                   * Return a constant iterator pointing to
-//                                   * the element past the end of the array.
-//                                   */
-//      const_iterator end () const;  
-
-
                                     /**
                                      * @name 2: Data-Access
                                      */
@@ -479,34 +450,6 @@ unsigned int BlockVector<n_blocks,Number>::size () const
 }
 
 
-//  template <int n_blocks, typename Number>
-//  inline
-//  BlockVector<n_blocks,Number>::iterator BlockVector<n_blocks,Number>::begin () {
-//    return &val[0];
-//  };
-
-
-//  template <int n_blocks, typename Number>
-//  inline
-//  BlockVector<n_blocks,Number>::const_iterator BlockVector<n_blocks,Number>::begin () const {
-//    return &val[0];
-//  };
-
-
-//  template <int n_blocks, typename Number>
-//  inline
-//  BlockVector<n_blocks,Number>::iterator BlockVector<n_blocks,Number>::end () {
-//    return &val[dim];
-//  };
-
-
-//  template <typename Number>
-//  inline
-//  BlockVector<n_blocks,Number>::const_iterator BlockVector<n_blocks,Number>::end () const {
-//    return &val[dim];
-//  };
-
-
 template <int n_blocks, typename Number>
 inline
 Number BlockVector<n_blocks,Number>::operator() (const unsigned int i) const
diff --git a/deal.II/lac/source/block_vector.cc b/deal.II/lac/source/block_vector.cc
new file mode 100644 (file)
index 0000000..bdfe9dc
--- /dev/null
@@ -0,0 +1,21 @@
+//----------------------------  block_vector.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2000 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  block_vector.cc  ---------------------------
+
+#include <lac/block_vector.templates.h>
+
+// explicit instantiations
+template class BlockVector<2,double>;
+template class BlockVector<3,double>;
+
+template class BlockVector<2,float>;
+template class BlockVector<3,float>;

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.