mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: make PreconditionerType an enum class
this to avoid symbol clashes with the implementations. while at it rename it to Type as Preconditioner::PreconditionerType is redundant
This commit is contained in:
@@ -40,13 +40,15 @@ void Preconditioner<block_size>::setOpencl(std::shared_ptr<cl::Context>& context
|
||||
}
|
||||
|
||||
template <unsigned int block_size>
|
||||
std::unique_ptr<Preconditioner<block_size> > Preconditioner<block_size>::create(PreconditionerType type, int verbosity, bool opencl_ilu_parallel) {
|
||||
if (type == PreconditionerType::BILU0) {
|
||||
return std::make_unique<Opm::Accelerator::BILU0<block_size> >(opencl_ilu_parallel, verbosity);
|
||||
} else if (type == PreconditionerType::CPR) {
|
||||
return std::make_unique<Opm::Accelerator::CPR<block_size> >(verbosity, opencl_ilu_parallel);
|
||||
} else if (type == PreconditionerType::BISAI) {
|
||||
return std::make_unique<Opm::Accelerator::BISAI<block_size> >(opencl_ilu_parallel, verbosity);
|
||||
std::unique_ptr<Preconditioner<block_size>>
|
||||
Preconditioner<block_size>::create(Type type, int verbosity, bool opencl_ilu_parallel)
|
||||
{
|
||||
if (type == Type::BILU0) {
|
||||
return std::make_unique<BILU0<block_size> >(opencl_ilu_parallel, verbosity);
|
||||
} else if (type == Type::CPR) {
|
||||
return std::make_unique<CPR<block_size> >(verbosity, opencl_ilu_parallel);
|
||||
} else if (type == Type::BISAI) {
|
||||
return std::make_unique<BISAI<block_size> >(opencl_ilu_parallel, verbosity);
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "Invalid PreconditionerType");
|
||||
}
|
||||
@@ -63,7 +65,7 @@ bool Preconditioner<block_size>::create_preconditioner(BlockedMatrix *mat, [[may
|
||||
}
|
||||
|
||||
#define INSTANTIATE_BDA_FUNCTIONS(n) \
|
||||
template std::unique_ptr<Preconditioner<n> > Preconditioner<n>::create(PreconditionerType, int, bool); \
|
||||
template std::unique_ptr<Preconditioner<n> > Preconditioner<n>::create(Type, int, bool); \
|
||||
template void Preconditioner<n>::setOpencl(std::shared_ptr<cl::Context>&, std::shared_ptr<cl::CommandQueue>&); \
|
||||
template bool Preconditioner<n>::analyze_matrix(BlockedMatrix *, BlockedMatrix *); \
|
||||
template bool Preconditioner<n>::create_preconditioner(BlockedMatrix *, BlockedMatrix *);
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
|
||||
#include <opm/simulators/linalg/bda/opencl/opencl.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Accelerator
|
||||
{
|
||||
|
||||
|
||||
class BlockedMatrix;
|
||||
|
||||
template <unsigned int block_size>
|
||||
@@ -51,13 +52,13 @@ protected:
|
||||
{};
|
||||
|
||||
public:
|
||||
enum PreconditionerType {
|
||||
enum class Type {
|
||||
BILU0,
|
||||
CPR,
|
||||
BISAI
|
||||
};
|
||||
|
||||
static std::unique_ptr<Preconditioner> create(PreconditionerType type, int verbosity, bool opencl_ilu_parallel);
|
||||
static std::unique_ptr<Preconditioner> create(Type type, int verbosity, bool opencl_ilu_parallel);
|
||||
|
||||
virtual ~Preconditioner() = default;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ openclSolverBackend<block_size>::openclSolverBackend(int verbosity_, int maxit_,
|
||||
OPM_THROW(std::logic_error, "Error unknown value for argument --linear-solver, " + linsolver);
|
||||
}
|
||||
|
||||
using PreconditionerType = typename Preconditioner<block_size>::PreconditionerType;
|
||||
using PreconditionerType = typename Preconditioner<block_size>::Type;
|
||||
if (use_cpr) {
|
||||
prec = Preconditioner<block_size>::create(PreconditionerType::CPR, verbosity, opencl_ilu_parallel);
|
||||
} else if (use_isai) {
|
||||
|
||||
Reference in New Issue
Block a user