]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix bug with PETSc SparseMatrix with no local entries
authorTimo Heister <timo.heister@gmail.com>
Wed, 5 Jun 2013 23:34:20 +0000 (23:34 +0000)
committerTimo Heister <timo.heister@gmail.com>
Wed, 5 Jun 2013 23:34:20 +0000 (23:34 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@29776 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_parallel_sparse_matrix.cc

index da6b5f19537a0989d610a3d25c9a9e4e57a0d44e..cc3279d79a0babcad3e46ab9837bedecec75de1f 100644 (file)
@@ -386,7 +386,9 @@ namespace PETScWrappers
             // read the documentation of this
             // class.
             //if (preset_nonzero_locations == true)
+            if (local_rows.n_elements()>0)
               {
+                Assert(local_columns.n_elements()>0, ExcInternalError());
                 // MatMPIAIJSetPreallocationCSR
                 // can be used to allocate the sparsity
                 // pattern of a matrix
@@ -443,8 +445,20 @@ namespace PETScWrappers
                                               &rowstart_in_window[0],
                                               &colnums_in_window[0],
                                               0);
-                compress ();
+              }
+            else
+              {
+                PetscInt i=0;
+                MatMPIAIJSetPreallocationCSR (matrix,
+                                              &i,
+                                              &i,
+                                              0);
+
+
+              }
+            compress (dealii::VectorOperation::insert);
 
+            {
 
                 // Tell PETSc that we are not
                 // planning on adding new entries

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.