]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add two assertions.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Mar 2000 15:05:00 +0000 (15:05 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Mar 2000 15:05:00 +0000 (15:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@2593 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 3fcc408d622384b70ac902895d7636177999a61d..ce27fd0a1e60f2411373491751b5cce9097c7e95 100644 (file)
@@ -764,7 +764,8 @@ SparseMatrix<number>::raw_entry (const unsigned int row,
                                 const unsigned int index) const
 {
   Assert(row<cols->rows, ExcIndexRange(row,0,cols->rows));
-  Assert(index<cols->row_length(row), ExcIndexRange(index,0,cols->row_length(row)));
+  Assert(index<cols->row_length(row),
+        ExcIndexRange(index,0,cols->row_length(row)));
 
   return val[cols->rowstart[row]+index];
 };
@@ -775,6 +776,9 @@ inline
 number SparseMatrix<number>::global_entry (const unsigned int j) const
 {
   Assert (cols != 0, ExcMatrixNotInitialized());
+  Assert (j < cols->n_nonzero_elements(),
+         ExcIndexRange (j, 0, cols->n_nonzero_elements()));
+  
   return val[j];
 };
 
@@ -784,6 +788,9 @@ inline
 number & SparseMatrix<number>::global_entry (const unsigned int j)
 {
   Assert (cols != 0, ExcMatrixNotInitialized());
+  Assert (j < cols->n_nonzero_elements(),
+         ExcIndexRange (j, 0, cols->n_nonzero_elements()));
+
   return val[j];
 };
 

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.