From 4a6bfd46cb9ae492b39d223ea995cec31dd21fbb Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Tue, 3 Jan 2012 16:39:58 +0100 Subject: [PATCH] Do not truncate the gradient out-of-place x/|x| is only a problem if x == 0 just divide by |x|, no matter what non-zero value it is --- dune/tectonic/localnonlinearity.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dune/tectonic/localnonlinearity.hh b/dune/tectonic/localnonlinearity.hh index 838f7050..339959ef 100644 --- a/dune/tectonic/localnonlinearity.hh +++ b/dune/tectonic/localnonlinearity.hh @@ -89,7 +89,7 @@ template <int dimension> class LocalNonlinearity { void addGradient(VectorType const &x, VectorType &y) const { double const xnorm = x.two_norm(); - if (xnorm < 1e-8 or std::isinf(func_->regularity(xnorm))) // TODO + if (xnorm == 0 or std::isinf(func_->regularity(xnorm))) return; // left and right differential coincide in this case -- GitLab