]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed: PETScWrappers:MPI:SparseMatrix and apply_boundary_values() produced an error...
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 Feb 2011 23:47:14 +0000 (23:47 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 Feb 2011 23:47:14 +0000 (23:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@23422 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/lac/petsc_parallel_sparse_matrix.cc

index 69369ef287ccb5056035aed7265872ba4d151008..74ece855af7c389b1e96d5ecd3676b617f662a7d 100644 (file)
@@ -84,6 +84,11 @@ should be fixed now.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: PETScWrappers:MPI:SparseMatrix and apply_boundary_values() produced an error in debug mode about non-existant SparsityPattern entries. Reason: clear_rows() also eliminated the whole row in the PETSc-internal SparsityPattern, which resulted in an error in the next assembly process.
+<br>
+(Timo Heister, 2011/02/23)
+</li>
+
 <li> Fixed: It wasn't possible to use the FE_Nothing element inside an FESystem
 object and hand the result over to an FEValues object. This is now fixed.
 <br>
index 5fa947c3c73cf2a744e77e13666f53241bc1e32c..e5287a1698a55669889176af2181037fa2ef7ab8 100644 (file)
@@ -530,9 +530,9 @@ namespace PETScWrappers
                                           // Tell PETSc that we are not
                                           // planning on adding new entries
                                           // to the matrix. Generate errors
-                                          // in debugmode.
-#if DEAL_II_PETSC_VERSION_LT(3,0,0)
+                                          // in debug mode.
           int ierr;
+#if DEAL_II_PETSC_VERSION_LT(3,0,0)
 #ifdef DEBUG
          ierr = MatSetOption (matrix, MAT_NEW_NONZERO_LOCATION_ERR);
          AssertThrow (ierr == 0, ExcPETScError(ierr));
@@ -541,7 +541,6 @@ namespace PETScWrappers
          AssertThrow (ierr == 0, ExcPETScError(ierr));
 #endif  
 #else
-          int ierr;
 #ifdef DEBUG
          ierr = MatSetOption (matrix, MAT_NEW_NONZERO_LOCATION_ERR, PETSC_TRUE);
          AssertThrow (ierr == 0, ExcPETScError(ierr));
@@ -550,6 +549,22 @@ namespace PETScWrappers
          AssertThrow (ierr == 0, ExcPETScError(ierr));
 #endif
 #endif
+
+                                          // Tell PETSc to keep the
+                                          // SparsityPattern entries even if
+                                          // we delete a row with
+                                          // clear_rows() which calls
+                                          // MatZeroRows(). Otherwise one can
+                                          // not write into that row
+                                          // afterwards.
+#if DEAL_II_PETSC_VERSION_LT(3,1,0)
+         ierr = MatSetOption (matrix, MAT_KEEP_ZEROED_ROWS, PETSC_TRUE);
+         AssertThrow (ierr == 0, ExcPETScError(ierr));
+#else
+         ierr = MatSetOption (matrix, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
+         AssertThrow (ierr == 0, ExcPETScError(ierr));
+#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.