Interface for getting and setting a model’s internal variables.
bmi.getter_setter.
BmiGetter
[source]¶Bases: object
Get values from a component.
Methods that get variables from a model’s state. Often a model’s state variables are changing with each time step, so getters are called to get current values.
Methods
get_value (var_name) |
Get a copy of values of the given variable. |
get_value_at_indices (var_name, indices) |
Get values at particular indices. |
get_value_ref (var_name) |
Get a reference to values of the given variable. |
get_value
(var_name)[source]¶Get a copy of values of the given variable.
This is a getter for the model, used to access the model’s current state. It returns a copy of a model variable, with the return type, size and rank dependent on the variable.
Parameters: | var_name : str
|
---|---|
Returns: | array_like
|
Notes
/* C */
int get_value(void * self, const char * var_name, void * buffer);
get_value_at_indices
(var_name, indices)[source]¶Get values at particular indices.
Parameters: | var_name : str
indices : array_like
|
---|---|
Returns: | array_like
|
Notes
/* C */
int get_value_at_indices(void * self, const char * var_name,
void * buffer, int * indices, int len);
get_value_ref
(var_name)[source]¶Get a reference to values of the given variable.
This is a getter for the model, used to access the model’s current state. It returns a reference to a model variable, with the return type, size and rank dependent on the variable.
Parameters: | var_name : str
|
---|---|
Returns: | array_like
|
Notes
/* C */
int get_value_ref(void * self, const char * var_name,
void ** buffer);
bmi.getter_setter.
BmiSetter
[source]¶Bases: object
Set values into a component.
Methods that set variables of a model’s state.
Methods
set_value (var_name, src) |
Specify a new value for a model variable. |
set_value_at_indices (var_name, indices, src) |
Specify a new value for a model variable at particular indices. |
set_value
(var_name, src)[source]¶Specify a new value for a model variable.
This is the setter for the model, used to change the model’s current state. It accepts, through src, a new value for a model variable, with the type, size and rank of src dependent on the variable.
Parameters: | var_name : str
src : array_like
|
---|
Notes
/* C */
int set_value(void * self, const char * var_name, void * src);
set_value_at_indices
(var_name, indices, src)[source]¶Specify a new value for a model variable at particular indices.
Parameters: | var_name : str
indices : array_like
src : array_like
|
---|
Notes
/* C */
int set_value_at_indices(void * self, const char * var_name,
int * indices, int len, void * src);