diff --git a/opm/simulators/linalg/bda/opencl/Preconditioner.cpp b/opm/simulators/linalg/bda/opencl/Preconditioner.cpp index 1cf554a05..18144c3de 100644 --- a/opm/simulators/linalg/bda/opencl/Preconditioner.cpp +++ b/opm/simulators/linalg/bda/opencl/Preconditioner.cpp @@ -40,13 +40,15 @@ void Preconditioner::setOpencl(std::shared_ptr& context } template -std::unique_ptr > Preconditioner::create(PreconditionerType type, int verbosity, bool opencl_ilu_parallel) { - if (type == PreconditionerType::BILU0) { - return std::make_unique >(opencl_ilu_parallel, verbosity); - } else if (type == PreconditionerType::CPR) { - return std::make_unique >(verbosity, opencl_ilu_parallel); - } else if (type == PreconditionerType::BISAI) { - return std::make_unique >(opencl_ilu_parallel, verbosity); +std::unique_ptr> +Preconditioner::create(Type type, int verbosity, bool opencl_ilu_parallel) +{ + if (type == Type::BILU0) { + return std::make_unique >(opencl_ilu_parallel, verbosity); + } else if (type == Type::CPR) { + return std::make_unique >(verbosity, opencl_ilu_parallel); + } else if (type == Type::BISAI) { + return std::make_unique >(opencl_ilu_parallel, verbosity); } else { OPM_THROW(std::logic_error, "Invalid PreconditionerType"); } @@ -63,7 +65,7 @@ bool Preconditioner::create_preconditioner(BlockedMatrix *mat, [[may } #define INSTANTIATE_BDA_FUNCTIONS(n) \ -template std::unique_ptr > Preconditioner::create(PreconditionerType, int, bool); \ +template std::unique_ptr > Preconditioner::create(Type, int, bool); \ template void Preconditioner::setOpencl(std::shared_ptr&, std::shared_ptr&); \ template bool Preconditioner::analyze_matrix(BlockedMatrix *, BlockedMatrix *); \ template bool Preconditioner::create_preconditioner(BlockedMatrix *, BlockedMatrix *); diff --git a/opm/simulators/linalg/bda/opencl/Preconditioner.hpp b/opm/simulators/linalg/bda/opencl/Preconditioner.hpp index 4e450bf33..a81145dd3 100644 --- a/opm/simulators/linalg/bda/opencl/Preconditioner.hpp +++ b/opm/simulators/linalg/bda/opencl/Preconditioner.hpp @@ -22,12 +22,13 @@ #include +#include + namespace Opm { namespace Accelerator { - class BlockedMatrix; template @@ -51,13 +52,13 @@ protected: {}; public: - enum PreconditionerType { + enum class Type { BILU0, CPR, BISAI }; - static std::unique_ptr create(PreconditionerType type, int verbosity, bool opencl_ilu_parallel); + static std::unique_ptr create(Type type, int verbosity, bool opencl_ilu_parallel); virtual ~Preconditioner() = default; diff --git a/opm/simulators/linalg/bda/opencl/openclSolverBackend.cpp b/opm/simulators/linalg/bda/opencl/openclSolverBackend.cpp index d515137f3..7a39cf47c 100644 --- a/opm/simulators/linalg/bda/opencl/openclSolverBackend.cpp +++ b/opm/simulators/linalg/bda/opencl/openclSolverBackend.cpp @@ -65,7 +65,7 @@ openclSolverBackend::openclSolverBackend(int verbosity_, int maxit_, OPM_THROW(std::logic_error, "Error unknown value for argument --linear-solver, " + linsolver); } - using PreconditionerType = typename Preconditioner::PreconditionerType; + using PreconditionerType = typename Preconditioner::Type; if (use_cpr) { prec = Preconditioner::create(PreconditionerType::CPR, verbosity, opencl_ilu_parallel); } else if (use_isai) {