From dcd5d2141597098b313f4d65fd328f851012f1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 18 Jun 2020 08:28:20 +0200 Subject: [PATCH] Split constructor to reduce instantiation. Without the split, certain combinations with Dune::Amg::SequentialInformation as template argument for Comm needlessly get instantiated. --- opm/simulators/linalg/PressureSolverPolicy.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/opm/simulators/linalg/PressureSolverPolicy.hpp b/opm/simulators/linalg/PressureSolverPolicy.hpp index 14bee59d4..3f11770f8 100644 --- a/opm/simulators/linalg/PressureSolverPolicy.hpp +++ b/opm/simulators/linalg/PressureSolverPolicy.hpp @@ -60,12 +60,16 @@ namespace Amg PressureInverseOperator(Operator& op, const boost::property_tree::ptree& prm, const Comm& comm) : linsolver_() { - if (op.category() == Dune::SolverCategory::overlapping) { - linsolver_.reset(new Solver(op.getmat(), comm, prm, std::function())); - } else { - linsolver_.reset(new Solver(op.getmat(), prm, std::function())); - } + assert(op.category() == Dune::SolverCategory::overlapping); + linsolver_.reset(new Solver(op.getmat(), comm, prm, std::function())); } + PressureInverseOperator(Operator& op, const boost::property_tree::ptree& prm, const SequentialInformation&) + : linsolver_() + { + assert(op.category() != Dune::SolverCategory::overlapping); + linsolver_.reset(new Solver(op.getmat(), prm, std::function())); + } + Dune::SolverCategory::Category category() const override {