]> https://gitweb.dealii.org/ - dealii.git/commitdiff
make sure that inside solve() PETSc preconditioner has a matrix set
authorDenis Davydov <davydden@gmail.com>
Fri, 1 Jan 2016 11:50:19 +0000 (12:50 +0100)
committerDenis Davydov <davydden@gmail.com>
Fri, 1 Jan 2016 11:50:19 +0000 (12:50 +0100)
source/lac/petsc_solver.cc

index bd8c986476541e1f5e6a4c9dabc1ce01d6f0269f..19372d48b39d7a525b75acd7101eab9148581329 100644 (file)
@@ -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)

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.