From 2f47c7409176091e3bbb2015ec4f6dfa4a44eb41 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Wed, 14 Mar 2012 16:56:38 +0100
Subject: [PATCH] RuinaFunction: not differentiable for x < 1e-14

---
 dune/tectonic/nicefunction.hh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dune/tectonic/nicefunction.hh b/dune/tectonic/nicefunction.hh
index e284e95a..027d8a4b 100644
--- a/dune/tectonic/nicefunction.hh
+++ b/dune/tectonic/nicefunction.hh
@@ -55,7 +55,7 @@ class RuinaFunction : public NiceFunction {
 
   double virtual leftDifferential(double x) const {
     double const arg = eta_h * x;
-    if (arg == 0) // TODO: Make this controllable
+    if (arg < 1e-14) // TODO: Make this controllable
       return 0;
 
     double const ret = (a * std::log(arg) + c + K);
@@ -67,6 +67,9 @@ class RuinaFunction : public NiceFunction {
   }
 
   double virtual second_deriv(double s) const {
+    if (s < 1e-14) // TODO: Make this controllable
+      return 0;
+
     return coefficientProduct * a / s;
   }
 
-- 
GitLab