Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
@@ -5,7 +5,7 @@ Attribute VB_Name = "Module1"
|
|||||||
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
|
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
|
||||||
'(EPANET2.DLL)
|
'(EPANET2.DLL)
|
||||||
|
|
||||||
'Last updated on 02/08/2019
|
'Last updated on 02/28/2019
|
||||||
|
|
||||||
' These are codes used by the DLL functions
|
' These are codes used by the DLL functions
|
||||||
Public Const EN_ELEVATION = 0 ' Node parameters
|
Public Const EN_ELEVATION = 0 ' Node parameters
|
||||||
@@ -284,8 +284,8 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
|
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
|
||||||
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Long
|
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Long
|
||||||
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Long
|
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Long
|
||||||
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Long, x As Single, y As Single) As Long
|
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Long, x As Double, y As Double) As Long
|
||||||
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal x As Single, ByVal y As Single) As Long
|
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal x As Double, ByVal y As Double) As Long
|
||||||
|
|
||||||
'Nodal Demand Functions
|
'Nodal Demand Functions
|
||||||
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Long, pmin As Single, preq As Single, pexp As Single) As Long
|
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Long, pmin As Single, preq As Single, pexp As Single) As Long
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ EXPORTS
|
|||||||
ENsaveinpfile = _ENsaveinpfile@4
|
ENsaveinpfile = _ENsaveinpfile@4
|
||||||
ENsetbasedemand = _ENsetbasedemand@12
|
ENsetbasedemand = _ENsetbasedemand@12
|
||||||
ENsetcontrol = _ENsetcontrol@24
|
ENsetcontrol = _ENsetcontrol@24
|
||||||
ENsetcoord = _ENsetcoord@12
|
ENsetcoord = _ENsetcoord@20
|
||||||
ENsetcurve = _ENsetcurve@16
|
ENsetcurve = _ENsetcurve@16
|
||||||
ENsetcurveid = _ENsetcurveid@8
|
ENsetcurveid = _ENsetcurveid@8
|
||||||
ENsetcurvevalue = _ENsetcurvevalue@16
|
ENsetcurvevalue = _ENsetcurvevalue@16
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 02/08/2019
|
Last Updated: 02/28/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -210,9 +210,9 @@ extern "C" {
|
|||||||
EN_API_FLOAT_TYPE maxlvl, EN_API_FLOAT_TYPE diam,
|
EN_API_FLOAT_TYPE maxlvl, EN_API_FLOAT_TYPE diam,
|
||||||
EN_API_FLOAT_TYPE minvol, char *volcurve);
|
EN_API_FLOAT_TYPE minvol, char *volcurve);
|
||||||
|
|
||||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
|
int DLLEXPORT ENgetcoord(int index, double *x, double *y);
|
||||||
|
|
||||||
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
|
int DLLEXPORT ENsetcoord(int index, double x, double y);
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
@@ -403,10 +403,9 @@ extern "C" {
|
|||||||
|
|
||||||
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,
|
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,
|
||||||
int status, EN_API_FLOAT_TYPE setting);
|
int status, EN_API_FLOAT_TYPE setting);
|
||||||
|
|
||||||
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
|
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
|
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
|
||||||
'(EPANET2.DLL) for use with VB.Net.
|
'(EPANET2.DLL) for use with VB.Net.
|
||||||
|
|
||||||
'Last updated on 02/08/2019
|
'Last updated on 02/28/2019
|
||||||
|
|
||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
@@ -289,8 +289,8 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
|
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
|
||||||
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Int32
|
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Int32
|
||||||
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Int32
|
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Int32
|
||||||
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Int32, x As Single, y As Single) As Int32
|
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Int32, x As Double, y As Double) As Int32
|
||||||
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Int32, ByVal x As Single, ByVal y As Single) As Int32
|
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Int32, ByVal x As Double, ByVal y As Double) As Int32
|
||||||
|
|
||||||
'Nodal Demand Functions
|
'Nodal Demand Functions
|
||||||
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Int32, pmin As Single, preq As Single, pexp As Single) As Int32
|
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Int32, pmin As Single, preq As Single, pexp As Single) As Int32
|
||||||
|
|||||||
24
src/epanet.c
24
src/epanet.c
@@ -7,7 +7,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 02/08/2019
|
Last Updated: 03/05/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -332,24 +332,12 @@ int DLLEXPORT EN_close(EN_Project p)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Outfile *out;
|
|
||||||
|
|
||||||
// Free all project data
|
// Free all project data
|
||||||
if (p->Openflag) writetime(p, FMT105);
|
if (p->Openflag) writetime(p, FMT105);
|
||||||
freedata(p);
|
freedata(p);
|
||||||
|
|
||||||
// Close output file
|
// Close output file
|
||||||
out = &p->outfile;
|
closeoutfile(p);
|
||||||
if (out->TmpOutFile != out->OutFile)
|
|
||||||
{
|
|
||||||
if (out->TmpOutFile != NULL) fclose(out->TmpOutFile);
|
|
||||||
out->TmpOutFile = NULL;
|
|
||||||
}
|
|
||||||
if (out->OutFile != NULL)
|
|
||||||
{
|
|
||||||
fclose(out->OutFile);
|
|
||||||
out->OutFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close input file
|
// Close input file
|
||||||
if (p->parser.InFile != NULL)
|
if (p->parser.InFile != NULL)
|
||||||
@@ -366,10 +354,10 @@ int DLLEXPORT EN_close(EN_Project p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close hydraulics file
|
// Close hydraulics file
|
||||||
if (out->HydFile != NULL)
|
if (p->outfile.HydFile != NULL)
|
||||||
{
|
{
|
||||||
fclose(out->HydFile);
|
fclose(p->outfile.HydFile);
|
||||||
out->HydFile = NULL;
|
p->outfile.HydFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset system flags
|
// Reset system flags
|
||||||
@@ -819,6 +807,7 @@ int DLLEXPORT EN_closeQ(EN_Project p)
|
|||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
closequal(p);
|
closequal(p);
|
||||||
p->quality.OpenQflag = FALSE;
|
p->quality.OpenQflag = FALSE;
|
||||||
|
closeoutfile(p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1571,6 +1560,7 @@ int DLLEXPORT EN_setqualtype(EN_Project p, int qualType, char *chemName,
|
|||||||
double ccf = 1.0;
|
double ccf = 1.0;
|
||||||
|
|
||||||
if (!p->Openflag) return 102;
|
if (!p->Openflag) return 102;
|
||||||
|
if (qual->OpenQflag) return 262;
|
||||||
if (qualType < EN_NONE || qualType > EN_TRACE) return 251;
|
if (qualType < EN_NONE || qualType > EN_TRACE) return 251;
|
||||||
qual->Qualflag = (char)qualType;
|
qual->Qualflag = (char)qualType;
|
||||||
qual->Ctol *= Ucf[QUALITY];
|
qual->Ctol *= Ucf[QUALITY];
|
||||||
|
|||||||
@@ -340,16 +340,12 @@ int DLLEXPORT ENsettankdata(int index, EN_API_FLOAT_TYPE elev,
|
|||||||
diam, minvol, volcurve);
|
diam, minvol, volcurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
int DLLEXPORT ENgetcoord(int index, double *x, double *y)
|
||||||
{
|
{
|
||||||
double xx = 0.0, yy = 0.0;
|
return EN_getcoord(_defaultProject, index, x, y);
|
||||||
int errcode = EN_getcoord(_defaultProject, index, &xx, &yy);
|
|
||||||
*x = (EN_API_FLOAT_TYPE)xx;
|
|
||||||
*y = (EN_API_FLOAT_TYPE)yy;
|
|
||||||
return errcode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
int DLLEXPORT ENsetcoord(int index, double x, double y)
|
||||||
{
|
{
|
||||||
return EN_setcoord(_defaultProject, index, x, y);
|
return EN_setcoord(_defaultProject, index, x, y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ void freedata(Project *);
|
|||||||
int openfiles(Project *, const char *, const char *,const char *);
|
int openfiles(Project *, const char *, const char *,const char *);
|
||||||
int openhydfile(Project *);
|
int openhydfile(Project *);
|
||||||
int openoutfile(Project *);
|
int openoutfile(Project *);
|
||||||
|
void closeoutfile(Project *);
|
||||||
|
|
||||||
int buildadjlists(Network *);
|
int buildadjlists(Network *);
|
||||||
void freeadjlists(Network *);
|
void freeadjlists(Network *);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 01/01/2019
|
Last Updated: 03/05/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -43,13 +43,18 @@ int openfiles(Project *pr, const char *f1, const char *f2, const char *f3)
|
|||||||
pr->report.RptFile = NULL;
|
pr->report.RptFile = NULL;
|
||||||
pr->outfile.OutFile = NULL;
|
pr->outfile.OutFile = NULL;
|
||||||
pr->outfile.HydFile = NULL;
|
pr->outfile.HydFile = NULL;
|
||||||
|
pr->outfile.TmpOutFile = NULL;
|
||||||
|
|
||||||
// Save file names
|
// Save file names
|
||||||
strncpy(pr->parser.InpFname, f1, MAXFNAME);
|
strncpy(pr->parser.InpFname, f1, MAXFNAME);
|
||||||
strncpy(pr->report.Rpt1Fname, f2, MAXFNAME);
|
strncpy(pr->report.Rpt1Fname, f2, MAXFNAME);
|
||||||
strncpy(pr->outfile.OutFname, f3, MAXFNAME);
|
strncpy(pr->outfile.OutFname, f3, MAXFNAME);
|
||||||
if (strlen(f3) > 0) pr->outfile.Outflag = SAVE;
|
if (strlen(f3) > 0) pr->outfile.Outflag = SAVE;
|
||||||
else pr->outfile.Outflag = SCRATCH;
|
else
|
||||||
|
{
|
||||||
|
pr->outfile.Outflag = SCRATCH;
|
||||||
|
strcpy(pr->outfile.OutFname, pr->TmpOutFname);
|
||||||
|
}
|
||||||
|
|
||||||
// Check that file names are not identical
|
// Check that file names are not identical
|
||||||
if (strlen(f1) > 0 && (strcomp(f1, f2) || strcomp(f1, f3))) return 301;
|
if (strlen(f1) > 0 && (strcomp(f1, f2) || strcomp(f1, f3))) return 301;
|
||||||
@@ -95,6 +100,7 @@ int openhydfile(Project *pr)
|
|||||||
{
|
{
|
||||||
if (pr->outfile.Hydflag == SCRATCH) return 0;
|
if (pr->outfile.Hydflag == SCRATCH) return 0;
|
||||||
fclose(pr->outfile.HydFile);
|
fclose(pr->outfile.HydFile);
|
||||||
|
pr->outfile.HydFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use Hydflag to determine the type of hydraulics file to use.
|
// Use Hydflag to determine the type of hydraulics file to use.
|
||||||
@@ -167,30 +173,12 @@ int openoutfile(Project *pr)
|
|||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
|
||||||
// Close output file if already opened
|
// Close output file if already opened
|
||||||
if (pr->outfile.OutFile != NULL)
|
closeoutfile(pr);
|
||||||
{
|
|
||||||
fclose(pr->outfile.OutFile);
|
|
||||||
pr->outfile.OutFile = NULL;
|
|
||||||
}
|
|
||||||
if (pr->outfile.TmpOutFile != NULL)
|
|
||||||
{
|
|
||||||
fclose(pr->outfile.TmpOutFile);
|
|
||||||
pr->outfile.TmpOutFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If output file name was supplied, then attempt to
|
// If output file name was supplied, then attempt to
|
||||||
// open it. Otherwise open a temporary output file.
|
// open it. Otherwise open a temporary output file.
|
||||||
if (pr->outfile.Outflag == SAVE)
|
pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b");
|
||||||
{
|
if (pr->outfile.OutFile == NULL) errcode = 304;
|
||||||
pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b");
|
|
||||||
if (pr->outfile.OutFile == NULL) errcode = 304;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy(pr->outfile.OutFname, pr->TmpOutFname);
|
|
||||||
pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b");
|
|
||||||
if (pr->outfile.OutFile == NULL) errcode = 304;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save basic network data & energy usage results
|
// Save basic network data & energy usage results
|
||||||
ERRCODE(savenetdata(pr));
|
ERRCODE(savenetdata(pr));
|
||||||
@@ -211,6 +199,33 @@ int openoutfile(Project *pr)
|
|||||||
return errcode;
|
return errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void closeoutfile(Project *pr)
|
||||||
|
/*----------------------------------------------------------------
|
||||||
|
** Input: none
|
||||||
|
** Output: none
|
||||||
|
** Purpose: closes binary output file.
|
||||||
|
**----------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
if (pr->outfile.TmpOutFile != pr->outfile.OutFile)
|
||||||
|
{
|
||||||
|
if (pr->outfile.TmpOutFile != NULL)
|
||||||
|
{
|
||||||
|
fclose(pr->outfile.TmpOutFile);
|
||||||
|
pr->outfile.TmpOutFile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pr->outfile.OutFile != NULL)
|
||||||
|
{
|
||||||
|
if (pr->outfile.OutFile == pr->outfile.TmpOutFile)
|
||||||
|
{
|
||||||
|
pr->outfile.TmpOutFile = NULL;
|
||||||
|
}
|
||||||
|
fclose(pr->outfile.OutFile);
|
||||||
|
pr->outfile.OutFile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void initpointers(Project *pr)
|
void initpointers(Project *pr)
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
** Input: none
|
** Input: none
|
||||||
@@ -269,7 +284,7 @@ void initpointers(Project *pr)
|
|||||||
pr->hydraul.smatrix.XLNZ = NULL;
|
pr->hydraul.smatrix.XLNZ = NULL;
|
||||||
pr->hydraul.smatrix.NZSUB = NULL;
|
pr->hydraul.smatrix.NZSUB = NULL;
|
||||||
pr->hydraul.smatrix.LNZ = NULL;
|
pr->hydraul.smatrix.LNZ = NULL;
|
||||||
|
|
||||||
initrules(pr);
|
initrules(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,7 @@ Last Updated: 11/27/2018
|
|||||||
// Stagnant flow tolerance
|
// Stagnant flow tolerance
|
||||||
const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
|
const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
|
||||||
|
|
||||||
// Exported functions (declared in FUNCS.H)
|
// Exported functions
|
||||||
//int openqual(Project *);
|
|
||||||
//void initqual(Project *);
|
|
||||||
//int runqual(Project *, long *);
|
|
||||||
//int nextqual(Project *, long *);
|
|
||||||
//int stepqual(Project *, long *);
|
|
||||||
//int closequal(Project *);
|
|
||||||
//double avgqual(Project *, int);
|
|
||||||
double findsourcequal(Project *, int, double, long);
|
double findsourcequal(Project *, int, double, long);
|
||||||
|
|
||||||
// Imported functions
|
// Imported functions
|
||||||
@@ -67,6 +60,9 @@ int openqual(Project *pr)
|
|||||||
|
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
// Return if no quality analysis requested
|
||||||
|
if (qual->Qualflag == NONE) return errcode;
|
||||||
|
|
||||||
// Build nodal adjacency lists if they don't already exist
|
// Build nodal adjacency lists if they don't already exist
|
||||||
if (net->Adjlist == NULL)
|
if (net->Adjlist == NULL)
|
||||||
@@ -401,12 +397,15 @@ int closequal(Project *pr)
|
|||||||
Quality *qual = &pr->quality;
|
Quality *qual = &pr->quality;
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
|
||||||
if (qual->SegPool) mempool_delete(qual->SegPool);
|
if (qual->Qualflag != NONE)
|
||||||
FREE(qual->FirstSeg);
|
{
|
||||||
FREE(qual->LastSeg);
|
if (qual->SegPool) mempool_delete(qual->SegPool);
|
||||||
FREE(qual->PipeRateCoeff);
|
FREE(qual->FirstSeg);
|
||||||
FREE(qual->FlowDir);
|
FREE(qual->LastSeg);
|
||||||
FREE(qual->SortedNodes);
|
FREE(qual->PipeRateCoeff);
|
||||||
|
FREE(qual->FlowDir);
|
||||||
|
FREE(qual->SortedNodes);
|
||||||
|
}
|
||||||
return errcode;
|
return errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
src/report.c
23
src/report.c
@@ -7,7 +7,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 11/27/2018
|
Last Updated: 03/05/2019
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -98,12 +98,7 @@ int copyreport(Project* pr, char *filename)
|
|||||||
// Copy contents of project's report file
|
// Copy contents of project's report file
|
||||||
if (rpt->RptFile)
|
if (rpt->RptFile)
|
||||||
{
|
{
|
||||||
c = fgetc(rpt->RptFile);
|
while ((c = fgetc(rpt->RptFile)) != EOF) fputc(c, tfile);
|
||||||
while (c != EOF)
|
|
||||||
{
|
|
||||||
fputc(c, tfile);
|
|
||||||
c = fgetc(rpt->RptFile);
|
|
||||||
}
|
|
||||||
fclose(rpt->RptFile);
|
fclose(rpt->RptFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,9 +534,6 @@ int writeresults(Project *pr)
|
|||||||
// at each reporting time.
|
// at each reporting time.
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
// Return if no output file
|
|
||||||
if (outFile == NULL) return 106;
|
|
||||||
|
|
||||||
// Return if no nodes or links selected for reporting
|
// Return if no nodes or links selected for reporting
|
||||||
// or if no node or link report variables enabled
|
// or if no node or link report variables enabled
|
||||||
if (!rpt->Nodeflag && !rpt->Linkflag) return errcode;
|
if (!rpt->Nodeflag && !rpt->Linkflag) return errcode;
|
||||||
@@ -552,6 +544,10 @@ int writeresults(Project *pr)
|
|||||||
for (j = LENGTH; j <= FRICTION; j++) nlv += rpt->Field[j].Enabled;
|
for (j = LENGTH; j <= FRICTION; j++) nlv += rpt->Field[j].Enabled;
|
||||||
if (nnv == 0 && nlv == 0) return errcode;
|
if (nnv == 0 && nlv == 0) return errcode;
|
||||||
|
|
||||||
|
// Return if no output file
|
||||||
|
if (outFile == NULL) outFile = fopen(pr->outfile.OutFname, "rb");
|
||||||
|
if (outFile == NULL) return 106;
|
||||||
|
|
||||||
// Allocate memory for output variables:
|
// Allocate memory for output variables:
|
||||||
// m = larger of # node variables & # link variables
|
// m = larger of # node variables & # link variables
|
||||||
// n = larger of # nodes & # links
|
// n = larger of # nodes & # links
|
||||||
@@ -592,6 +588,13 @@ int writeresults(Project *pr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Free output file
|
||||||
|
if (outFile != NULL)
|
||||||
|
{
|
||||||
|
fclose(outFile);
|
||||||
|
outFile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Free allocated memory
|
// Free allocated memory
|
||||||
for (j = 0; j < m; j++) free(x[j]);
|
for (j = 0; j < m; j++) free(x[j]);
|
||||||
free(x);
|
free(x);
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ EXPORTS
|
|||||||
ENclose = _ENclose@0
|
ENclose = _ENclose@0
|
||||||
ENcloseH = _ENcloseH@0
|
ENcloseH = _ENcloseH@0
|
||||||
ENcloseQ = _ENcloseQ@0
|
ENcloseQ = _ENcloseQ@0
|
||||||
|
ENcopyreport = _ENcopyreport@4
|
||||||
ENdeletecontrol = _ENdeletecontrol@4
|
ENdeletecontrol = _ENdeletecontrol@4
|
||||||
|
ENdeletecurve = _ENdeletecurve@4
|
||||||
ENdeletelink = _ENdeletelink@8
|
ENdeletelink = _ENdeletelink@8
|
||||||
ENdeletenode = _ENdeletenode@8
|
ENdeletenode = _ENdeletenode@8
|
||||||
|
ENdeletepattern = _ENdeletepattern@4
|
||||||
ENdeleterule = _ENdeleterule@4
|
ENdeleterule = _ENdeleterule@4
|
||||||
ENepanet = _ENepanet@16
|
ENepanet = _ENepanet@16
|
||||||
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
|
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
|
||||||
@@ -58,7 +61,7 @@ EXPORTS
|
|||||||
ENgetruleID = _ENgetruleID@8
|
ENgetruleID = _ENgetruleID@8
|
||||||
ENgetstatistic = _ENgetstatistic@8
|
ENgetstatistic = _ENgetstatistic@8
|
||||||
ENgetthenaction = _ENgetthenaction@20
|
ENgetthenaction = _ENgetthenaction@20
|
||||||
ENgettimeparam = _ENgettimeparam@8
|
ENgettimeparam = _ENgettimeparam@8
|
||||||
ENgettitle = _ENgettitle@12
|
ENgettitle = _ENgettitle@12
|
||||||
ENgetversion = _ENgetversion@4
|
ENgetversion = _ENgetversion@4
|
||||||
ENinit = _ENinit@16
|
ENinit = _ENinit@16
|
||||||
@@ -78,8 +81,9 @@ EXPORTS
|
|||||||
ENsaveinpfile = _ENsaveinpfile@4
|
ENsaveinpfile = _ENsaveinpfile@4
|
||||||
ENsetbasedemand = _ENsetbasedemand@12
|
ENsetbasedemand = _ENsetbasedemand@12
|
||||||
ENsetcontrol = _ENsetcontrol@24
|
ENsetcontrol = _ENsetcontrol@24
|
||||||
ENsetcoord = _ENsetcoord@12
|
ENsetcoord = _ENsetcoord@20
|
||||||
ENsetcurve = _ENsetcurve@16
|
ENsetcurve = _ENsetcurve@16
|
||||||
|
ENsetcurveid = _ENsetcurveid@8
|
||||||
ENsetcurvevalue = _ENsetcurvevalue@16
|
ENsetcurvevalue = _ENsetcurvevalue@16
|
||||||
ENsetdemandmodel = _ENsetdemandmodel@16
|
ENsetdemandmodel = _ENsetdemandmodel@16
|
||||||
ENsetdemandname = _ENsetdemandname@12
|
ENsetdemandname = _ENsetdemandname@12
|
||||||
@@ -95,7 +99,8 @@ EXPORTS
|
|||||||
ENsetnodeid = _ENsetnodeid@8
|
ENsetnodeid = _ENsetnodeid@8
|
||||||
ENsetnodevalue = _ENsetnodevalue@12
|
ENsetnodevalue = _ENsetnodevalue@12
|
||||||
ENsetoption = _ENsetoption@8
|
ENsetoption = _ENsetoption@8
|
||||||
ENsetpattern = _ENsetpattern@12
|
ENsetpattern = _ENsetpattern@12
|
||||||
|
ENsetpatternid = _ENsetpatternid@8
|
||||||
ENsetpatternvalue = _ENsetpatternvalue@12
|
ENsetpatternvalue = _ENsetpatternvalue@12
|
||||||
ENsetpipedata = _ENsetpipedata@20
|
ENsetpipedata = _ENsetpipedata@20
|
||||||
ENsetpremise = _ENsetpremise@36
|
ENsetpremise = _ENsetpremise@36
|
||||||
@@ -108,12 +113,10 @@ EXPORTS
|
|||||||
ENsetstatusreport = _ENsetstatusreport@4
|
ENsetstatusreport = _ENsetstatusreport@4
|
||||||
ENsettankdata = _ENsettankdata@32
|
ENsettankdata = _ENsettankdata@32
|
||||||
ENsetthenaction = _ENsetthenaction@20
|
ENsetthenaction = _ENsetthenaction@20
|
||||||
ENsettimeparam = _ENsettimeparam@8
|
ENsettimeparam = _ENsettimeparam@8
|
||||||
ENsettitle = _ENsettitle@12
|
ENsettitle = _ENsettitle@12
|
||||||
ENsolveH = _ENsolveH@0
|
ENsolveH = _ENsolveH@0
|
||||||
ENsolveQ = _ENsolveQ@0
|
ENsolveQ = _ENsolveQ@0
|
||||||
ENstepQ = _ENstepQ@4
|
ENstepQ = _ENstepQ@4
|
||||||
ENusehydfile = _ENusehydfile@4
|
ENusehydfile = _ENusehydfile@4
|
||||||
ENwriteline = _ENwriteline@4
|
ENwriteline = _ENwriteline@4
|
||||||
ENgettitle = _ENgettitle@12
|
|
||||||
ENsettitle = _ENsettitle@12
|
|
||||||
Reference in New Issue
Block a user