From 27226eaacbd6af180c576c1f1132e22c200c8c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 15 Mar 2012 14:26:40 +0100 Subject: [PATCH] Encapsulate ifs_tpfa pressure solution in ad-hoc structure. This is to limit the number of explicit interface changes when we produce solution variables for wells too. Update callers accordingly. --- opm/core/pressure/IncompTpfa.cpp | 8 +++++--- opm/core/pressure/tpfa/ifs_tpfa.c | 12 ++++++++++-- opm/core/pressure/tpfa/ifs_tpfa.h | 7 +++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/opm/core/pressure/IncompTpfa.cpp b/opm/core/pressure/IncompTpfa.cpp index 5d835eea7..68e0e8e3b 100644 --- a/opm/core/pressure/IncompTpfa.cpp +++ b/opm/core/pressure/IncompTpfa.cpp @@ -118,9 +118,11 @@ namespace Opm pressure.resize(grid_.number_of_cells); faceflux.resize(grid_.number_of_faces); - ifs_tpfa_press_flux(gg, &F, &trans_[0], h_, - &pressure[0], - &faceflux[0]); + ifs_tpfa_solution soln; + soln.cell_press = &pressure[0]; + soln.face_flux = &faceflux[0]; + + ifs_tpfa_press_flux(gg, &F, &trans_[0], h_, &soln); } diff --git a/opm/core/pressure/tpfa/ifs_tpfa.c b/opm/core/pressure/tpfa/ifs_tpfa.c index 30a78ecd9..1cf2564e7 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.c +++ b/opm/core/pressure/tpfa/ifs_tpfa.c @@ -355,14 +355,22 @@ ifs_tpfa_press_flux(struct UnstructuredGrid *G, const struct ifs_tpfa_forces *F, const double *trans, struct ifs_tpfa_data *h, - double *cpress, - double *fflux) + struct ifs_tpfa_solution *soln) /* ---------------------------------------------------------------------- */ { int c1, c2, f; size_t i, j; double dh, s; + double *cpress, *fflux; + + assert (soln != NULL); + assert (soln->cell_press != NULL); + assert (soln->face_flux != NULL); + + cpress = soln->cell_press; + fflux = soln->face_flux ; + /* Assign cell pressure directly from solution vector */ memcpy(cpress, h->x, G->number_of_cells * sizeof *cpress); diff --git a/opm/core/pressure/tpfa/ifs_tpfa.h b/opm/core/pressure/tpfa/ifs_tpfa.h index 53383044f..045688ece 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.h +++ b/opm/core/pressure/tpfa/ifs_tpfa.h @@ -39,6 +39,10 @@ struct ifs_tpfa_data { struct ifs_tpfa_impl *pimpl; }; +struct ifs_tpfa_solution { + double *cell_press; + double *face_flux ; +}; struct ifs_tpfa_forces { const double *src; @@ -62,8 +66,7 @@ ifs_tpfa_press_flux(struct UnstructuredGrid *G, const struct ifs_tpfa_forces *F, const double *trans, struct ifs_tpfa_data *h, - double *cpress, - double *fflux); + struct ifs_tpfa_solution *soln); void ifs_tpfa_destroy(struct ifs_tpfa_data *h);