]> https://gitweb.dealii.org/ - dealii.git/commitdiff
additional error check in Trilinos SparseMatrix in debug mode
authorTimo Heister <timo.heister@gmail.com>
Thu, 9 Aug 2012 13:41:07 +0000 (13:41 +0000)
committerTimo Heister <timo.heister@gmail.com>
Thu, 9 Aug 2012 13:41:07 +0000 (13:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@25809 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/trilinos_sparse_matrix.cc

index 4ca860c81013e175b19e226b01ff53cf1b12db95..2534911edc1ad5ee8ff7a502c9315c4d6b3b399c 100644 (file)
@@ -911,12 +911,19 @@ namespace TrilinosWrappers
   SparseMatrix::diag_element (const unsigned int i) const
   {
     Assert (m() == n(), ExcNotQuadratic());
-
+    
+#ifdef DEBUG
+                                    // use operator() in debug mode because
+                                    // it checks if this is a valid element
+                                    // (in parallel)
+    return operator()(i,i);
+#else    
                                   // Trilinos doesn't seem to have a
                                   // more efficient way to access the
                                   // diagonal than by just using the
                                   // standard el(i,j) function.
     return el(i,i);
+#endif    
   }
 
 

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.