]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a few missing assertions
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Jun 2007 05:01:38 +0000 (05:01 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Jun 2007 05:01:38 +0000 (05:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@14802 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparse_matrix.h

index 38fc98b9fb278a0560b75103e9c8a6dafd36cad7..08806e30b43bc689d438a684e97ea3c0d1ed3562 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -327,7 +327,7 @@ class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix<number> >
                                      *
                                      * The matrix must be a single
                                      * square block for this.
-                                   */
+                                     */
     template <typename number2>
     void precondition_Jacobi (Vector<number2>       &dst,
                              const Vector<number2> &src,
@@ -560,7 +560,16 @@ precondition_Jacobi (Vector<number2>       &dst,
                     const Vector<number2> &src,
                     const number           omega) const
 {
-//TODO: Insert assertions
+                                  // check number of blocks. the sizes of the
+                                  // single block is checked in the function
+                                  // we call
+  Assert (this->n_block_cols() == 1,
+         ExcMessage ("This function only works if the matrix has "
+                     "a single block"));
+  Assert (this->n_block_rows() == 1,
+         ExcMessage ("This function only works if the matrix has "
+                     "a single block"));
+
                                    // do a diagonal preconditioning. uses only
                                    // the diagonal blocks of the matrix
   this->block(0,0).precondition_Jacobi (dst, src, omega);

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.