]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add some assertions.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 11 Aug 2001 22:04:31 +0000 (22:04 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 11 Aug 2001 22:04:31 +0000 (22:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@4876 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.templates.h

index 7763ded034cd1ff76a46bd14c32e15fa4d7aff03..f05c92f9b835fcda99b7387b40497d0a631e63d4 100644 (file)
@@ -723,13 +723,15 @@ SparseMatrix<number>::threaded_residual (Vector<somenumber>       &dst,
 template <typename number>
 template <typename somenumber>
 void
-SparseMatrix<number>::precondition_Jacobi (Vector<somenumber>dst,
-                                          const Vector<somenumber>src,
-                                          const number om) const
+SparseMatrix<number>::precondition_Jacobi (Vector<somenumber>       &dst,
+                                          const Vector<somenumber> &src,
+                                          const number              om) const
 {
   Assert (cols != 0, ExcMatrixNotInitialized());
   Assert (val != 0, ExcMatrixNotInitialized());
   Assert (m() == n(), ExcMatrixNotSquare());
+  Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n()));
+  Assert (src.size() == n(), ExcDimensionMismatch (src.size(), n()));
 
   const unsigned int n = src.size();
   somenumber              *dst_ptr = dst.begin();
@@ -749,9 +751,9 @@ SparseMatrix<number>::precondition_Jacobi (Vector<somenumber>& dst,
 template <typename number>
 template <typename somenumber>
 void
-SparseMatrix<number>::precondition_SSOR (Vector<somenumber>dst,
-                                        const Vector<somenumber>src,
-                                        const number om) const
+SparseMatrix<number>::precondition_SSOR (Vector<somenumber>       &dst,
+                                        const Vector<somenumber> &src,
+                                        const number              om) const
 {
                                   // to understand how this function works
                                   // you may want to take a look at the CVS
@@ -760,6 +762,8 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber>& dst,
   Assert (cols != 0, ExcMatrixNotInitialized());
   Assert (val != 0, ExcMatrixNotInitialized());
   Assert (m() == n(), ExcMatrixNotSquare());
+  Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n()));
+  Assert (src.size() == n(), ExcDimensionMismatch (src.size(), n()));
 
   const unsigned int  n            = src.size();
   const unsigned int *rowstart_ptr = &cols->rowstart[0];

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.