mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-23 07:53:29 -06:00
Throw std::logic_error if trying to access invalid current control
This commit is contained in:
parent
af1bf9a193
commit
9f1e3465db
@ -42,6 +42,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls for a single well.
|
* Controls for a single well.
|
||||||
* Each control specifies a well rate or bottom-hole pressure. Only
|
* Each control specifies a well rate or bottom-hole pressure. Only
|
||||||
@ -295,6 +297,8 @@ well_controls_iget_type(const struct WellControls * ctrl, int control_index) {
|
|||||||
|
|
||||||
enum WellControlType
|
enum WellControlType
|
||||||
well_controls_get_current_type(const struct WellControls * ctrl) {
|
well_controls_get_current_type(const struct WellControls * ctrl) {
|
||||||
|
if (ctrl->current < 0)
|
||||||
|
throw std::logic_error("Tried to use invalid current control < 0");
|
||||||
return well_controls_iget_type( ctrl , ctrl->current);
|
return well_controls_iget_type( ctrl , ctrl->current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,6 +316,8 @@ well_controls_iget_target(const struct WellControls * ctrl, int control_index) {
|
|||||||
|
|
||||||
double
|
double
|
||||||
well_controls_get_current_target(const struct WellControls * ctrl) {
|
well_controls_get_current_target(const struct WellControls * ctrl) {
|
||||||
|
if (ctrl->current < 0)
|
||||||
|
throw std::logic_error("Tried to use invalid current control < 0");
|
||||||
return ctrl->target[ctrl->current];
|
return ctrl->target[ctrl->current];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user