New updates to address compiler warnings (issue #370)

In addition to addressing compiler warnings, argument names in the API function prototypes were made more consistent and descriptive. Also additional Doxygen comments were added in preparation for producing a more thorough documentation of the API.
This commit is contained in:
Lew Rossman
2019-01-19 16:56:19 -05:00
parent 414db4d7e2
commit 0cfa45e52e
16 changed files with 1034 additions and 754 deletions

View File

@@ -35,7 +35,7 @@ const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
//int stepqual(Project *, long *);
//int closequal(Project *);
//double avgqual(Project *, int);
double findsourcequal(Project *, int, double, double, long);
double findsourcequal(Project *, int, double, long);
// Imported functions
extern char setreactflag(Project *);
@@ -78,21 +78,21 @@ int openqual(Project *pr)
// Create a memory pool for water quality segments
qual->OutOfMemory = FALSE;
qual->SegPool = mempool_create();
if (qual->SegPool == NULL) errcode = 101;
if (qual->SegPool == NULL) errcode = 101;
// Allocate arrays for link flow direction & reaction rates
n = net->Nlinks + 1;
qual->FlowDir = (FlowDirection *)calloc(n, sizeof(FlowDirection));
qual->PipeRateCoeff = (double *)calloc(n, sizeof(double));
// Allocate arrays used for volume segments in links & tanks
// Allocate arrays used for volume segments in links & tanks
n = net->Nlinks + net->Ntanks + 1;
qual->FirstSeg = (Pseg *)calloc(n, sizeof(Pseg));
qual->LastSeg = (Pseg *)calloc(n, sizeof(Pseg));
// Allocate memory for topologically sorted nodes
// Allocate memory for topologically sorted nodes
qual->SortedNodes = (int *)calloc(n, sizeof(int));
ERRCODE(MEMCHECK(qual->FlowDir));
ERRCODE(MEMCHECK(qual->PipeRateCoeff));
ERRCODE(MEMCHECK(qual->FirstSeg));
@@ -119,7 +119,7 @@ int initqual(Project *pr)
int i;
int errcode = 0;
// Re-position hydraulics file
// Re-position hydraulics file
if (!hyd->OpenHflag)
{
fseek(pr->outfile.HydFile, pr->outfile.HydOffset, SEEK_SET);
@@ -148,7 +148,7 @@ int initqual(Project *pr)
// Initialize quality at trace node (if applicable)
if (qual->Qualflag == TRACE) qual->NodeQual[qual->TraceNode] = 100.0;
// Compute Schmidt number
if (qual->Diffus > 0.0) qual->Sc = hyd->Viscos / qual->Diffus;
else qual->Sc = 0.0;
@@ -202,17 +202,17 @@ int runqual(Project *pr, long *t)
Quality *qual = &pr->quality;
Times *time = &pr->times;
long hydtime; // Hydraulic solution time
long hydstep; // Hydraulic time step
long hydtime = 0; // Hydraulic solution time
long hydstep = 0; // Hydraulic time step
int errcode = 0;
// Update reported simulation time
*t = time->Qtime;
// Read hydraulic solution from hydraulics file
// Read hydraulic solution from hydraulics file
if (time->Qtime == time->Htime)
{
// Read hydraulic results from file
// Read hydraulic results from file
if (!hyd->OpenHflag)
{
if (!readhyd(pr, &hydtime)) return 307;
@@ -220,7 +220,7 @@ int runqual(Project *pr, long *t)
time->Htime = hydtime;
}
// Save current results to output file
// Save current results to output file
if (time->Htime >= time->Rtime)
{
if (pr->outfile.Saveflag)
@@ -263,7 +263,7 @@ int nextqual(Project *pr, long *tstep)
{
Quality *qual = &pr->quality;
Times *time = &pr->times;
long hydstep; // Time step until next hydraulic event
long dt, qtime;
int errcode = 0;
@@ -316,7 +316,7 @@ int stepqual(Project *pr, long *tleft)
** Input: none
** Output: tleft = time left in simulation
** Returns: error code
** Purpose: updates quality conditions over a single
** Purpose: updates quality conditions over a single
** quality time step
**--------------------------------------------------------------
*/
@@ -402,7 +402,7 @@ int closequal(Project *pr)
int errcode = 0;
if (qual->SegPool) mempool_delete(qual->SegPool);
FREE(qual->FirstSeg);
FREE(qual->FirstSeg);
FREE(qual->LastSeg);
FREE(qual->PipeRateCoeff);
FREE(qual->FlowDir);
@@ -452,11 +452,10 @@ double avgqual(Project *pr, int k)
}
double findsourcequal(Project *pr, int n, double volin, double volout, long tstep)
double findsourcequal(Project *pr, int n, double volout, long tstep)
/*
**---------------------------------------------------------------------
** Input: n = node index
** volin = volume of node inflow over time step
** volout = volume of node outflow over time step
** tstep = current quality time step
** Output: returns concentration added by an external quality source.
@@ -543,7 +542,6 @@ double sourcequal(Project *pr, Psource source)
*/
{
Network *net = &pr->network;
Quality *qual = &pr->quality;
Times *time = &pr->times;
int i;