From 4091185657679bc6e55a6a2c796cf8cb8c477e85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6=20Fahlke?= <jorrit@jorrit.de>
Date: Thu, 17 Mar 2016 16:34:10 +0100
Subject: [PATCH] [SolverAbort] Exception to be thrown by solvers when they
 cannot continue.

---
 dune/istl/istlexception.hh | 7 +++++++
 dune/istl/solver.hh        | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/dune/istl/istlexception.hh b/dune/istl/istlexception.hh
index d72f6feb7..ffe497070 100644
--- a/dune/istl/istlexception.hh
+++ b/dune/istl/istlexception.hh
@@ -33,6 +33,13 @@ namespace Dune {
     : public BCRSMatrixError
   {};
 
+  //! Thrown when a solver aborts due to some problem.
+  /**
+   * Problems that may cause the solver to abort include a NaN detected during
+   * the convergence check (which may be caused by invalid input data).
+   */
+  class SolverAbort : public ISTLError {};
+
   /** @} end documentation */
 
 } // end namespace
diff --git a/dune/istl/solver.hh b/dune/istl/solver.hh
index 8898d9adf..d010fe09b 100644
--- a/dune/istl/solver.hh
+++ b/dune/istl/solver.hh
@@ -95,6 +95,9 @@ namespace Dune
         \param x The left hand side to store the result in.
         \param b The right hand side
         \param res Object to store the statistics about applying the operator.
+
+        \throw SolverAbort When the solver detects a problem and cannot
+                           continue
      */
     virtual void apply (X& x, Y& b, InverseOperatorResult& res) = 0;
 
@@ -107,6 +110,9 @@ namespace Dune
        \param b The right hand side
        \param reduction The minimum defect reduction to achieve.
        \param res Object to store the statistics about applying the operator.
+
+       \throw SolverAbort When the solver detects a problem and cannot
+                          continue
      */
     virtual void apply (X& x, Y& b, double reduction, InverseOperatorResult& res) = 0;
 
-- 
GitLab