From e6da69575abad7f0f74b83ccf6c552d1cb522792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 15 Jun 2016 14:18:11 +0200 Subject: [PATCH] Set default solver depending on configuration. --- opm/core/linalg/LinearSolverFactory.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/opm/core/linalg/LinearSolverFactory.cpp b/opm/core/linalg/LinearSolverFactory.cpp index d2bd3120..6cea6924 100644 --- a/opm/core/linalg/LinearSolverFactory.cpp +++ b/opm/core/linalg/LinearSolverFactory.cpp @@ -61,8 +61,18 @@ namespace Opm LinearSolverFactory::LinearSolverFactory(const parameter::ParameterGroup& param) { +#if HAVE_SUITESPARSE_UMFPACK_H + std::string default_solver = "umfpack"; +#elif HAVE_DUNE_ISTL + std::string default_solver = "istl"; +#elif HAVE_PETSC + std::string default_solver = "petsc"; +#else + OPM_THROW(std::runtime_error, "No linear solver available, you must have UMFPACK , dune-istl or Petsc installed to use LinearSolverFactory."); +#endif + const std::string ls = - param.getDefault("linsolver", "umfpack"); + param.getDefault("linsolver", default_solver); if (ls == "umfpack") { #if HAVE_SUITESPARSE_UMFPACK_H