From 0d5431aaba224dc49b097dba23ca7f6a356a43c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 6 Mar 2012 14:00:34 +0100 Subject: [PATCH] Start encapsulating ifs_tpfa driving forces into a managing structure. --- opm/core/pressure/IncompTpfa.cpp | 5 ++++- opm/core/pressure/tpfa/ifs_tpfa.c | 6 ++++-- opm/core/pressure/tpfa/ifs_tpfa.h | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/opm/core/pressure/IncompTpfa.cpp b/opm/core/pressure/IncompTpfa.cpp index ac9552495..74d0472a2 100644 --- a/opm/core/pressure/IncompTpfa.cpp +++ b/opm/core/pressure/IncompTpfa.cpp @@ -105,7 +105,10 @@ namespace Opm } } - ifs_tpfa_assemble(gg, &trans_[0], &src[0], &gpress_omegaweighted_[0], h_); + ifs_tpfa_forces F; + F.src = &src[0]; + + ifs_tpfa_assemble(gg, &F, &trans_[0], &gpress_omegaweighted_[0], h_); linsolver_.solve(h_->A, h_->b, h_->x); diff --git a/opm/core/pressure/tpfa/ifs_tpfa.c b/opm/core/pressure/tpfa/ifs_tpfa.c index 43c5d1fc7..efe81245e 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.c +++ b/opm/core/pressure/tpfa/ifs_tpfa.c @@ -186,8 +186,8 @@ ifs_tpfa_construct(struct UnstructuredGrid *G) /* ---------------------------------------------------------------------- */ void ifs_tpfa_assemble(struct UnstructuredGrid *G, + const struct ifs_tpfa_forces *F, const double *trans, - const double *src, const double *gpress, struct ifs_tpfa_data *h) /* ---------------------------------------------------------------------- */ @@ -223,7 +223,9 @@ ifs_tpfa_assemble(struct UnstructuredGrid *G, } } - h->b[c] += src[c]; + if ((F != NULL) && (F->src != NULL)) { + h->b[c] += F->src[c]; + } } h->A->sa[0] *= 2; diff --git a/opm/core/pressure/tpfa/ifs_tpfa.h b/opm/core/pressure/tpfa/ifs_tpfa.h index 5f9a6fab7..4635ca8c8 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.h +++ b/opm/core/pressure/tpfa/ifs_tpfa.h @@ -38,13 +38,18 @@ struct ifs_tpfa_data { }; +struct ifs_tpfa_forces { + const double *src; +}; + + struct ifs_tpfa_data * ifs_tpfa_construct(struct UnstructuredGrid *G); void ifs_tpfa_assemble(struct UnstructuredGrid *G, + const struct ifs_tpfa_forces *F, const double *trans, - const double *src, const double *gpress, struct ifs_tpfa_data *h);