Skip to content

Commit 3edf8d7

Browse files
committed
Working on output.getnetsize and toolkit.proj_getcount
Adding test for output.get_netsize and fixing bug with toolkit.proj_getcount.
1 parent c378423 commit 3edf8d7

5 files changed

Lines changed: 24 additions & 10 deletions

File tree

before_build.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
:: US EPA - ORD/NRMRL
88
::
99
:: Requires:
10+
:: git
1011
:: CMake
11-
:: Visual Studio 2015
12+
:: Visual Studio Build Tools
1213
:: SWIG
1314
::
1415
:: Note:
1516
:: This script must be located at the root of the project folder
16-
: in order to work correctly.
17+
:: in order to work correctly.
1718
::
1819

1920

epanet_python/output/setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
# Python packages: numpy
1414
#
1515

16-
try:
17-
from setuptools import setup, Extension
18-
from setuptools.command.build_ext import build_ext
19-
except ImportError:
20-
from distutils.core import setup, Extension
21-
from distutils.command.build_ext import build_ext
16+
#try:
17+
from setuptools import setup, Extension
18+
from setuptools.command.build_ext import build_ext
19+
20+
#except ImportError:
21+
# from distutils.core import setup, Extension
22+
# from distutils.command.build_ext import build_ext
2223

2324

2425
microlib_name = 'epanet.output'

epanet_python/output/tests/test_output.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ def test_outputmetadata_handle(handle):
5151
assert temp == ref[attr]
5252

5353

54+
def test_getnetsize(handle):
55+
56+
ref_array = np.array([11, 2, 13, 1, 0])
57+
58+
netsize_list = oapi.getnetsize(handle)
59+
assert len(netsize_list) == 5
60+
61+
assert np.array_equal(netsize_list, ref_array)
62+
63+
5464
def test_getnodeSeries(handle):
5565

5666
ref_array = np.array(

epanet_python/toolkit/epanet/toolkit/toolkit.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ and return a (possibly) different pointer */
116116
int proj_run(Handle ph, const char *input_path, const char *report_path, const char *output_path);
117117
int proj_init(Handle ph, const char *rptFile, const char *outFile, EN_FlowUnits unitsType, EN_HeadLossType headLossType);
118118
int proj_open(Handle ph, const char *inpFile, const char *rptFile, const char *binOutFile);
119+
//int proj_gettitle(Handle ph, char *line1, char *line2, char *line3);
120+
//int proj_settitle(Handle ph, const char *line1, const char *line2, const char *line3);
121+
int proj_getcount(Handle ph, EN_CountType code, int *OUTPUT);
119122
int proj_savefile(Handle ph, const char *filename);
120123
int proj_close(Handle ph);
121124

@@ -145,7 +148,6 @@ int rprt_writeresults(Handle ph);
145148
int rprt_reset(Handle ph);
146149
int rprt_set(Handle ph, char *reportCommand);
147150
int rprt_setlevel(Handle ph, EN_StatusReport code);
148-
int rprt_getcount(Handle ph, EN_CountType code, int *OUTPUT);
149151
int rprt_anlysstats(Handle ph, EN_AnalysisStatistic code, double *OUTPUT );
150152

151153

epanet_python/toolkit/tests/test_toolkit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_qual_step(handle):
117117

118118
def test_report(handle):
119119

120-
nlinks = en.rprt_getcount(handle, en.CountType.LINKS)
120+
nlinks = en.proj_getcount(handle, en.CountType.LINKS)
121121
assert nlinks == 13
122122

123123
en.hydr_solve(handle)

0 commit comments

Comments
 (0)