From f5cb35fe978e04156de0d49d1811dad7ef7ab1ab Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Wed, 14 Dec 2011 14:59:17 +0100 Subject: [PATCH] Assertions --- dune/tectonic/localnonlinearity.hh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dune/tectonic/localnonlinearity.hh b/dune/tectonic/localnonlinearity.hh index 81c81552..d95e5724 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 &, -- GitLab