Makes using wrong constructor a compile-time error

Petsc only supports initialisation through the ParameterGroup constructor.
Calling the default, non-arg constructor is a static error, and not
implementing it makes using it break compiles.
This commit is contained in:
Jørgen Kvalsvik 2014-09-22 15:35:57 +02:00
parent ade7aa658e
commit ce3981a55e
2 changed files with 4 additions and 13 deletions

View File

@ -219,11 +219,6 @@ namespace{
} // anonymous namespace. } // anonymous namespace.
LinearSolverPetsc::LinearSolverPetsc()
{
OPM_THROW(std::runtime_error, "Pestc just can be called through paramers.\n");
}
LinearSolverPetsc::LinearSolverPetsc(const parameter::ParameterGroup& param) LinearSolverPetsc::LinearSolverPetsc(const parameter::ParameterGroup& param)
: ksp_type_("gmres") : ksp_type_("gmres")
, pc_type_("sor") , pc_type_("sor")

View File

@ -33,14 +33,10 @@ namespace Opm
{ {
public: public:
/// Default constructor. /// Default constructor.
/// All parameters controlling the solver are defaulted: /// Declared, but not implemented. Petsc can only be created through
/// ksp_type gmres /// the ParameterGroup constructor, everything else is an error. This way
/// pc_type jacobi /// the error is caught compile time and not rune time, which is nice as
/// ksp_view 0 /// it is a static error.
/// ksp_rtol 1e-5
/// ksp_atol 1e-50
/// ksp_dtol 1e5
/// ksp_max_it 1e5
LinearSolverPetsc(); LinearSolverPetsc();
/// Construct from parameters /// Construct from parameters