From 4d725c888f3eb2f44314381f3d2a9b2d55f9816d Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 24 Sep 2013 18:12:47 +0000 Subject: [PATCH] Work around a change in PETSc 3.4. git-svn-id: https://svn.dealii.org/trunk@30916 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/petsc_matrix_base.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index fb96b311eb..81780da99d 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -358,13 +358,16 @@ namespace PETScWrappers ierr = MatGetRow(*this, row, &ncols, &colnums, &values); AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); - // then restore the matrix and return the - // number of columns in this row as - // queried previously + // then restore the matrix and return the number of columns in this row as + // queried previously. Starting with PETSc 3.4, MatRestoreRow actually + // resets the last three arguments to zero/NULL, to avoid abuse of pointers + // now dangling. as a consequence, we need to save the size of the array + // and return the saved value. + const PetscInt ncols_saved = ncols; ierr = MatRestoreRow(*this, row, &ncols, &colnums, &values); AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); - return ncols; + return ncols_saved; } -- 2.39.5