mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Added functions to get type, target and distr of *current* control.
This commit is contained in:
parent
4db3a70e05
commit
8132954b85
@ -130,6 +130,9 @@ well_controls_add_new(enum WellControlType type , double target , const double *
|
||||
enum WellControlType
|
||||
well_controls_iget_type(const struct WellControls * ctrl, int control_index);
|
||||
|
||||
enum WellControlType
|
||||
well_controls_get_current_type(const struct WellControls * ctrl);
|
||||
|
||||
void
|
||||
well_controls_iset_type( struct WellControls * ctrls , int control_index , enum WellControlType type);
|
||||
|
||||
@ -139,12 +142,18 @@ well_controls_iset_target(struct WellControls * ctrl, int control_index , double
|
||||
double
|
||||
well_controls_iget_target(const struct WellControls * ctrl, int control_index);
|
||||
|
||||
double
|
||||
well_controls_get_current_target(const struct WellControls * ctrl);
|
||||
|
||||
const double *
|
||||
well_controls_iget_distr(const struct WellControls * ctrl, int control_index);
|
||||
|
||||
void
|
||||
well_controls_iset_distr(const struct WellControls * ctrl, int control_index, const double * distr);
|
||||
|
||||
const double *
|
||||
well_controls_get_current_distr(const struct WellControls * ctrl);
|
||||
|
||||
void
|
||||
well_controls_assert_number_of_phases(struct WellControls * ctrl , int number_of_phases);
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#define HAVE_WELLCONTROLS
|
||||
#include <opm/core/well_controls.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -150,6 +149,13 @@ well_controls_iget_type(const struct WellControls * ctrl, int control_index) {
|
||||
return ctrl->type[control_index];
|
||||
}
|
||||
|
||||
|
||||
enum WellControlType
|
||||
well_controls_get_current_type(const struct WellControls * ctrl) {
|
||||
return well_controls_iget_type( ctrl , ctrl->current);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
well_controls_iset_type( struct WellControls * ctrls , int control_index , enum WellControlType type) {
|
||||
ctrls->type[control_index] = type;
|
||||
@ -161,6 +167,11 @@ well_controls_iget_target(const struct WellControls * ctrl, int control_index) {
|
||||
return ctrl->target[control_index];
|
||||
}
|
||||
|
||||
double
|
||||
well_controls_get_current_target(const struct WellControls * ctrl) {
|
||||
return ctrl->target[ctrl->current];
|
||||
}
|
||||
|
||||
void
|
||||
well_controls_iset_target(struct WellControls * ctrl, int control_index , double target) {
|
||||
ctrl->target[control_index] = target;
|
||||
@ -174,6 +185,13 @@ well_controls_iget_distr(const struct WellControls * ctrl, int control_index) {
|
||||
}
|
||||
|
||||
|
||||
const double *
|
||||
well_controls_get_current_distr(const struct WellControls * ctrl) {
|
||||
return well_controls_iget_distr( ctrl , ctrl->current );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
well_controls_iset_distr(const struct WellControls * ctrl, int control_index, const double * distr) {
|
||||
int offset = control_index * ctrl->number_of_phases;
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/wells.h>
|
||||
#define HAVE_WELLCONTROLS
|
||||
#include <opm/core/well_controls.h>
|
||||
|
||||
#include <iostream>
|
||||
@ -68,7 +67,11 @@ BOOST_AUTO_TEST_CASE(Construction)
|
||||
|
||||
BOOST_CHECK_EQUAL( 2*target , well_controls_iget_target(ctrls , 1 ));
|
||||
BOOST_CHECK_EQUAL( type2 , well_controls_iget_type(ctrls , 1 ));
|
||||
|
||||
well_controls_set_current( ctrls , 1 );
|
||||
BOOST_CHECK_EQUAL( type2 , well_controls_get_current_type( ctrls ));
|
||||
|
||||
BOOST_CHECK_EQUAL( well_controls_iget_target( ctrls , 1 ) , well_controls_get_current_target( ctrls ));
|
||||
|
||||
{
|
||||
const double * d1 = well_controls_iget_distr( ctrls , 0 );
|
||||
const double * d2 = well_controls_iget_distr( ctrls , 1 );
|
||||
|
Loading…
Reference in New Issue
Block a user