11/*
22 * swmm_output.i - SWIG interface description file for SWMM Output API
3- *
3+ *
44 * Created: 11/3/2017
55 * Author: Michael E. Tryby
66 * US EPA - ORD/NRMRL
1919/* DEFINE AND TYPEDEF MUST BE INCLUDED */
2020typedef void * SMO_Handle;
2121
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"
11424
11525
11626/* TYPEMAPS FOR VOID POINTER */
@@ -133,7 +43,7 @@ and return a (possibly) different pointer */
13343 /* INOUT in */
13444 SWIG_ConvertPtr (obj0,SWIG_as_voidptrptr (&retval), 0 , 0 );
13545 $1 = &retval;
136- }
46+ }
13747/* No need for special IN typemap for opaque pointers, it works anyway */
13848
13949
@@ -170,7 +80,7 @@ and return a (possibly) different pointer */
17080 if (*$1 ) {
17181 PyObject* o;
17282 o = PyUnicode_FromStringAndSize (*$1 , *$2 );
173-
83+
17484 $result = SWIG_Python_AppendOutput ($result, o);
17585 free (*$1 );
17686 }
@@ -217,15 +127,15 @@ and return a (possibly) different pointer */
217127 if (PyObject_HasAttrString ($input," value" )) {
218128 PyObject* o;
219129 o = PyObject_GetAttrString ($input, " value" );
220- ecode = SWIG_AsVal_int (o, &val);
221- }
130+ ecode = SWIG_AsVal_int (o, &val);
131+ }
222132 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+
226136 $1 = ($1_type)(val);
227137}
228- %apply EnumeratedType {SMO_unit, SMO_elementType, SMO_time, SMO_subcatchAttribute,
138+ %apply EnumeratedType {SMO_unit, SMO_elementType, SMO_time, SMO_subcatchAttribute,
229139SMO_nodeAttribute, SMO_linkAttribute, SMO_systemAttribute};
230140
231141
@@ -249,56 +159,56 @@ SMO_nodeAttribute, SMO_linkAttribute, SMO_systemAttribute};
249159 }
250160}
251161
252- /* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
162+ /* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
253163
254- int DLLEXPORT SMO_open (SMO_Handle p_handle, const char * path);
164+ int SMO_open (SMO_Handle p_handle, const char * path);
255165
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,
264174 int elementIndex, char ** string_out, int * slen);
265175
266- int DLLEXPORT SMO_getSubcatchSeries (SMO_Handle p_handle, int subcatchIndex,
176+ int SMO_getSubcatchSeries (SMO_Handle p_handle, int subcatchIndex,
267177 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,
269179 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,
271181 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,
273183 int startPeriod, int endPeriod, float ** float_out, int * int_dim);
274184
275- int DLLEXPORT SMO_getSubcatchAttribute (SMO_Handle p_handle, int timeIndex,
185+ int SMO_getSubcatchAttribute (SMO_Handle p_handle, int timeIndex,
276186 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,
278188 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,
280190 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,
282192 SMO_systemAttribute attr, float ** float_out, int * int_dim);
283193
284- int DLLEXPORT SMO_getSubcatchResult (SMO_Handle p_handle, int timeIndex,
194+ int SMO_getSubcatchResult (SMO_Handle p_handle, int timeIndex,
285195 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,
287197 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,
289199 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,
291201 int dummyIndex, float ** float_out, int * int_dim);
292202
293- %exception;
203+ %exception;
294204
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);
299209
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);
302212
303213
304214/* CODE ADDED DIRECTLY TO SWIGGED INTERFACE MODULE */
@@ -319,7 +229,7 @@ class FlowUnits(enum.Enum):
319229 LPS = SMO_LPS
320230 MLD = SMO_MLD
321231
322- class ConcUnits (enum .Enum ):
232+ class ConcUnits (enum .Enum ):
323233 MG = SMO_MG
324234 UG = SMO_UG
325235 COUNT = SMO_COUNT
@@ -330,6 +240,7 @@ class ElementType(enum.IntEnum):
330240 NODE = SMO_node
331241 LINK = SMO_link
332242 POLLUT = SMO_pollut
243+ SYSTEM = SMO_sys
333244
334245class Time (enum .Enum ):
335246 REPORT_STEP = SMO_reportStep
@@ -354,7 +265,7 @@ class NodeAttribute(aenum.Enum):
354265 TOTAL_INFLOW = SMO_total_inflow
355266 FLOODING_LOSSES = SMO_flooding_losses
356267 POLLUT_CONC_0 = SMO_pollutant_conc_node
357-
268+
358269class LinkAttribute (aenum.Enum ):
359270 FLOW_RATE = SMO_flow_rate_link
360271 FLOW_DEPTH = SMO_flow_depth
0 commit comments