From 87474285193eb8ec8f11b7553a95e418b6d98bd2 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Sun, 19 Jan 2020 22:07:48 +0100
Subject: [PATCH] [newton] Use auto and decltype to reduce some
 dependencies/type requirements

---
 dumux/nonlinear/newtonsolver.hh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dumux/nonlinear/newtonsolver.hh b/dumux/nonlinear/newtonsolver.hh
index 3f6a7c0284..a770580c4b 100644
--- a/dumux/nonlinear/newtonsolver.hh
+++ b/dumux/nonlinear/newtonsolver.hh
@@ -964,8 +964,9 @@ private:
     void newtonUpdateShiftImpl_(const SolVec &uLastIter,
                                 const SolVec &deltaU)
     {
-        for (int i = 0; i < int(uLastIter.size()); ++i) {
-            typename SolVec::block_type uNewI = uLastIter[i];
+        for (int i = 0; i < int(uLastIter.size()); ++i)
+        {
+            auto uNewI = uLastIter[i];
             uNewI -= deltaU[i];
 
             Scalar shiftAtDof = relativeShiftAtDof_(uLastIter[i], uNewI);
@@ -1054,7 +1055,7 @@ private:
         //! to this field vector type in Dune ISTL
         //! Could be avoided for vectors that already have the right type using SFINAE
         //! but it shouldn't impact performance too much
-        constexpr auto blockSize = JacobianMatrix::block_type::rows;
+        constexpr auto blockSize = std::decay_t<decltype(b[0])>::dimension;
         using BlockType = Dune::FieldVector<Scalar, blockSize>;
         Dune::BlockVector<BlockType> xTmp; xTmp.resize(b.size());
         Dune::BlockVector<BlockType> bTmp(xTmp);
-- 
GitLab