From 2ee6331ac1bc40f0107ddb4dff1a981749253655 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 6 Jan 2014 12:24:32 +0100 Subject: [PATCH] Implemented well_controls_add_new() with well_controls_iset_xxx() functions. --- opm/core/wells/well_controls.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/opm/core/wells/well_controls.c b/opm/core/wells/well_controls.c index 80d6b9e40..cc2b685d4 100644 --- a/opm/core/wells/well_controls.c +++ b/opm/core/wells/well_controls.c @@ -209,14 +209,12 @@ well_controls_add_new(enum WellControlType type , double target , const double * return 0; } - ctrl->type [ctrl->num] = type ; - ctrl->target[ctrl->num] = target; - - if (distr != NULL) { - int offset = ctrl->num * ctrl->number_of_phases; - memcpy(&ctrl->distr[offset] , distr, ctrl->number_of_phases * sizeof * ctrl->distr); - } + well_controls_iset_type( ctrl , ctrl->num , type); + well_controls_iset_target( ctrl , ctrl->num , target); + if (distr != NULL) + well_controls_iset_distr( ctrl , ctrl->num , distr); + ctrl->num += 1; return 1; }