Backed out changeset 6b1a90716ea5

This commit is contained in:
Bård Skaflestad 2011-10-18 23:17:02 +02:00
parent ceaea9f987
commit 986e8183c4
2 changed files with 3 additions and 61 deletions

View File

@ -17,61 +17,9 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include "sparse_sys.h"
#include "compr_quant.h"
void
compr_quantities_deallocate(struct compr_quantities *cq)
{
if (cq != NULL) {
free(cq->Ac);
}
free(cq);
}
struct compr_quantities *
compr_quantities_allocate(size_t nc, size_t nf, int np)
{
size_t alloc_sz, np2;
struct compr_quantities *cq;
cq = malloc(1 * sizeof *cq);
if (cq != NULL) {
np2 = np * np;
alloc_sz = np2 * nc; /* Ac */
alloc_sz += np2 * nc; /* dAc */
alloc_sz += np2 * nf; /* Af */
alloc_sz += np * nf; /* phasemobf */
alloc_sz += 1 * nc; /* voldiscr */
cq->Ac = malloc(alloc_sz * sizeof *cq->Ac);
if (cq->Ac == NULL) {
compr_quantities_deallocate(cq);
cq = NULL;
} else {
cq->dAc = cq->Ac + (np2 * nc);
cq->Af = cq->dAc + (np2 * nc);
cq->phasemobf = cq->Af + (np2 * nf);
cq->voldiscr = cq->phasemobf + (np * nf);
cq->nphases = np;
vector_zero(alloc_sz, cq->Ac);
}
}
return cq;
}
/* ---------------------------------------------------------------------- */
/* Compute B \ (V') == zeta(cellNo) .* faceFlux2CellFlux(fflux) */
/* ---------------------------------------------------------------------- */

View File

@ -29,21 +29,15 @@ extern "C" {
#endif
struct compr_quantities {
int nphases; /* Number of phases/components */
int nphases; /* Number of phases/components */
double *totcompr; /* Total compressibility per cell */
double *voldiscr; /* Volume discrepancy per cell */
double *Ac; /* RB^{-1} per cell */
double *dAc; /* d/dp (RB^{-1}) per cell */
double *Af; /* RB^{-1} per face */
double *phasemobf; /* Phase mobility per face */
double *voldiscr; /* Volume discrepancy per cell */
};
struct compr_quantities *
compr_quantities_allocate(size_t nc, size_t nf, int np);
void
compr_quantities_deallocate(struct compr_quantities *cq);
void
compr_flux_term(grid_t *G,
const double *fflux,