From 83a5cf1f919f71552577ff091eaa78178baf3139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 13 Feb 2020 11:03:05 +0100 Subject: [PATCH 1/2] Do not use std::pointer_to_binary_function. Removed from C++17. --- .../linalg/ParallelIstlInformation.hpp | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/opm/simulators/linalg/ParallelIstlInformation.hpp b/opm/simulators/linalg/ParallelIstlInformation.hpp index b446774ef..58e542293 100644 --- a/opm/simulators/linalg/ParallelIstlInformation.hpp +++ b/opm/simulators/linalg/ParallelIstlInformation.hpp @@ -580,12 +580,17 @@ private: /// /// To be used with ParallelISTLInformation::computeReduction. template - MaskToMinOperator > - makeGlobalMaxFunctor() + auto makeGlobalMaxFunctor() { - return MaskToMinOperator > - (std::pointer_to_binary_function - ((const T&(*)(const T&, const T&))std::max)); + struct MaxOp + { + using result_type = T; + const T& operator()(const T& t1, const T& t2) + { + return std::max(t1, t2); + } + }; + return MaskToMinOperator(MaxOp()); } namespace detail @@ -630,12 +635,18 @@ private: /// /// To be used with ParallelISTLInformation::computeReduction. template - MaskToMaxOperator > + auto makeGlobalMinFunctor() { - return MaskToMaxOperator > - (std::pointer_to_binary_function - ((const T&(*)(const T&, const T&))std::min)); + struct MinOp + { + using result_type = T; + const T& operator()(const T& t1, const T& t2) + { + return std::min(t1, t2); + } + }; + return MaskToMaxOperator(MinOp()); } template InnerProductFunctor From 2cbeff2acaef94f1cced9882a985520656b06888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 13 Feb 2020 11:04:02 +0100 Subject: [PATCH 2/2] Silence warnings. --- opm/simulators/linalg/bda/BdaBridge.cpp | 10 ++++++++-- opm/simulators/linalg/bda/BdaBridge.hpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/opm/simulators/linalg/bda/BdaBridge.cpp b/opm/simulators/linalg/bda/BdaBridge.cpp index 7ca3c6232..a78eb3084 100644 --- a/opm/simulators/linalg/bda/BdaBridge.cpp +++ b/opm/simulators/linalg/bda/BdaBridge.cpp @@ -35,13 +35,19 @@ typedef Dune::InverseOperatorResult InverseOperatorResult; namespace Opm { -BdaBridge::BdaBridge(bool use_gpu_ OPM_UNUSED, int linear_solver_verbosity OPM_UNUSED, int maxit OPM_UNUSED, double tolerance OPM_UNUSED) : use_gpu(use_gpu_) { #if HAVE_CUDA +BdaBridge::BdaBridge(bool use_gpu_, int linear_solver_verbosity, int maxit, double tolerance) + : use_gpu(use_gpu_) +{ if (use_gpu) { backend.reset(new cusparseSolverBackend(linear_solver_verbosity, maxit, tolerance)); } -#endif } +#else +BdaBridge::BdaBridge(bool use_gpu_ OPM_UNUSED, int linear_solver_verbosity OPM_UNUSED, int maxit OPM_UNUSED, double tolerance OPM_UNUSED) +{ +} +#endif diff --git a/opm/simulators/linalg/bda/BdaBridge.hpp b/opm/simulators/linalg/bda/BdaBridge.hpp index 7d7317cd8..d1ae954e8 100644 --- a/opm/simulators/linalg/bda/BdaBridge.hpp +++ b/opm/simulators/linalg/bda/BdaBridge.hpp @@ -42,8 +42,8 @@ class BdaBridge private: #if HAVE_CUDA std::unique_ptr backend; -#endif bool use_gpu; +#endif public: /// Construct a BdaBridge