diff --git a/dune/tectonic/localnonlinearity.hh b/dune/tectonic/localnonlinearity.hh index 81c81552dd9af306a5ba44b8f10edb4d8130d9c6..d95e5724cce90c22a312ca03be97ce40a783816a 100644 --- a/dune/tectonic/localnonlinearity.hh +++ b/dune/tectonic/localnonlinearity.hh @@ -99,16 +99,20 @@ template <int dimension> class LocalNonlinearity { y += tmp; } - // TODO: do not evaluate at zero void upperGradient(VectorType const &x, VectorType &ret) const { + double const xnorm = x.two_norm(); + assert(xnorm != 0); + ret = x; - ret *= func_->rightDifferential(x.two_norm()) / x.two_norm(); + ret *= func_->rightDifferential(xnorm) / xnorm; } - // TODO: do not evaluate at zero void lowerGradient(VectorType const &x, VectorType &ret) const { + double const xnorm = x.two_norm(); + assert(xnorm != 0); + ret = x; - ret *= func_->leftDifferential(x.two_norm()) / x.two_norm(); + ret *= func_->leftDifferential(xnorm) / xnorm; } void directionalDomain(VectorType const &, VectorType const &,