From 87723a08a099277315cd7243e79e66b07be9049b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 21 Feb 2012 21:45:04 +0100 Subject: [PATCH] IncompTpfa now takes a linear solver as a constructor argument. --- opm/core/pressure/IncompTpfa.cpp | 9 +++++---- opm/core/pressure/IncompTpfa.hpp | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/opm/core/pressure/IncompTpfa.cpp b/opm/core/pressure/IncompTpfa.cpp index 19434e1dc..ac9552495 100644 --- a/opm/core/pressure/IncompTpfa.cpp +++ b/opm/core/pressure/IncompTpfa.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include 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); diff --git a/opm/core/pressure/IncompTpfa.hpp b/opm/core/pressure/IncompTpfa.hpp index ed4105acc..c670f611b 100644 --- a/opm/core/pressure/IncompTpfa.hpp +++ b/opm/core/pressure/IncompTpfa.hpp @@ -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 htrans_; ::std::vector trans_ ; ::std::vector gpress_;