Merge pull request #386 from LRossman/lrossman-dev

New function clearreport added (see issue #383)
This commit is contained in:
Lew Rossman
2019-02-10 22:55:54 -05:00
committed by GitHub
15 changed files with 222 additions and 146 deletions

View File

@@ -178,6 +178,9 @@ Both network files are available [here](https://doi.org/10.23719/1375314).
|`EN_getelseaction`|Gets the contents of an ELSE action in a rule-based control|
|`EN_setelseaction`|Set the contents of an ELSE action in a rule-based control|
|`EN_setrulepriority`|Sets the priority of a rule-based control|
|`EN_gettitle` |Gets a project's title |
|`EN_settitle` |Sets a project's title |
|`EN_clearreport` |Clears the contents of a project's report file |
In addition to these new functions, a tank's volume curve `EN_VOLCURVE` can be set using `EN_setnodevalue` and `EN_setlinkvalue` can now be used to set the following pump properties:
- `EN_PUMP_POWER` (constant power rating)
- `EN_PUMP_HCURVE` (head characteristic curve)

View File

@@ -71,6 +71,9 @@ These are symbolic constants used as function arguments.
@fn int EN_runproject(EN_Project ph, const char *f1, const char *f2, const char *f3, void (*pviewprog)(char *))
@fn int EN_init(EN_Project ph, const char *rptFile, const char *outFile, int unitsType, int headLossType)
@fn int EN_open(EN_Project ph, const char *inpFile, const char *rptFile, const char *binOutFile)
@fn int EN_getcount(EN_Project ph, int code, int *count)
@fn int EN_gettitle(EN_Project ph, char *line1, char *line2, char *line3)
@fn int EN_settitle(EN_Project ph, char *line1, char *line2, char *line3)
@fn int EN_saveinpfile(EN_Project ph, const char *filename)
@fn int EN_close(EN_Project ph)
@}
@@ -109,11 +112,11 @@ These are symbolic constants used as function arguments.
@{
@fn int EN_writeline(EN_Project ph, char *line)
@fn int EN_report(EN_Project ph)
@fn int EN_clearreport(EN_Project ph)
@fn int EN_resetreport(EN_Project ph)
@fn int EN_setreport(EN_Project ph, char *reportFormat)
@fn int EN_setstatusreport(EN_Project ph, int code)
@fn int EN_getversion(int *version)
@fn int EN_getcount(EN_Project ph, int code, int *count)
@fn int EN_geterror(int errcode, char *errmsg, int maxLen)
@fn int EN_getstatistic(EN_Project ph, int type, double* value)
@}

View File

@@ -5,7 +5,7 @@ Attribute VB_Name = "Module1"
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL)
'Last updated on 01/08/2019
'Last updated on 02/08/2019
' These are codes used by the DLL functions
Public Const EN_ELEVATION = 0 ' Node parameters
@@ -220,11 +220,13 @@ Public Const EN_R_IS_ACTIVE = 3
'These are the external functions that comprise the DLL
'System Functions
'Project Functions
Declare Function ENgetversion Lib "epanet2.dll" (value As Long) As Long
Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Long
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Long, ByVal headlossType As Long) As Long
Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Long
Declare Function ENgettitle Lib "epanet2.dll" (ByVal line1 As String, ByVal line2 As String, ByVal line3 As String) As Long
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENclose Lib "epanet2.dll" () As Long
@@ -251,14 +253,13 @@ Public Const EN_R_IS_ACTIVE = 3
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Long
Declare Function ENreport Lib "epanet2.dll" () As Long
Declare Function ENclearreport Lib "epanet2.dll" () As Long
Declare Function ENresetreport Lib "epanet2.dll" () As Long
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Long
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Long) As Long
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Long, count As Long) As Long
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Long, ByRef value As Single) As Long
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long

View File

@@ -7,6 +7,7 @@ EXPORTS
ENaddnode = _ENaddnode@8
ENaddpattern = _ENaddpattern@4
ENaddrule = _ENaddrule@4
ENclearreport = _ENclearreport@0
ENclose = _ENclose@0
ENcloseH = _ENcloseH@0
ENcloseQ = _ENcloseQ@0
@@ -57,7 +58,8 @@ EXPORTS
ENgetruleID = _ENgetruleID@8
ENgetstatistic = _ENgetstatistic@8
ENgetthenaction = _ENgetthenaction@20
ENgettimeparam = _ENgettimeparam@8
ENgettimeparam = _ENgettimeparam@8
ENgettitle = _ENgettitle@12
ENgetversion = _ENgetversion@4
ENinit = _ENinit@16
ENinitH = _ENinitH@4
@@ -106,7 +108,8 @@ EXPORTS
ENsetstatusreport = _ENsetstatusreport@4
ENsettankdata = _ENsettankdata@32
ENsetthenaction = _ENsetthenaction@20
ENsettimeparam = _ENsettimeparam@8
ENsettimeparam = _ENsettimeparam@8
ENsettitle = _ENsettitle@12
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 01/08/2019
Last Updated: 02/08/2019
******************************************************************************
*/
@@ -60,7 +60,7 @@ extern "C" {
/********************************************************************
System Functions
Project Functions
********************************************************************/
@@ -72,6 +72,12 @@ extern "C" {
int DLLEXPORT ENopen(const char *inpFile, const char *rptFile,
const char *outFile);
int DLLEXPORT ENgettitle(char *line1, char *line2, char *line3);
int DLLEXPORT ENsettitle(char *line1, char *line2, char *line3);
int DLLEXPORT ENgetcount(int object, int *count);
int DLLEXPORT ENsaveinpfile(const char *filename);
@@ -131,6 +137,8 @@ extern "C" {
int DLLEXPORT ENreport();
int DLLEXPORT ENclearreport();
int DLLEXPORT ENresetreport();
int DLLEXPORT ENsetreport(char *format);
@@ -139,15 +147,10 @@ extern "C" {
int DLLEXPORT ENgetversion(int *version);
int DLLEXPORT ENgetcount(int object, int *count);
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen);
int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE* value);
int DLLEXPORT ENgettitle(char *titleline1, char *titleline2, char *titleline3);
int DLLEXPORT ENsettitle(char *titleline1, char *titleline2, char *titleline3);
/********************************************************************

View File

@@ -4,7 +4,7 @@
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) for use with VB.Net.
'Last updated on 01/08/2019
'Last updated on 02/08/2019
Imports System.Runtime.InteropServices
Imports System.Text
@@ -225,11 +225,13 @@ Public Const EN_R_IS_ACTIVE = 3
'These are the external functions that comprise the DLL
'System Functions
'Project Functions
Declare Function ENgetversion Lib "epanet2.dll" (value As Int32) As Int32
Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Int32
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Int32, ByVal headlossType As Int32) As Int32
Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Int32
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclose Lib "epanet2.dll" () As Int32
@@ -256,14 +258,13 @@ Public Const EN_R_IS_ACTIVE = 3
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Int32
Declare Function ENreport Lib "epanet2.dll" () As Int32
Declare Function ENclearreport Lib "epanet2.dll" () As Int32
Declare Function ENresetreport Lib "epanet2.dll" () As Int32
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Int32
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Int32) As Int32
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count As Int32) As Int32
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Int32, ByVal errmsg As String, ByVal maxLen As Int32) As Int32
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Int32, ByRef value As Single) As Int32
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32

View File

@@ -11,7 +11,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 01/08/2019
Last Updated: 02/08/2019
******************************************************************************
*/
@@ -50,7 +50,7 @@ typedef struct Project *EN_Project;
/********************************************************************
System Functions
Project Functions
********************************************************************/
@@ -126,6 +126,33 @@ typedef struct Project *EN_Project;
int DLLEXPORT EN_open(EN_Project ph, const char *inpFile, const char *rptFile,
const char *outFile);
/**
@brief Retrieves the title lines of the project
@param[out] line1 first title line
@param[out] line2 second title line
@param[out] line3 third title line
@return an error code
*/
int DLLEXPORT EN_gettitle(EN_Project ph, char *line1, char *line2, char *line3);
/**
@brief Sets the title lines of the project
@param line1 first title line
@param line2 second title line
@param line3 third title line
@return an error code
*/
int DLLEXPORT EN_settitle(EN_Project ph, char *line1, char *line2, char *line3);
/**
@brief Retrieves the number of objects of a given type in a project.
@param ph an EPANET project handle.
@param object a type of object to count (see @ref EN_CountType)
@param[out] count number of objects of the specified type
@return an error code
*/
int DLLEXPORT EN_getcount(EN_Project ph, int object, int *count);
/**
@brief Saves a project's data to an EPANET-formatted text file.
@param ph an EPANET project handle.
@@ -490,6 +517,13 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_report(EN_Project ph);
/**
@brief Clears the contents of a project's report file.
@param ph an EPANET project handle.
@return and error code.
*/
int DLLEXPORT EN_clearreport(EN_Project ph);
/**
@brief Resets a project's report options to their default values.
@param ph an EPANET project handle.
@@ -551,15 +585,6 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_getversion(int *version);
/**
@brief Retrieves the number of objects of a given type in a project.
@param ph an EPANET project handle.
@param object a type of object to count (see @ref EN_CountType)
@param[out] count number of objects of the specified type
@return an error code
*/
int DLLEXPORT EN_getcount(EN_Project ph, int object, int *count);
/**
@brief Returns the text of an error message generated by an error code.
@param errcode an error code.
@@ -579,24 +604,6 @@ typedef struct Project *EN_Project;
@return an error code
*/
int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* value);
/**
@brief Retrieves the title lines of the project
@param[out] titleline1 first title line
@param[out] titleline2 second title line
@param[out] titleline3 third title line
@return an error code
*/
int DLLEXPORT EN_gettitle(EN_Project ph, char *titleline1, char *titleline2, char *titleline3);
/**
@brief Sets the title lines of the project
@param titleline1 first title line
@param titleline2 second title line
@param titleline3 third title line
@return an error code
*/
int DLLEXPORT EN_settitle(EN_Project ph, char *titleline1, char *titleline2, char *titleline3);
/********************************************************************

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 12/10/2018
Last Updated: 02/08/2019
******************************************************************************
*/
@@ -34,6 +34,8 @@ int EXPORT_PY_API proj_delete(Handle *ph_inout);
int EXPORT_PY_API proj_run(Handle ph, const char *input_path, const char *report_path, const char *output_path);
int EXPORT_PY_API proj_init(Handle ph, const char *rptFile, const char *outFile, EN_FlowUnits unitsType, EN_HeadLossType headLossType);
int EXPORT_PY_API proj_open(Handle ph, const char *inpFile, const char *rptFile, const char *binOutFile);
int EXPORT_PY_API proj_gettitle(Handle ph, char *line1, char *line2, char *line3);
int EXPORT_PY_API proj_settitle(Handle ph, const char *line1, const char *line2, const char *line3);
int EXPORT_PY_API proj_savefile(Handle ph, const char *inpfilename);
int EXPORT_PY_API proj_close(Handle ph);
@@ -60,6 +62,7 @@ int EXPORT_PY_API qual_close(Handle ph);
int EXPORT_PY_API rprt_writeline(Handle ph, char *line);
int EXPORT_PY_API rprt_writeresults(Handle ph);
int EXPORT_PY_API rprt_clear(Handle ph);
int EXPORT_PY_API rprt_reset(Handle ph);
int EXPORT_PY_API rprt_set(Handle ph, char *reportCommand);
int EXPORT_PY_API rprt_setlevel(Handle ph, EN_StatusReport code);

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 01/11/2019
Last Updated: 02/08/2019
******************************************************************************
*/
@@ -32,7 +32,7 @@
/********************************************************************
System Functions
Project Functions
********************************************************************/
@@ -237,6 +237,79 @@ int DLLEXPORT EN_open(EN_Project p, const char *inpFile, const char *rptFile,
return errcode;
}
int DLLEXPORT EN_gettitle(EN_Project p, char *line1, char *line2, char *line3)
/*----------------------------------------------------------------
** Input: None
** Output: line1, line2, line3 = project's title lines
** Returns: error code
** Purpose: retrieves the title lines of the project
**----------------------------------------------------------------
*/
{
if (!p->Openflag) return 102;
strcpy(line1, p->Title[0]);
strcpy(line2, p->Title[1]);
strcpy(line3, p->Title[2]);
return 0;
}
int DLLEXPORT EN_settitle(EN_Project p, char *line1, char *line2, char *line3)
/*----------------------------------------------------------------
** Input: line1, line2, line3 = project's title lines
** Returns: error code
** Purpose: sets the title lines of the project
**----------------------------------------------------------------
*/
{
if (!p->Openflag) return 102;
strncpy(p->Title[0], line1, TITLELEN);
strncpy(p->Title[1], line2, TITLELEN);
strncpy(p->Title[2], line3, TITLELEN);
return 123;
}
int DLLEXPORT EN_getcount(EN_Project p, int object, int *count)
/*----------------------------------------------------------------
** Input: object = type of object to count (see EN_CountType)
** Output: count = number of objects of the specified type
** Returns: error code
** Purpose: Retrieves number of network objects of a given type
**----------------------------------------------------------------
*/
{
Network *net = &p->network;
*count = 0;
if (!p->Openflag) return 102;
switch (object)
{
case EN_NODECOUNT:
*count = net->Nnodes;
break;
case EN_TANKCOUNT:
*count = net->Ntanks;
break;
case EN_LINKCOUNT:
*count = net->Nlinks;
break;
case EN_PATCOUNT:
*count = net->Npats;
break;
case EN_CURVECOUNT:
*count = net->Ncurves;
break;
case EN_CONTROLCOUNT:
*count = net->Ncontrols;
break;
case EN_RULECOUNT:
*count = net->Nrules;
break;
default:
return 251;
}
return 0;
}
int DLLEXPORT EN_saveinpfile(EN_Project p, const char *filename)
/*----------------------------------------------------------------
** Input: filename = name of file to which project is saved
@@ -791,6 +864,19 @@ int DLLEXPORT EN_report(EN_Project p)
return errcode;
}
int DLLEXPORT EN_clearreport(EN_Project p)
/*----------------------------------------------------------------
** Input: none
** Output: none
** Returns: error code
** Purpose: clears the contents of a project's report file
**----------------------------------------------------------------
*/
{
if (!p->Openflag) return 102;
return clearreport(p);
}
int DLLEXPORT EN_resetreport(EN_Project p)
/*----------------------------------------------------------------
** Input: none
@@ -870,48 +956,6 @@ int DLLEXPORT EN_getversion(int *version)
return 0;
}
int DLLEXPORT EN_getcount(EN_Project p, int object, int *count)
/*----------------------------------------------------------------
** Input: object = type of object to count (see EN_CountType)
** Output: count = number of objects of the specified type
** Returns: error code
** Purpose: Retrieves number of network objects of a given type
**----------------------------------------------------------------
*/
{
Network *net = &p->network;
*count = 0;
if (!p->Openflag) return 102;
switch (object)
{
case EN_NODECOUNT:
*count = net->Nnodes;
break;
case EN_TANKCOUNT:
*count = net->Ntanks;
break;
case EN_LINKCOUNT:
*count = net->Nlinks;
break;
case EN_PATCOUNT:
*count = net->Npats;
break;
case EN_CURVECOUNT:
*count = net->Ncurves;
break;
case EN_CONTROLCOUNT:
*count = net->Ncontrols;
break;
case EN_RULECOUNT:
*count = net->Nrules;
break;
default:
return 251;
}
return 0;
}
int DLLEXPORT EN_geterror(int errcode, char *errmsg, int maxLen)
/*----------------------------------------------------------------
** Input: errcode = an error or warnng code
@@ -991,37 +1035,6 @@ int DLLEXPORT EN_getstatistic(EN_Project p, int type, double *value)
return 0;
}
int DLLEXPORT EN_gettitle(EN_Project p, char *titleline1, char *titleline2, char *titleline3)
/*----------------------------------------------------------------
** Input: None
** Output: titleline1-3 = project's title lines
** Returns: error code
** Purpose: retrieves the title lines of the project
**----------------------------------------------------------------
*/
{
if (!p->Openflag) return 102;
strcpy(titleline1, p->Title[0]);
strcpy(titleline2, p->Title[1]);
strcpy(titleline3, p->Title[2]);
return 0;
}
int DLLEXPORT EN_settitle(EN_Project p, char *titleline1, char *titleline2, char *titleline3)
/*----------------------------------------------------------------
** Input: titleline1-3 = project's title lines
** Returns: error code
** Purpose: sets the title lines of the project
**----------------------------------------------------------------
*/
{
if (!p->Openflag) return 102;
strncpy(p->Title[0], titleline1, TITLELEN);
strncpy(p->Title[1], titleline2, TITLELEN);
strncpy(p->Title[2], titleline3, TITLELEN);
return 123;
}
/********************************************************************
Analysis Options Functions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 01/09/2019
Last Updated: 02/08/2019
******************************************************************************
*/
#ifndef __APPLE__
@@ -47,7 +47,7 @@ void removetmpfiles()
/********************************************************************
System Functions
Project Functions
********************************************************************/
@@ -102,6 +102,21 @@ int DLLEXPORT ENopen(const char *inpFile, const char *rptFile, const char *outFi
return errcode;
}
int DLLEXPORT ENgettitle(char *line1, char *line2, char *line3)
{
return EN_gettitle(_defaultProject, line1, line2, line3) ;
}
int DLLEXPORT ENsettitle(char *line1, char *line2, char *line3)
{
return EN_settitle(_defaultProject, line1, line2, line3) ;
}
int DLLEXPORT ENgetcount(int object, int *count)
{
return EN_getcount(_defaultProject, object, count);
}
int DLLEXPORT ENsaveinpfile(const char *filename)
{
return EN_saveinpfile(_defaultProject, filename);
@@ -174,6 +189,8 @@ int DLLEXPORT ENwriteline(char *line) { return EN_writeline(_defaultProject, lin
int DLLEXPORT ENreport() { return EN_report(_defaultProject); }
int DLLEXPORT ENclearreport() { return EN_clearreport(_defaultProject); }
int DLLEXPORT ENresetreport() { return EN_resetreport(_defaultProject); }
int DLLEXPORT ENsetreport(char *format) { return EN_setreport(_defaultProject, format); }
@@ -185,11 +202,6 @@ int DLLEXPORT ENsetstatusreport(int level)
int DLLEXPORT ENgetversion(int *version) { return EN_getversion(version); }
int DLLEXPORT ENgetcount(int object, int *count)
{
return EN_getcount(_defaultProject, object, count);
}
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen)
{
return EN_geterror(errcode, errmsg, maxLen);
@@ -203,16 +215,6 @@ int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE *value)
return errcode;
}
int DLLEXPORT ENgettitle(char *titleline1, char *titleline2, char *titleline3)
{
return EN_gettitle(_defaultProject, titleline1, titleline2, titleline3) ;
}
int DLLEXPORT ENsettitle(char *titleline1, char *titleline2, char *titleline3)
{
return EN_settitle(_defaultProject, titleline1, titleline2, titleline3) ;
}
/********************************************************************
Analysis Options Functions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 12/10/2018
Last Updated: 02/08/2019
******************************************************************************
*/
@@ -84,6 +84,18 @@ int EXPORT_PY_API proj_open(Handle ph, const char *inpFile, const char *rptFile,
return error_set(pr->error, EN_open(pr->project, inpFile, rptFile, binOutFile));
}
int EXPORT_PY_API proj_gettitle(Handle ph, char *line1, char *line2, char *line3)
{
handle_t *pr = (handle_t *)ph;
return error_set(pr->error, EN_gettitle(pr->project, line1, line2, line3));
}
int EXPORT_PY_API proj_settitle(Handle ph, const char *line1, const char *line2, const char *line3)
{
handle_t *pr = (handle_t *)ph;
return error_set(pr->error, EN_settitle(pr->project, line1, line2, line3));
}
int EXPORT_PY_API proj_savefile(Handle ph, const char *filename)
{
handle_t *pr = (handle_t *)ph;
@@ -213,6 +225,12 @@ int EXPORT_PY_API rprt_writeresults(Handle ph)
return error_set(pr->error, EN_report(pr->project));
}
int EXPORT_PY_API rprt_clear(Handle ph)
{
handle_t *pr = (handle_t *)ph;
return error_set(pr->error, EN_clearreport(pr->project));
}
int EXPORT_PY_API rprt_reset(Handle ph)
{
handle_t *pr = (handle_t *)ph;

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 11/27/2018
Last Updated: 02/08/2019
******************************************************************************
*/
#ifndef FUNCS_H
@@ -108,6 +108,7 @@ int checkrules(Project *, long);
// ------- REPORT.C -----------------
int clearreport(Project *);
int writereport(Project *);
void writelogo(Project *);
void writesummary(Project *);

View File

@@ -57,6 +57,21 @@ static int checklimits(Report *, double *, int, int);
static char *fillstr(char *, char, int);
static int getnodetype(Network *, int);
int clearreport(Project *pr)
/*
**------------------------------------------------------
** Input: none
** Output: returns error code
** Purpose: clears contents of a project's report file
**------------------------------------------------------
*/
{
Report *rpt = &pr->report;
if (rpt->RptFile == NULL) return 0;
if (freopen(rpt->Rpt1Fname, "w", rpt->RptFile) == NULL) return 303;
writelogo(pr);
return 0;
}
int writereport(Project *pr)
/*

View File

@@ -21,9 +21,9 @@ Find /i "x86" < checkOS.tmp > StringCheck.tmp
If %ERRORLEVEL% == 1 (
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
rem : create EPANET2.DLL
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /Depanet2_EXPORTS /I ..\include /I ..\run /link /DLL
rem : create EPANET2.EXE
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /Depanet2_EXPORTS /I ..\include /I ..\run /I ..\src /link
md "%Build_PATH%"\64bit
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
@@ -35,9 +35,9 @@ rem : 32 bit with DEF
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
echo "32 bit with epanet2.def mapping"
rem : create EPANET2.DLL
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
cl -o epanet2.dll epanet.c epanet2.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /Depanet2_EXPORTS /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
rem : create EPANET2.EXE
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
cl -o epanet2.exe epanet.c epanet2.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c project.c quality.c qualroute.c qualreact.c report.c rules.c smatrix.c genmmd.c /Depanet2_EXPORTS /I ..\include /I ..\run /I ..\src /link
md "%Build_PATH%"\32bit
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit

View File

@@ -7,6 +7,7 @@ EXPORTS
ENaddnode = _ENaddnode@8
ENaddpattern = _ENaddpattern@4
ENaddrule = _ENaddrule@4
ENclearreport = _ENclearreport@0
ENclose = _ENclose@0
ENcloseH = _ENcloseH@0
ENcloseQ = _ENcloseQ@0
@@ -58,6 +59,7 @@ EXPORTS
ENgetstatistic = _ENgetstatistic@8
ENgetthenaction = _ENgetthenaction@20
ENgettimeparam = _ENgettimeparam@8
ENgettitle = _ENgettitle@12
ENgetversion = _ENgetversion@4
ENinit = _ENinit@16
ENinitH = _ENinitH@4
@@ -107,6 +109,7 @@ EXPORTS
ENsettankdata = _ENsettankdata@32
ENsetthenaction = _ENsetthenaction@20
ENsettimeparam = _ENsettimeparam@8
ENsettitle = _ENsettitle@12
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4