1
1
/*
2
2
* swmm_output.i - SWIG interface description file for SWMM Output API
3
- *
3
+ *
4
4
* Created: 11/3/2017
5
5
* Author: Michael E. Tryby
6
6
* US EPA - ORD/NRMRL
19
19
/* DEFINE AND TYPEDEF MUST BE INCLUDED */
20
20
typedef void * SMO_Handle;
21
21
22
- typedef enum {
23
- SMO_US,
24
- SMO_SI
25
- } SMO_unitSystem;
26
-
27
- typedef enum {
28
- SMO_CFS,
29
- SMO_GPM,
30
- SMO_MGD,
31
- SMO_CMS,
32
- SMO_LPS,
33
- SMO_MLD
34
- } SMO_flowUnits;
35
-
36
- typedef enum {
37
- SMO_MG,
38
- SMO_UG,
39
- SMO_COUNT,
40
- SMO_NONE
41
- } SMO_concUnits;
42
-
43
- typedef enum {
44
- SMO_subcatch,
45
- SMO_node,
46
- SMO_link,
47
- SMO_pollut
48
- } SMO_elementType;
49
-
50
- typedef enum {
51
- SMO_reportStep,
52
- SMO_numPeriods
53
- } SMO_time;
54
-
55
- typedef enum {
56
- SMO_rainfall_subcatch, // (in/hr or mm/hr),
57
- SMO_snow_depth_subcatch, // (in or mm),
58
- SMO_evap_loss, // (in/hr or mm/hr),
59
- SMO_infil_loss, // (in/hr or mm/hr),
60
- SMO_runoff_rate, // (flow units),
61
- SMO_gwoutflow_rate, // (flow units),
62
- SMO_gwtable_elev, // (ft or m),
63
- SMO_soil_moisture, // unsaturated zone moisture content (-),
64
- SMO_pollutant_conc_subcatch // first pollutant
65
- } SMO_subcatchAttribute;
66
-
67
- typedef enum {
68
- SMO_invert_depth, // (ft or m),
69
- SMO_hydraulic_head, // (ft or m),
70
- SMO_stored_ponded_volume, // (ft3 or m3),
71
- SMO_lateral_inflow, // (flow units),
72
- SMO_total_inflow, // lateral + upstream (flow units),
73
- SMO_flooding_losses, // (flow units),
74
- SMO_pollutant_conc_node // first pollutant,
75
- } SMO_nodeAttribute;
76
-
77
- typedef enum {
78
- SMO_flow_rate_link, // (flow units),
79
- SMO_flow_depth, // (ft or m),
80
- SMO_flow_velocity, // (ft/s or m/s),
81
- SMO_flow_volume, // (ft3 or m3),
82
- SMO_capacity, // (fraction of conduit filled),
83
- SMO_pollutant_conc_link // first pollutant,
84
- } SMO_linkAttribute;
85
-
86
- typedef enum {
87
- SMO_air_temp, // (deg. F or deg. C),
88
- SMO_rainfall_system, // (in/hr or mm/hr),
89
- SMO_snow_depth_system, // (in or mm),
90
- SMO_evap_infil_loss, // (in/hr or mm/hr),
91
- SMO_runoff_flow, // (flow units),
92
- SMO_dry_weather_inflow, // (flow units),
93
- SMO_groundwater_inflow, // (flow units),
94
- SMO_RDII_inflow, // (flow units),
95
- SMO_direct_inflow, // user defined (flow units),
96
- SMO_total_lateral_inflow, // (sum of variables 4 to 8) //(flow units),
97
- SMO_flood_losses, // (flow units),
98
- SMO_outfall_flows, // (flow units),
99
- SMO_volume_stored, // (ft3 or m3),
100
- SMO_evap_rate // (in/day or mm/day),
101
- // p_evap_rate // (in/day or mm/day)
102
- } SMO_systemAttribute;
103
-
104
-
105
- #ifdef WINDOWS
106
- #ifdef __cplusplus
107
- #define DLLEXPORT __declspec (dllexport) __cdecl
108
- #else
109
- #define DLLEXPORT __declspec (dllexport) __stdcall
110
- #endif
111
- #else
112
- #define DLLEXPORT
113
- #endif
22
+
23
+ %include " swmm_output_enums.h"
114
24
115
25
116
26
/* TYPEMAPS FOR VOID POINTER */
@@ -133,7 +43,7 @@ and return a (possibly) different pointer */
133
43
/* INOUT in */
134
44
SWIG_ConvertPtr (obj0,SWIG_as_voidptrptr (&retval), 0 , 0 );
135
45
$1 = &retval;
136
- }
46
+ }
137
47
/* No need for special IN typemap for opaque pointers, it works anyway */
138
48
139
49
@@ -170,7 +80,7 @@ and return a (possibly) different pointer */
170
80
if (*$1 ) {
171
81
PyObject* o;
172
82
o = PyUnicode_FromStringAndSize (*$1 , *$2 );
173
-
83
+
174
84
$result = SWIG_Python_AppendOutput ($result, o);
175
85
free (*$1 );
176
86
}
@@ -217,15 +127,15 @@ and return a (possibly) different pointer */
217
127
if (PyObject_HasAttrString ($input," value" )) {
218
128
PyObject* o;
219
129
o = PyObject_GetAttrString ($input, " value" );
220
- ecode = SWIG_AsVal_int (o, &val);
221
- }
130
+ ecode = SWIG_AsVal_int (o, &val);
131
+ }
222
132
else {
223
- SWIG_exception_fail (SWIG_ArgError (ecode), " in method '" " $symname" " ', argument " " $argnum" " of type '" " $ltype" " '" );
224
- }
225
-
133
+ SWIG_exception_fail (SWIG_ArgError (ecode), " in method '" " $symname" " ', argument " " $argnum" " of type '" " $ltype" " '" );
134
+ }
135
+
226
136
$1 = ($1_type)(val);
227
137
}
228
- %apply EnumeratedType {SMO_unit, SMO_elementType, SMO_time, SMO_subcatchAttribute,
138
+ %apply EnumeratedType {SMO_unit, SMO_elementType, SMO_time, SMO_subcatchAttribute,
229
139
SMO_nodeAttribute, SMO_linkAttribute, SMO_systemAttribute};
230
140
231
141
@@ -249,56 +159,56 @@ SMO_nodeAttribute, SMO_linkAttribute, SMO_systemAttribute};
249
159
}
250
160
}
251
161
252
- /* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
162
+ /* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
253
163
254
- int DLLEXPORT SMO_open (SMO_Handle p_handle, const char * path);
164
+ int SMO_open (SMO_Handle p_handle, const char * path);
255
165
256
- int DLLEXPORT SMO_getVersion (SMO_Handle p_handle, int * int_out);
257
- int DLLEXPORT SMO_getProjectSize (SMO_Handle p_handle, int ** int_out, int * int_dim);
258
- int DLLEXPORT SMO_getUnits (SMO_Handle p_handle, int ** int_out, int * int_dim);
259
- // int DLLEXPORT SMO_getFlowUnits(SMO_Handle p_handle, int* int_out);
260
- // int DLLEXPORT SMO_getPollutantUnits(SMO_Handle p_handle, int** int_out, int* int_dim);
261
- int DLLEXPORT SMO_getStartDate (SMO_Handle p_handle, double * double_out);
262
- int DLLEXPORT SMO_getTimes (SMO_Handle p_handle, SMO_time code, int * int_out);
263
- int DLLEXPORT SMO_getElementName (SMO_Handle p_handle, SMO_elementType type,
166
+ int SMO_getVersion (SMO_Handle p_handle, int * int_out);
167
+ int SMO_getProjectSize (SMO_Handle p_handle, int ** int_out, int * int_dim);
168
+ int SMO_getUnits (SMO_Handle p_handle, int ** int_out, int * int_dim);
169
+ // int SMO_getFlowUnits(SMO_Handle p_handle, int* int_out);
170
+ // int SMO_getPollutantUnits(SMO_Handle p_handle, int** int_out, int* int_dim);
171
+ int SMO_getStartDate (SMO_Handle p_handle, double * double_out);
172
+ int SMO_getTimes (SMO_Handle p_handle, SMO_time code, int * int_out);
173
+ int SMO_getElementName (SMO_Handle p_handle, SMO_elementType type,
264
174
int elementIndex, char ** string_out, int * slen);
265
175
266
- int DLLEXPORT SMO_getSubcatchSeries (SMO_Handle p_handle, int subcatchIndex,
176
+ int SMO_getSubcatchSeries (SMO_Handle p_handle, int subcatchIndex,
267
177
SMO_subcatchAttribute attr, int startPeriod, int endPeriod, float ** float_out, int * int_dim);
268
- int DLLEXPORT SMO_getNodeSeries (SMO_Handle p_handle, int nodeIndex, SMO_nodeAttribute attr,
178
+ int SMO_getNodeSeries (SMO_Handle p_handle, int nodeIndex, SMO_nodeAttribute attr,
269
179
int startPeriod, int endPeriod, float ** float_out, int * int_dim);
270
- int DLLEXPORT SMO_getLinkSeries (SMO_Handle p_handle, int linkIndex, SMO_linkAttribute attr,
180
+ int SMO_getLinkSeries (SMO_Handle p_handle, int linkIndex, SMO_linkAttribute attr,
271
181
int startPeriod, int endPeriod, float ** float_out, int * int_dim);
272
- int DLLEXPORT SMO_getSystemSeries (SMO_Handle p_handle, SMO_systemAttribute attr,
182
+ int SMO_getSystemSeries (SMO_Handle p_handle, SMO_systemAttribute attr,
273
183
int startPeriod, int endPeriod, float ** float_out, int * int_dim);
274
184
275
- int DLLEXPORT SMO_getSubcatchAttribute (SMO_Handle p_handle, int timeIndex,
185
+ int SMO_getSubcatchAttribute (SMO_Handle p_handle, int timeIndex,
276
186
SMO_subcatchAttribute attr, float ** float_out, int * int_dim);
277
- int DLLEXPORT SMO_getNodeAttribute (SMO_Handle p_handle, int timeIndex,
187
+ int SMO_getNodeAttribute (SMO_Handle p_handle, int timeIndex,
278
188
SMO_nodeAttribute attr, float ** float_out, int * int_dim);
279
- int DLLEXPORT SMO_getLinkAttribute (SMO_Handle p_handle, int timeIndex,
189
+ int SMO_getLinkAttribute (SMO_Handle p_handle, int timeIndex,
280
190
SMO_linkAttribute attr, float ** float_out, int * int_dim);
281
- int DLLEXPORT SMO_getSystemAttribute (SMO_Handle p_handle, int timeIndex,
191
+ int SMO_getSystemAttribute (SMO_Handle p_handle, int timeIndex,
282
192
SMO_systemAttribute attr, float ** float_out, int * int_dim);
283
193
284
- int DLLEXPORT SMO_getSubcatchResult (SMO_Handle p_handle, int timeIndex,
194
+ int SMO_getSubcatchResult (SMO_Handle p_handle, int timeIndex,
285
195
int subcatchIndex, float ** float_out, int * int_dim);
286
- int DLLEXPORT SMO_getNodeResult (SMO_Handle p_handle, int timeIndex,
196
+ int SMO_getNodeResult (SMO_Handle p_handle, int timeIndex,
287
197
int nodeIndex, float ** float_out, int * int_dim);
288
- int DLLEXPORT SMO_getLinkResult (SMO_Handle p_handle, int timeIndex,
198
+ int SMO_getLinkResult (SMO_Handle p_handle, int timeIndex,
289
199
int linkIndex, float ** float_out, int * int_dim);
290
- int DLLEXPORT SMO_getSystemResult (SMO_Handle p_handle, int timeIndex,
200
+ int SMO_getSystemResult (SMO_Handle p_handle, int timeIndex,
291
201
int dummyIndex, float ** float_out, int * int_dim);
292
202
293
- %exception;
203
+ %exception;
294
204
295
- /* NO EXCEPTION HANDLING FOR THESE FUNCTIONS */
296
- int DLLEXPORT SMO_init (SMO_Handle* p_handle_out);
297
- int DLLEXPORT SMO_close (SMO_Handle* p_handle_inout);
298
- void DLLEXPORT SMO_free (void ** array);
205
+ /* NO EXCEPTION HANDLING FOR THESE FUNCTIONS */
206
+ int SMO_init (SMO_Handle* p_handle_out);
207
+ int SMO_close (SMO_Handle* p_handle_inout);
208
+ void SMO_free (void ** array);
299
209
300
- void DLLEXPORT SMO_clearError (SMO_Handle p_handle);
301
- int DLLEXPORT SMO_checkError (SMO_Handle p_handle, char ** msg_buffer);
210
+ void SMO_clearError (SMO_Handle p_handle);
211
+ int SMO_checkError (SMO_Handle p_handle, char ** msg_buffer);
302
212
303
213
304
214
/* CODE ADDED DIRECTLY TO SWIGGED INTERFACE MODULE */
@@ -319,7 +229,7 @@ class FlowUnits(enum.Enum):
319
229
LPS = SMO_LPS
320
230
MLD = SMO_MLD
321
231
322
- class ConcUnits (enum .Enum ):
232
+ class ConcUnits (enum .Enum ):
323
233
MG = SMO_MG
324
234
UG = SMO_UG
325
235
COUNT = SMO_COUNT
@@ -330,6 +240,7 @@ class ElementType(enum.IntEnum):
330
240
NODE = SMO_node
331
241
LINK = SMO_link
332
242
POLLUT = SMO_pollut
243
+ SYSTEM = SMO_sys
333
244
334
245
class Time (enum .Enum ):
335
246
REPORT_STEP = SMO_reportStep
@@ -354,7 +265,7 @@ class NodeAttribute(aenum.Enum):
354
265
TOTAL_INFLOW = SMO_total_inflow
355
266
FLOODING_LOSSES = SMO_flooding_losses
356
267
POLLUT_CONC_0 = SMO_pollutant_conc_node
357
-
268
+
358
269
class LinkAttribute (aenum.Enum ):
359
270
FLOW_RATE = SMO_flow_rate_link
360
271
FLOW_DEPTH = SMO_flow_depth
0 commit comments