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();
//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. */
if (Reactflag && Qualflag != AGE) ratecoeffs();
/* Initialize pipe segments (at time 0) or */
/* else re-orient segments if flow reverses.*/
if (Qtime == 0) initsegs();
else reorientsegs();
}
Htime = hydtime + hydstep;
}
*pstime = Htime;
hydstep = Htime - Qtime;
/* Perform water quality routing over this time step */
if (Qualflag != NONE && hydstep > 0) transport(hydstep);
updateTanklevels();
/* Update current time */
if (OutOfMemory) errcode = 101;
if (!errcode) *ptstep = hydstep;
Qtime += hydstep;
/* Save final output if no more time steps */
if (!errcode && Saveflag && *ptstep == 0) errcode = savefinaloutput();
return(errcode);
Htime = hydtime + hydstep;
}
*simTimePtr = Htime;
hydstep = Htime - Qtime;
/* Perform water quality routing over this time step */
if (Qualflag != NONE && hydstep > 0) transport(hydstep);
updateTanklevels();
/* Update current time */
if (OutOfMemory) errcode = 101;
if (!errcode) *timeStepPtr = hydstep;
Qtime += hydstep;
/* Save final output if no more time steps */
if (!errcode && Saveflag && *timeStepPtr == 0) errcode = savefinaloutput();
return(errcode);
}
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.
Refer to toolkit.h for the internally used function declarations. */
#define DLLIMPORT __declspec(dllimport)
#ifdef __APPLE__
#define DLLIMPORT
#else
#define DLLIMPORT __declspec(dllimport)
#endif
// --- Define the EPANET toolkit constants
#define EN_ELEVATION 0 /* Node parameters */

View File

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