Avoid using bool in the c code

This commit is contained in:
Tor Harald Sandve
2015-10-07 12:49:05 +02:00
parent 40ec39fa71
commit cf35ecbb05
2 changed files with 12 additions and 10 deletions

View File

@@ -102,15 +102,17 @@ struct Wells
*/ */
char **name; 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. * Internal management structure.
*/ */
void *data; 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. * ideally be track ordered.
* \param[in] WI Well production index per perforation, or NULL. * \param[in] WI Well production index per perforation, or NULL.
* \param[in] name Name of new well. NULL if no name. * \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 * \param[in,out] W Existing set of wells to which new well will
* be added. * be added.
* *
@@ -204,7 +206,7 @@ add_well(enum WellType type ,
const int *cells , const int *cells ,
const double *WI , const double *WI ,
const char *name , const char *name ,
bool allow_cf , int allow_cf ,
struct Wells *W ); struct Wells *W );

View File

@@ -85,7 +85,7 @@ wells_allocate(int nwells, struct Wells *W)
void *type, *depth_ref, *comp_frac; void *type, *depth_ref, *comp_frac;
void *well_connpos; void *well_connpos;
void *ctrls, *name; void *ctrls, *name;
bool *allow_cf; void *allow_cf;
np = W->number_of_phases; np = W->number_of_phases;
@@ -146,7 +146,7 @@ initialise_new_wells(int nwells, struct Wells *W)
W->type [w] = PRODUCER; W->type [w] = PRODUCER;
W->depth_ref[w] = -1.0; W->depth_ref[w] = -1.0;
W->name [w] = NULL; W->name [w] = NULL;
W->allow_cf [w] = false; W->allow_cf [w] = 1;
for (p = 0; p < W->number_of_phases; ++p) { for (p = 0; p < W->number_of_phases; ++p) {
W->comp_frac[W->number_of_phases*w + p] = 0.0; 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->ctrls = NULL;
W->name = NULL; W->name = NULL;
W->allow_cf = false; W->allow_cf = NULL;
W->data = create_well_mgmt(); W->data = create_well_mgmt();
@@ -364,7 +364,7 @@ add_well(enum WellType type ,
const int *cells , const int *cells ,
const double *WI , /* Well index per perf (or NULL) */ const double *WI , /* Well index per perf (or NULL) */
const char *name , /* Well name (or NULL) */ const char *name , /* Well name (or NULL) */
bool allow_cf , int allow_cf ,
struct Wells *W ) struct Wells *W )
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {