Skip to content

Commit 2db8cf7

Browse files
committed
Preliminary wording for defining sets of variables exported by a model
1 parent 0357f72 commit 2db8cf7

File tree

3 files changed

+30
-119
lines changed

3 files changed

+30
-119
lines changed

bmi.sidl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ package csdms version 2.1-dev.0 {
1515

1616
// Model information
1717
int get_component_name(out string name);
18-
int get_input_item_count(out int count);
19-
int get_output_item_count(out int count);
20-
int get_input_var_names(out array<string, 1> names);
21-
int get_output_var_names(out array<string, 1> names);
18+
19+
// Variable set information
20+
int get_varset_member_count(in string set_name, out int count);
21+
int get_varset_members(in string set_name, out array<string, 1> names);
2222

2323
// Variable information
2424
int get_var_grid(in string name, out int grid);

docs/source/bmi.info_funcs.md

Lines changed: 24 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -46,121 +46,82 @@ but it should be unique to prevent conflicts with other components.
4646
- In C++, Java, and Python, this argument is omitted, and a string -- a basic type
4747
in these languages -- is returned from the function.
4848
49-
(get-input-item-count)=
49+
(get-varset-member-count)=
5050
51-
## *get_input_item_count*
51+
## *get_varset_member_count*
5252
5353
::::{tab-set}
5454
:sync-group: lang
5555
5656
:::{tab-item} SIDL
5757
:sync: sidl
58-
```java
59-
int get_input_item_count(out int count);
60-
```
61-
:::
6258
63-
:::{tab-item} Python
64-
:sync: python
65-
```python
66-
def get_input_item_count(self) -> int:
67-
```
68-
:::
69-
:::{tab-item} c
70-
:sync: c
71-
```c
72-
int get_input_item_count(void *self, int *count);
73-
```
74-
:::
75-
::::
76-
77-
The number of variables the model can use from other models
78-
implementing a BMI.
79-
Also the number of variables that can be set with {ref}`set-value`.
80-
81-
**Implementation notes**
82-
83-
- In C++, Java, and Python, the argument is omitted and the count is returned
84-
from the function.
85-
- In C and Fortran, an integer status code indicating success (zero) or failure
86-
(nonzero) is returned.
87-
88-
(get-output-item-count)=
89-
90-
## *get_output_item_count*
91-
92-
::::{tab-set}
93-
:sync-group: lang
94-
95-
:::{tab-item} SIDL
96-
:sync: sidl
9759
```java
98-
int get_output_item_count(out int count);
60+
int get_varset_member_count(in string set_name, out int count);
9961
```
10062
:::
101-
10263
:::{tab-item} Python
10364
:sync: python
10465
```python
105-
def get_output_item_count(self) -> int:
66+
def get_varset_member_count(self, set_name: str) -> int:
10667
```
10768
:::
10869
:::{tab-item} c
10970
:sync: c
11071
```c
111-
int get_output_item_count(void *self, int *count);
72+
int get_varset_member_count(void *self, const char *name, int *count);
11273
```
11374
:::
11475
::::
11576
116-
The number of variables the model can provide other models
117-
implementing a BMI.
118-
Also the number of variables that can be retrieved with {ref}`get-value`.
77+
Gets the number of exchange items in a particular set exposed by the model.
11978
12079
**Implementation notes**
12180
122-
- In C++, Java, and Python, the argument is omitted and the count is
123-
returned from the function.
124-
- In C and Fortran, an integer status code indicating success (zero) or failure
125-
(nonzero) is returned.
81+
- In C++, Java, and Python, the *count* argument is omitted and the count
82+
is returned from the function.
83+
- In C and Fortran, an integer status code indicating success (BMI_SUCCESS) or
84+
failure (BMI_FAILURE) is returned.
12685
127-
(get-input-var-names)=
86+
(get-varset-members)=
12887
129-
## *get_input_var_names*
88+
## *get_varset_members*
13089
13190
::::{tab-set}
13291
:sync-group: lang
13392
13493
:::{tab-item} SIDL
13594
:sync: sidl
95+
13696
```java
137-
int get_input_var_names(out array<string, 1> names);
97+
int get_varset_members(in string set_name, out array<string, 1> names);
13898
```
13999
:::
140100
:::{tab-item} Python
141101
:sync: python
142102
```python
143-
def get_input_var_names(self) -> tuple[str, ...]:
103+
def get_varset_members(self, set_name: str) -> tuple[str, ...]:
144104
```
145105
:::
146106
:::{tab-item} c
147107
:sync: c
148108
```c
149-
int get_input_var_names(void *self, char **names);
109+
int get_varset_members(void *self, const char *name, char const* const* members);
150110
```
151111
:::
152112
::::
153113
154-
Gets an array of names for the variables the model can use from other
155-
models implementing a BMI.
156-
The length of the array is given by {ref}`get-input-item-count`.
114+
Gets an array of names for the variables the model publishes in the requested set.
115+
The length of the array is given by {ref}`get-varset-member-count`.
157116
The names are preferably in the form of CSDMS {term}`Standard Names`.
158-
Standard Names enable a modeling framework to determine whether an
159-
input variable in one model is equivalent to, or compatible with,
160-
an output variable in another model.
117+
Standard Names enable a modeling framework to determine whether a
118+
variable in one model is equivalent to, or compatible with,
119+
a corresponding variable in another model.
161120
This allows the framework to automatically connect components.
162121
Standard Names do not have to be used within the model.
163122
123+
Available variable sets are defined by this spec, extensions, ...
124+
164125
**Implementation notes**
165126
166127
- In C and Fortran, the names are passed back as an array of character
@@ -174,53 +135,5 @@ Standard Names do not have to be used within the model.
174135
function in a tuple, a standard container in the language.
175136
- A model might have no input variables.
176137
177-
(get-output-var-names)=
178-
179-
## *get_output_var_names*
180-
181-
::::{tab-set}
182-
:sync-group: lang
183-
184-
:::{tab-item} SIDL
185-
:sync: sidl
186-
```java
187-
int get_output_var_names(out array<string, 1> names);
188-
```
138+
:::{include} links.md
189139
:::
190-
191-
:::{tab-item} Python
192-
:sync: python
193-
```python
194-
def get_output_var_names(self) -> tuple[str, ...]:
195-
```
196-
:::
197-
:::{tab-item} c
198-
:sync: c
199-
```c
200-
int get_output_var_names(void *self, char **names);
201-
```
202-
:::
203-
::::
204-
205-
Gets an array of names for the variables the model can provide to other
206-
models implementing a BMI.
207-
The length of the array is given by {ref}`get-output-item-count`.
208-
The names are preferably in the form of CSDMS {term}`Standard Names`.
209-
Standard Names enable a modeling framework to determine whether an
210-
input variable in one model is equivalent to, or compatible with,
211-
an output variable in another model.
212-
This allows the framework to automatically connect components.
213-
Standard Names do not have to be used within the model.
214-
215-
**Implementation notes**
216-
217-
- In C and Fortran, the names are passed back as an array of character
218-
pointers (because the variable names could have differing lengths), and an
219-
integer status code indicating success (zero) or failure (nonzero) is returned.
220-
- In C++, the argument is omitted and the names are returned from the
221-
function in a vector, a standard container in the language.
222-
- In Java, the argument is omitted and the names are returned from the
223-
function in a string array, a standard container in the language.
224-
- In Python, the argument is omitted and the names are returned from the
225-
function in a tuple, a standard container in the language.
226-
- A model may have no output variables.

docs/source/bmi.spec.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ grouped by functional category.
3535
| {ref}`update-until` | Advance model state until the given time. |
3636
| {ref}`finalize` | Perform tear-down tasks for the model. |
3737
| {ref}`get-component-name` | Name of the model. |
38-
| {ref}`get-input-item-count` | Count of a model's input variables. |
39-
| {ref}`get-output-item-count` | Count of a model's output variables. |
40-
| {ref}`get-input-var-names` | List of a model's input variables. |
41-
| {ref}`get-output-var-names` | List of a model's output variables. |
38+
| {ref}`get-varset-item-count` | Count of a model's variables in a set. |
39+
| {ref}`get-varset-members` | List of a model's variables in a set. |
4240
| {ref}`get-var-grid` | Get the grid identifier for a variable. |
4341
| {ref}`get-var-type` | Get the data type of a variable. |
4442
| {ref}`get-var-units` | Get the units of a variable. |

0 commit comments

Comments
 (0)