From 15dc43f2a53e974e0d68a47378301b6260173385 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Fri, 2 Feb 2018 14:19:27 +0100
Subject: [PATCH] [staggered] fix StaggeredNewtonController for use with Dune
 2.5

The function `min` of the `CollectiveCommunication` looks like this
in Dune 2.5:

```
    template<typename T>
    T min (T& in) const
    {
      T out;
```

In the `StaggeredNewtonController` this has been called like this:

```
    const bool converged = solveLinearSystem_...
    int convergedRemote = converged;
    if (this->comm().size() > 1)
        convergedRemote = this->comm().min(converged);
```

Thus, `T` is determined to be `const bool` and setting `T out;`
without initializing it doesn't work (fortunately). Fix by using
`bool` instead of `const bool`.

In Dune 2.6, the same function looks like that:

```
    template<typename T>
    T min (const T& in) const
```

Therefore, `T` is deduced to be `bool` and everything works fine.
Still does after the change.
---
 dumux/nonlinear/staggerednewtoncontroller.hh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dumux/nonlinear/staggerednewtoncontroller.hh b/dumux/nonlinear/staggerednewtoncontroller.hh
index d7cf5919c8..0d197727b0 100644
--- a/dumux/nonlinear/staggerednewtoncontroller.hh
+++ b/dumux/nonlinear/staggerednewtoncontroller.hh
@@ -89,8 +89,8 @@ public:
 
             // solve by calling the appropriate implementation depending on whether the linear solver
             // is capable of handling MultiType matrices or not
-            const bool converged = solveLinearSystem_(ls, A, x, b,
-                                                      std::integral_constant<bool, LinearSolverAcceptsMultiTypeMatrix<LinearSolver>::value>());
+            bool converged = solveLinearSystem_(ls, A, x, b,
+                                                std::integral_constant<bool, LinearSolverAcceptsMultiTypeMatrix<LinearSolver>::value>());
 
             // make sure all processes converged
             int convergedRemote = converged;
-- 
GitLab