From: heister Date: Wed, 5 Jun 2013 23:34:20 +0000 (+0000) Subject: fix bug with PETSc SparseMatrix with no local entries X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27f17ea07f3602d16bb5232f2597876bb83ae946;p=dealii-svn.git fix bug with PETSc SparseMatrix with no local entries git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@29776 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index da6b5f1953..cc3279d79a 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -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