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:
Bård Skaflestad 2012-06-11 17:54:23 +02:00
parent c42b24612b
commit 3864afe8e2

View File

@ -55,20 +55,29 @@ namespace Opm
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 HAVE_SUITESPARSE_UMFPACK_H
solver_.reset(new LinearSolverUmfpack);
#else
THROW("Linear solver " << ls <<" is not available.");
#endif
} else if (ls == "istl") {
}
else if (ls == "istl") {
#if HAVE_DUNE_ISTL
solver_.reset(new LinearSolverIstl(param));
#else
THROW("Linear solver " << ls <<" is not available.");
#endif
}
else {
THROW("Linear solver " << ls << " is unknown.");
}
if (! solver_) {
THROW("Linear solver " << ls << " is not enabled in "
"this configuration.");
}
}