IncompTpfa now takes a linear solver as a constructor argument.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-02-21 21:45:04 +01:00
parent e52cae02ac
commit 87723a08a0
2 changed files with 10 additions and 5 deletions

View File

@ -21,7 +21,7 @@
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
#include <opm/core/pressure/tpfa/trans_tpfa.h>
#include <opm/core/pressure/mimetic/mimetic.h>
#include <opm/core/linalg/LinearSolverUmfpack.hpp>
#include <opm/core/linalg/LinearSolverInterface.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
namespace Opm
@ -38,8 +38,10 @@ namespace Opm
/// have D elements.
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
const double* permeability,
const double* gravity)
const double* gravity,
const LinearSolverInterface& linsolver)
: grid_(g),
linsolver_(linsolver),
htrans_(g.cell_facepos[ g.number_of_cells ]),
trans_ (g.number_of_faces)
{
@ -105,8 +107,7 @@ namespace Opm
ifs_tpfa_assemble(gg, &trans_[0], &src[0], &gpress_omegaweighted_[0], h_);
LinearSolverUmfpack linsolve;
linsolve.solve(h_->A, h_->b, h_->x);
linsolver_.solve(h_->A, h_->b, h_->x);
pressure.resize(grid_.number_of_cells);
faceflux.resize(grid_.number_of_faces);

View File

@ -30,6 +30,8 @@ struct ifs_tpfa_data;
namespace Opm
{
class LinearSolverInterface;
/// Encapsulating a tpfa pressure solver for the incompressible case.
/// Supports gravity and simple sources as driving forces.
/// Below we use the shortcuts D for the number of dimensions, N
@ -47,7 +49,8 @@ namespace Opm
/// have D elements.
IncompTpfa(const UnstructuredGrid& g,
const double* permeability,
const double* gravity);
const double* gravity,
const LinearSolverInterface& linsolver);
/// Destructor.
~IncompTpfa();
@ -71,6 +74,7 @@ namespace Opm
private:
const UnstructuredGrid& grid_;
const LinearSolverInterface& linsolver_;
::std::vector<double> htrans_;
::std::vector<double> trans_ ;
::std::vector<double> gpress_;