From 2303c43c03b57d4f8bf77ba63e36a0783895e7b5 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 7 Oct 2015 12:49:05 +0200 Subject: [PATCH] Avoid using bool in the c code --- opm/core/wells.h | 14 ++++++++------ opm/core/wells/wells.c | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/opm/core/wells.h b/opm/core/wells.h index d6737b57..32c4431f 100644 --- a/opm/core/wells.h +++ b/opm/core/wells.h @@ -102,15 +102,17 @@ struct Wells */ char **name; + /** + * Array of flags indicating whether crossflow is allowed or not + * if allow_cf[w] == 0 (false) then crossflow is not allowed in well w. + */ + int *allow_cf; + /** * Internal management structure. */ void *data; - /** - * Array of booleans, if true crossflow is allowed in the well. - */ - bool *allow_cf; }; @@ -190,7 +192,7 @@ create_wells(int nphases, int nwells, int nperf); * ideally be track ordered. * \param[in] WI Well production index per perforation, or NULL. * \param[in] name Name of new well. NULL if no name. - * \param[in] allow_cf Boolean flag to determine whether crossflow is allowed or not. + * \param[in] allow_cf Flag to determine whether crossflow is allowed or not. * \param[in,out] W Existing set of wells to which new well will * be added. * @@ -204,7 +206,7 @@ add_well(enum WellType type , const int *cells , const double *WI , const char *name , - bool allow_cf , + int allow_cf , struct Wells *W ); diff --git a/opm/core/wells/wells.c b/opm/core/wells/wells.c index a30a8380..026b470e 100644 --- a/opm/core/wells/wells.c +++ b/opm/core/wells/wells.c @@ -85,7 +85,7 @@ wells_allocate(int nwells, struct Wells *W) void *type, *depth_ref, *comp_frac; void *well_connpos; void *ctrls, *name; - bool *allow_cf; + void *allow_cf; np = W->number_of_phases; @@ -146,7 +146,7 @@ initialise_new_wells(int nwells, struct Wells *W) W->type [w] = PRODUCER; W->depth_ref[w] = -1.0; W->name [w] = NULL; - W->allow_cf [w] = false; + W->allow_cf [w] = 1; for (p = 0; p < W->number_of_phases; ++p) { W->comp_frac[W->number_of_phases*w + p] = 0.0; @@ -278,7 +278,7 @@ create_wells(int nphases, int nwells, int nperf) W->ctrls = NULL; W->name = NULL; - W->allow_cf = false; + W->allow_cf = NULL; W->data = create_well_mgmt(); @@ -364,7 +364,7 @@ add_well(enum WellType type , const int *cells , const double *WI , /* Well index per perf (or NULL) */ const char *name , /* Well name (or NULL) */ - bool allow_cf , + int allow_cf , struct Wells *W ) /* ---------------------------------------------------------------------- */ {