apple define, some cleanup

- apple / *nix defines out the DLL[EX/IM]PORT directives
- we should be using dox markup (see ENrunnexHQ for example)
This commit is contained in:
Sam Hatchett
2013-01-31 15:30:07 -05:00
parent 4f693792c8
commit e5eeccbd1e
3 changed files with 51 additions and 40 deletions

View File

@@ -47,48 +47,55 @@ int nexthydLT(long *tstep);
void updateTanklevels(); void updateTanklevels();
//Prior to running hydraulic simulation, update the tank levels. //Prior to running hydraulic simulation, update the tank levels.
int DLLEXPORT ENrunnextHQ(long* pstime, /*Simulation time pointer*/
long* ptstep /*next time step*/ ) {
/* The lemonTiger equivalent of ENnextQ, hydraulic solver is called on-demand*/
long hydtime; /* Hydraulic solution time */
long hydstep; /* Hydraulic time step */
int errcode = 0;
/* if needed, push forward hydraulic simulation, similar to runqual() */
if (Qtime == Htime)
{
if ( (errcode = runhyd(&hydtime)) ||
(errcode = nexthydLT(&hydstep))
) return errcode;
/* If simulating WQ: */
if (Qualflag != NONE && Qtime < Dur) {
/*!
\fn int ENrunnexHQ( long* simTimePtr, long* timeStepPtr )
\brief equivalent of ENnextQ, hydraulic solver is called on-demand
\param simTimePtr Simulation time (output variable).
\param timeStepPtr Time to next time step boundary (output variable).
\return on error, an error code
*/
int DLLEXPORT ENrunnextHQ(long* simTimePtr, long* timeStepPtr) {
/* The lemonTiger equivalent of ENnextQ, hydraulic solver is called on-demand*/
long hydtime; /* Hydraulic solution time */
long hydstep; /* Hydraulic time step */
int errcode = 0;
/* if needed, push forward hydraulic simulation, similar to runqual() */
if (Qtime == Htime)
{
if ( (errcode = runhyd(&hydtime)) || (errcode = nexthydLT(&hydstep)) ) {
return errcode;
}
/* If simulating WQ: */
if (Qualflag != NONE && Qtime < Dur) {
/* Compute reaction rate coeffs. */ /* Compute reaction rate coeffs. */
if (Reactflag && Qualflag != AGE) ratecoeffs(); if (Reactflag && Qualflag != AGE) ratecoeffs();
/* Initialize pipe segments (at time 0) or */ /* Initialize pipe segments (at time 0) or */
/* else re-orient segments if flow reverses.*/ /* else re-orient segments if flow reverses.*/
if (Qtime == 0) initsegs(); if (Qtime == 0) initsegs();
else reorientsegs(); else reorientsegs();
} }
Htime = hydtime + hydstep; Htime = hydtime + hydstep;
} }
*pstime = Htime; *simTimePtr = Htime;
hydstep = Htime - Qtime; hydstep = Htime - Qtime;
/* Perform water quality routing over this time step */ /* Perform water quality routing over this time step */
if (Qualflag != NONE && hydstep > 0) transport(hydstep); if (Qualflag != NONE && hydstep > 0) transport(hydstep);
updateTanklevels(); updateTanklevels();
/* Update current time */ /* Update current time */
if (OutOfMemory) errcode = 101; if (OutOfMemory) errcode = 101;
if (!errcode) *ptstep = hydstep; if (!errcode) *timeStepPtr = hydstep;
Qtime += hydstep; Qtime += hydstep;
/* Save final output if no more time steps */ /* Save final output if no more time steps */
if (!errcode && Saveflag && *ptstep == 0) errcode = savefinaloutput(); if (!errcode && Saveflag && *timeStepPtr == 0) errcode = savefinaloutput();
return(errcode); return(errcode);
} }
int DLLEXPORT ENrunstepHQ(long* pstime /* Simulation time pointer */ int DLLEXPORT ENrunstepHQ(long* pstime /* Simulation time pointer */

View File

@@ -6,9 +6,11 @@ all original Epanet functions remain intact, and the new LT_functions are added.
/*Note that this file is not used by the functions in the toolkit itself. /*Note that this file is not used by the functions in the toolkit itself.
Refer to toolkit.h for the internally used function declarations. */ Refer to toolkit.h for the internally used function declarations. */
#ifdef __APPLE__
#define DLLIMPORT __declspec(dllimport) #define DLLIMPORT
#else
#define DLLIMPORT __declspec(dllimport)
#endif
// --- Define the EPANET toolkit constants // --- Define the EPANET toolkit constants
#define EN_ELEVATION 0 /* Node parameters */ #define EN_ELEVATION 0 /* Node parameters */

View File

@@ -25,9 +25,11 @@ AUTHOR: L. Rossman
//#define CLE_LT /* LemonTiger test */ //Jinduan Chen //#define CLE_LT /* LemonTiger test */ //Jinduan Chen
#define DLL_LT /* Compile as a Windows DLL of LemonTiger */ #define DLL_LT /* Compile as a Windows DLL of LemonTiger */
#ifdef __APPLE__
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT
#else
#define DLLEXPORT __declspec(dllexport)
#endif
// --- Define the EPANET toolkit constants // --- Define the EPANET toolkit constants
#define EN_ELEVATION 0 /* Node parameters */ #define EN_ELEVATION 0 /* Node parameters */