Initialize Petsc from constructor.

Remove private members for initializing Petsc.
This commit is contained in:
Liu Ming
2014-05-16 14:53:49 +08:00
parent a0bf6042da
commit 46fca4d9fc
3 changed files with 5 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
#include "config.h"
#include <opm/core/linalg/LinearSolverPetsc.hpp>
#include <opm/core/linalg/call_petsc.h>
#include <petsc.h>
#include <opm/core/utility/ErrorMacros.hpp>
namespace Opm
{
@@ -32,7 +33,7 @@ namespace Opm
LinearSolverPetsc::LinearSolverPetsc(const parameter::ParameterGroup& param)
, ksp_type_("gmres")
: ksp_type_("gmres")
, pc_type_("sor")
, view_ksp_(false)
, rtol_(1e-5)
@@ -90,7 +91,7 @@ namespace Opm
break;
}
}
call_Petsc(size, nonzeros, ia, ja, sa, rhs, solution, argc_, argv_, ksp_type, pc_type, rtol_, atol_, dtol_, maxits_, view_ksp_);
call_Petsc(size, nonzeros, ia, ja, sa, rhs, solution, ksp_type, pc_type, rtol_, atol_, dtol_, maxits_, view_ksp_);
LinearSolverReport rep = {};
rep.converged = true;
return rep;

View File

@@ -243,7 +243,7 @@ set_ksp_opts(const int ksp_type, const int pc_type, const double rtol, const dou
}
int
call_Petsc(const int size, const int nonzeros, const int* ia, const int* ja, const double* sa, const double* b, double* x, int argc, char** argv, const int ksp_type, const int pc_type, const double rtol, const double atol, const double dtol, const int maxits, const int view_ksp)
call_Petsc(const int size, const int nonzeros, const int* ia, const int* ja, const double* sa, const double* b, double* x, const int ksp_type, const int pc_type, const double rtol, const double atol, const double dtol, const int maxits, const int view_ksp)
{
OEM_DATA* t;
KSP_OPT* opts;

View File

@@ -31,7 +31,7 @@
extern "C" {
#endif
int
call_Petsc(const int size, const int nonzeros, const int* ia, const int* ja, const double* sa, const double* b, double* x, int argc, char** argv, const int ksp_type, const int pc_type, const double rtol, const double atol, const double dtol, const int maxits, const int view_ksp);
call_Petsc(const int size, const int nonzeros, const int* ia, const int* ja, const double* sa, const double* b, double* x, const int ksp_type, const int pc_type, const double rtol, const double atol, const double dtol, const int maxits, const int view_ksp);
#ifdef __cplusplus
}