From: Denis Davydov Date: Fri, 1 Jan 2016 11:50:19 +0000 (+0100) Subject: make sure that inside solve() PETSc preconditioner has a matrix set X-Git-Tag: v8.4.0-rc2~114^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=babe68f61d1fb4bd4c279ae547576516fa165ddd;p=dealii.git make sure that inside solve() PETSc preconditioner has a matrix set --- diff --git a/source/lac/petsc_solver.cc b/source/lac/petsc_solver.cc index bd8c986476..19372d48b3 100644 --- a/source/lac/petsc_solver.cc +++ b/source/lac/petsc_solver.cc @@ -95,6 +95,12 @@ namespace PETScWrappers ierr = KSPSetPC (solver_data->ksp, preconditioner.get_pc()); AssertThrow (ierr == 0, ExcPETScError(ierr)); + // make sure the preconditioner has an associated matrix set + const Mat B = preconditioner; + AssertThrow (B != NULL, + ExcMessage("PETSc preconditioner should have an" + "associated matrix set to be used in solver.")); + // setting the preconditioner overwrites the used matrices. // hence, we need to set the matrices after the preconditioner. #if DEAL_II_PETSC_VERSION_LT(3, 5, 0)