Petsc constructor now uses intialiser list.

The previous implementation set plenty of values in the initialization list and
immediately overwrote these values with values looked up from the param group.
This patch makes it look up the parameteres from the param group argument,
making the constructor simpler.
This commit is contained in:
Jørgen Kvalsvik
2014-09-22 15:44:22 +02:00
parent ce3981a55e
commit 93a8430339

View File

@@ -220,24 +220,17 @@ namespace{
} // anonymous namespace.
LinearSolverPetsc::LinearSolverPetsc(const parameter::ParameterGroup& param)
: ksp_type_("gmres")
, pc_type_("sor")
, ksp_view_(false)
, rtol_(1e-5)
, atol_(1e-50)
, dtol_(1e5)
, maxits_(1e5)
: ksp_type_( param.getDefault( std::string( "ksp_type" ), std::string( "gmres" ) ) )
, pc_type_( param.getDefault( std::string( "pc_type" ), std::string( "sor" ) ) )
, ksp_view_( param.getDefault( std::string( "ksp_view" ), int( false ) ) )
, rtol_( param.getDefault( std::string( "ksp_rtol" ), 1e-5 ) )
, atol_( param.getDefault( std::string( "ksp_atol" ), 1e-50 ) )
, dtol_( param.getDefault( std::string( "ksp_dtol" ), 1e5 ) )
, maxits_( param.getDefault( std::string( "ksp_max_it" ), 1e5 ) )
{
int argc = 0;
char** argv = NULL;
PetscInitialize(&argc, &argv, (char*)0, "Petsc interface for OPM!\n");
ksp_type_ = (param.getDefault("ksp_type", std::string(ksp_type_)));
pc_type_ = (param.getDefault("pc_type", std::string(pc_type_)));
ksp_view_ = (param.getDefault("ksp_view", int(ksp_view_)));
rtol_ = param.getDefault("ksp_rtol", rtol_);
atol_ = param.getDefault("ksp_atol", atol_);
dtol_ = param.getDefault("ksp_dtol", dtol_);
maxits_ = param.getDefault("ksp_max_it", maxits_);
}