@@ -158,6 +158,14 @@ typedef enum {
158158 EN_TRACE = 3
159159} EN_QualityType;
160160
161+ typedef enum {
162+ EN_NOSAVE = 0 ,
163+ EN_SAVE = 1 ,
164+ EN_INITFLOW = 10 ,
165+ EN_SAVE_AND_INIT = 11
166+ } EN_SaveOption;
167+
168+
161169#ifdef WINDOWS
162170 #ifdef __cplusplus
163171 #define DLLEXPORT __declspec (dllexport) __cdecl
@@ -207,6 +215,22 @@ and return a (possibly) different pointer */
207215}
208216
209217
218+ /* TYPEMAP FOR ENUMERATED TYPES */
219+ %typemap(in) EnumeratedType (int val, int ecode = 0 ) {
220+ if (PyObject_HasAttrString ($input," value" )) {
221+ PyObject* o;
222+ o = PyObject_GetAttrString ($input, " value" );
223+ ecode = SWIG_AsVal_int (o, &val);
224+ }
225+ else {
226+ SWIG_exception_fail (SWIG_ArgError (ecode), " in method '" " $symname" " ', argument " " $argnum" " of type '" " $ltype" " '" );
227+ }
228+
229+ $1 = ($1_type)(val);
230+ }
231+ %apply EnumeratedType {EN_SaveOption};
232+
233+
210234/* RENAME FUNCTIONS PYTHON STYLE */
211235%rename(" %(regex:/^\w+_([a-zA-Z]+)/\L\\ 1/)s" ) " " ;
212236
@@ -229,6 +253,9 @@ and return a (possibly) different pointer */
229253}
230254
231255/* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
256+ // RUNNING AN EPANET SIMULATION
257+ int DLLEXPORT EN_runproject (EN_ProjectHandle ph, const char *f1, const char *f2, const char *f3, void (*pviewprog)(char *));
258+
232259// OPENING A CLOSING THE EPANET TOOLKIT SYSTEM
233260int DLLEXPORT EN_open (EN_ProjectHandle ph, const char *f1, const char *f2, const char *f3);
234261int DLLEXPORT EN_close (EN_ProjectHandle ph);
@@ -277,7 +304,7 @@ int DLLEXPORT EN_usehydfile(EN_ProjectHandle ph, char *filename);
277304// RUNNING A HYDRAULIC ANALYSIS
278305int DLLEXPORT EN_solveH (EN_ProjectHandle ph);
279306int DLLEXPORT EN_openH (EN_ProjectHandle ph);
280- int DLLEXPORT EN_initH (EN_ProjectHandle ph, int flag);
307+ int DLLEXPORT EN_initH (EN_ProjectHandle ph, EN_SaveOption flag);
281308int DLLEXPORT EN_runH (EN_ProjectHandle ph, long * long_out);
282309int DLLEXPORT EN_nextH (EN_ProjectHandle ph, long * long_out);
283310int DLLEXPORT EN_closeH (EN_ProjectHandle ph);
@@ -309,3 +336,16 @@ int DLLEXPORT EN_getversion(int *version);
309336
310337void DLLEXPORT EN_clearError (EN_ProjectHandle ph);
311338int DLLEXPORT EN_checkError (EN_ProjectHandle ph, char **msg_buffer);
339+
340+
341+ /* CODE ADDED DIRECTLY TO SWIGGED INTERFACE MODULE */
342+ %pythoncode%{
343+ import enum
344+
345+ class SaveOptions (enum .Enum ):
346+ NOSAVE = EN_NOSAVE
347+ SAVE = EN_SAVE
348+ INITFLOW = EN_INITFLOW
349+ SAVE_AND_INIT = EN_SAVE_AND_INIT
350+
351+ %}
0 commit comments