mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Constructor: Move common failure mode to end of if-else chain.
While here, add a failure mode pertaining to solvers that are supported by the system but disabled at configure time.
This commit is contained in:
parent
c42b24612b
commit
3864afe8e2
@ -55,20 +55,29 @@ namespace Opm
|
|||||||
|
|
||||||
LinearSolverFactory::LinearSolverFactory(const parameter::ParameterGroup& param)
|
LinearSolverFactory::LinearSolverFactory(const parameter::ParameterGroup& param)
|
||||||
{
|
{
|
||||||
const std::string ls = param.getDefault<std::string>("linsolver", "umfpack");
|
const std::string ls =
|
||||||
|
param.getDefault<std::string>("linsolver", "umfpack");
|
||||||
|
|
||||||
if (ls == "umfpack") {
|
if (ls == "umfpack") {
|
||||||
#if HAVE_SUITESPARSE_UMFPACK_H
|
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||||
solver_.reset(new LinearSolverUmfpack);
|
solver_.reset(new LinearSolverUmfpack);
|
||||||
#else
|
|
||||||
THROW("Linear solver " << ls <<" is not available.");
|
|
||||||
#endif
|
#endif
|
||||||
} else if (ls == "istl") {
|
}
|
||||||
|
|
||||||
|
else if (ls == "istl") {
|
||||||
#if HAVE_DUNE_ISTL
|
#if HAVE_DUNE_ISTL
|
||||||
solver_.reset(new LinearSolverIstl(param));
|
solver_.reset(new LinearSolverIstl(param));
|
||||||
#else
|
|
||||||
THROW("Linear solver " << ls <<" is not available.");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
THROW("Linear solver " << ls << " is unknown.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! solver_) {
|
||||||
|
THROW("Linear solver " << ls << " is not enabled in "
|
||||||
|
"this configuration.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user