diff --git a/dune/tectonic/localnonlinearity.hh b/dune/tectonic/localnonlinearity.hh index 285f309e95d9d4ebd05efa9435d7cf8937c756fc..97f61a1136ad45e0ff2344970bd683fb7ca228ba 100644 --- a/dune/tectonic/localnonlinearity.hh +++ b/dune/tectonic/localnonlinearity.hh @@ -62,6 +62,9 @@ template <int dimension> class LocalNonlinearity { = (h2 - h1ox) * x[i] * x[j] / normX2 */ void addHessian(VectorType const &x, MatrixType &A) const { + if (x == VectorType(0)) + return; + double const normX2 = x.two_norm2(); double const normX = sqrt(normX2); double const h1ox = func_->rightDifferential(normX) / normX; @@ -79,6 +82,9 @@ template <int dimension> class LocalNonlinearity { } void addGradient(VectorType const &x, VectorType &y) const { + if (x == VectorType(0)) + return; + VectorType tmp; upperGradient(x, tmp); // TODO y += tmp;