From 2c2cc8240cd5b43c691e1bf3e9cbcd58c2e0fe29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Fri, 5 Feb 2021 13:35:06 +0100
Subject: [PATCH] [test][newton] use norm() of linear solver

---
 test/nonlinear/newton/test_newton.cc | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/test/nonlinear/newton/test_newton.cc b/test/nonlinear/newton/test_newton.cc
index 5a08387777..248314baf7 100644
--- a/test/nonlinear/newton/test_newton.cc
+++ b/test/nonlinear/newton/test_newton.cc
@@ -2,6 +2,7 @@
 
 #include <iostream>
 #include <cmath>
+#include <cassert>
 #include <iomanip>
 
 #include <dune/common/exceptions.hh>
@@ -60,12 +61,6 @@ public:
 
     ResidualType& residual() { return res_; }
 
-    double residualNorm(const ResidualType& sol)
-    {
-        assembleResidual(sol);
-        return res_[0];
-    }
-
 private:
     JacobianMatrix jac_;
     ResidualType res_;
@@ -77,11 +72,19 @@ public:
     void setResidualReduction(double residualReduction) {}
 
     template<class Vector>
-    bool solve (const double& A, Vector& x, const Vector& b) const
+    bool solve(const double& A, Vector& x, const Vector& b) const
     {
         x[0] = b[0]/A;
         return true;
     }
+
+    double norm(const Dune::BlockVector<double>& residual) const
+    {
+        assert(residual.size() == 1);
+
+        using std::abs;
+        return abs(residual[0]);
+    }
 };
 
 } // end namespace Dumux
-- 
GitLab