Add HAVE_PETSC macro.
This commit is contained in:
parent
399a8f6884
commit
d8962ff1ce
@ -31,7 +31,10 @@
|
||||
#include <opm/core/linalg/LinearSolverIstl.hpp>
|
||||
#endif
|
||||
|
||||
#if HAVE_PETSC
|
||||
#include <opm/core/linalg/LinearSolverPetsc.hpp>
|
||||
#endif
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <string>
|
||||
@ -46,9 +49,9 @@ namespace Opm
|
||||
solver_.reset(new LinearSolverUmfpack);
|
||||
#elif HAVE_DUNE_ISTL
|
||||
solver_.reset(new LinearSolverIstl);
|
||||
#else
|
||||
#elif HAVE_PETSC
|
||||
solver_.reset(new LinearSolverPetsc);
|
||||
|
||||
#else
|
||||
OPM_THROW(std::runtime_error, "No linear solver available, you must have UMFPACK , dune-istl or Petsc installed to use LinearSolverFactory.");
|
||||
#endif
|
||||
}
|
||||
@ -73,7 +76,9 @@ namespace Opm
|
||||
#endif
|
||||
}
|
||||
else if (ls == "petsc"){
|
||||
#if HAVE_PETSC
|
||||
solver_.reset(new LinearSolverPetsc(param));
|
||||
#endif
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -42,16 +42,19 @@ namespace Opm
|
||||
|
||||
/// Construct from parameters.
|
||||
/// The accepted parameters are (default) (allowed values):
|
||||
/// linsolver ("umfpack") ("umfpack", "istl")
|
||||
/// linsolver ("umfpack") ("umfpack", "istl", "petsc")
|
||||
/// For the umfpack solver to be available, this class must be
|
||||
/// compiled with UMFPACK support, as indicated by the
|
||||
/// variable HAVE_SUITESPARSE_UMFPACK_H in config.h.
|
||||
/// For the istl solver to be available, this class must be
|
||||
/// compiled with dune-istl support, as indicated by the
|
||||
/// variable HAVE_DUNE_ISTL in config.h.
|
||||
/// For the petsc solver to be available, this class must be
|
||||
/// compiled with petsc support, as indicated by the
|
||||
/// variable HAVE_PETSC in config.h.
|
||||
/// Any further parameters are passed on to the constructors
|
||||
/// of the actual solver used, see LinearSolverUmfpack
|
||||
/// and LinearSolverIstl for details.
|
||||
/// of the actual solver used, see LinearSolverUmfpack,
|
||||
/// LinearSolverIstl and LinearSolverPetsc for details.
|
||||
LinearSolverFactory(const parameter::ParameterGroup& param);
|
||||
|
||||
/// Destructor.
|
||||
|
@ -185,6 +185,7 @@ BOOST_AUTO_TEST_CASE(KAMGTest)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_PETSC
|
||||
BOOST_AUTO_TEST_CASE(PETScTest)
|
||||
{
|
||||
Opm::parameter::ParameterGroup param;
|
||||
@ -195,3 +196,4 @@ BOOST_AUTO_TEST_CASE(PETScTest)
|
||||
param.insertParameter(std::string("ksp_view"), std::string("0"));
|
||||
run_test(param);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user