From 7fb622bba64dfda345f9153b7c8eeb09580c72c7 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 26 Jul 2021 15:03:16 +0200 Subject: [PATCH 1/2] Fixes usage of firstmatrixelement with DUNE 2.8 The function name is now CamelCase and the old naming scheme is deprecated. Hence we use the new naming for 2.8 There was also a compilation problem due to header inclusion order for that function. The compiler did not find our version the correct version. With this change compilation succeeds again. --- opm/simulators/linalg/ilufirstelement.hh | 41 +++++++++++++++++++ .../linalg/istlpreconditionerwrappers.hh | 2 +- opm/simulators/linalg/matrixblock.hh | 15 ++++--- .../linalg/overlappingbcrsmatrix.hh | 1 - .../linalg/overlappingpreconditioner.hh | 4 +- 5 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 opm/simulators/linalg/ilufirstelement.hh diff --git a/opm/simulators/linalg/ilufirstelement.hh b/opm/simulators/linalg/ilufirstelement.hh new file mode 100644 index 000000000..f343ca89a --- /dev/null +++ b/opm/simulators/linalg/ilufirstelement.hh @@ -0,0 +1,41 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ + +#ifndef EWOMS_ILU_FIRSTELEMENT_HH +#define EWOMS_ILU_FIRSTELEMENT_HH +#include +#include + +namespace Opm +{ +template +#if DUNE_VERSION_GTE(DUNE_GRID, 2, 8) +K& firstMatrixElement(MatrixBlock& A) +#else +K& firstmatrixelement(MatrixBlock& A) +#endif +{ return A[0][0]; } +} +#endif // EWOMS_ILU_FIRSTELEMENT_HH + + diff --git a/opm/simulators/linalg/istlpreconditionerwrappers.hh b/opm/simulators/linalg/istlpreconditionerwrappers.hh index 7467c9d26..1404066fb 100644 --- a/opm/simulators/linalg/istlpreconditionerwrappers.hh +++ b/opm/simulators/linalg/istlpreconditionerwrappers.hh @@ -47,7 +47,7 @@ #include #include #include - +#include //definitions needed in next header #include #include diff --git a/opm/simulators/linalg/matrixblock.hh b/opm/simulators/linalg/matrixblock.hh index 7cdf8eb68..1f95bf851 100644 --- a/opm/simulators/linalg/matrixblock.hh +++ b/opm/simulators/linalg/matrixblock.hh @@ -25,12 +25,14 @@ #include #include -#include #include #include -#include +#include +#include + #include +#include namespace Opm { namespace MatrixBlockHelp { @@ -247,10 +249,6 @@ void print_row(std::ostream& s, const Opm::MatrixBlock& A, int precision) { print_row(s, A.asBase(), I, J, therow, width, precision); } -template -K& firstmatrixelement(Opm::MatrixBlock& A) -{ return firstmatrixelement(A.asBase()); } - template struct MatrixDimension > : public MatrixDimension::BaseType> @@ -297,6 +295,11 @@ public: }; #endif +template +struct IsNumber> + : public IsNumber> +{}; + } // end namespace Dune diff --git a/opm/simulators/linalg/overlappingbcrsmatrix.hh b/opm/simulators/linalg/overlappingbcrsmatrix.hh index 75dfafa55..d6f32fc33 100644 --- a/opm/simulators/linalg/overlappingbcrsmatrix.hh +++ b/opm/simulators/linalg/overlappingbcrsmatrix.hh @@ -36,7 +36,6 @@ #include #include - #include #include #include diff --git a/opm/simulators/linalg/overlappingpreconditioner.hh b/opm/simulators/linalg/overlappingpreconditioner.hh index c41995ee3..9b07cf18d 100644 --- a/opm/simulators/linalg/overlappingpreconditioner.hh +++ b/opm/simulators/linalg/overlappingpreconditioner.hh @@ -30,8 +30,8 @@ #include "overlappingscalarproduct.hh" #include - -#include +#include //definitions needed in next header +#include #include From 1c203cd504bfea090234f5e3d1675313adb865b2 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 26 Aug 2021 15:53:47 +0200 Subject: [PATCH 2/2] Use new function FixedSize for DataHandles with DUNE 2.8. The lower case version is deprecated now and will be removed. --- opm/models/parallel/gridcommhandles.hh | 16 ++++++++++++++++ .../linalg/elementborderlistfromgrid.hh | 8 ++++++++ .../linalg/vertexborderlistfromgrid.hh | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/opm/models/parallel/gridcommhandles.hh b/opm/models/parallel/gridcommhandles.hh index 817e21e05..16ba0cc36 100644 --- a/opm/models/parallel/gridcommhandles.hh +++ b/opm/models/parallel/gridcommhandles.hh @@ -58,7 +58,11 @@ public: return codim == commCodim; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { // for each DOF we communicate a single value which has a // fixed size @@ -118,7 +122,11 @@ public: return codim == commCodim; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { // for each DOF we communicate a single value which has a // fixed size @@ -173,7 +181,11 @@ public: return codim == commCodim; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { // for each DOF we communicate a single value which has a // fixed size @@ -230,7 +242,11 @@ public: return codim == commCodim; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { // for each DOF we communicate a single value which has a // fixed size diff --git a/opm/simulators/linalg/elementborderlistfromgrid.hh b/opm/simulators/linalg/elementborderlistfromgrid.hh index 69875230f..dabe6b200 100644 --- a/opm/simulators/linalg/elementborderlistfromgrid.hh +++ b/opm/simulators/linalg/elementborderlistfromgrid.hh @@ -84,7 +84,11 @@ class ElementBorderListFromGrid bool contains(int, int codim) const { return codim == 0; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { return true; } template @@ -174,7 +178,11 @@ class ElementBorderListFromGrid bool contains(int, int codim) const { return codim == 0; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { return true; } template diff --git a/opm/simulators/linalg/vertexborderlistfromgrid.hh b/opm/simulators/linalg/vertexborderlistfromgrid.hh index 4876455a9..8413d1cc8 100644 --- a/opm/simulators/linalg/vertexborderlistfromgrid.hh +++ b/opm/simulators/linalg/vertexborderlistfromgrid.hh @@ -83,7 +83,11 @@ public: bool contains(int dim, int codim) const { return dim == codim; } +#if DUNE_VERSION_LT(DUNE_GRID, 2, 8) bool fixedsize(int, int) const +#else + bool fixedSize(int, int) const +#endif { return true; } template