OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
funcs.h File Reference

Header file for global interfacing functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void project_open (const char *inp_file, const char *rpt_file, const char *out_file)
 Opens a new SWMM project.
 
void project_close (void)
 Close project.
 
void project_readInput (void)
 Read project inputs.
 
int project_readOption (char *s1, char *s2)
 Reads a project option from a pair of string tokens.
 
void project_validate (void)
 Checks validity of project data.
 
int project_init (void)
 Initializes the internal state of the project.
 
int project_addObject (int type, char *id, int n)
 Adds an object Id to a hash table.
 
int project_findObject (int type, const char *id)
 Uses hash table to find index of an object with a given ID.
 
char * project_findID (int type, char *id)
 Uses hash table to find address of a given string entry.
 
double ** project_createMatrix (int nrows, int ncols)
 Allocates memory for a matrix of doubles.
 
void project_freeMatrix (double **m)
 Frees memory allocated for a matrix of doubles.
 
int input_countObjects (void)
 Reads input file to determine number of system objects.
 
int input_readData (void)
 Reads input file to determine number of system objects.
 
int report_readOptions (char *tok[], int ntoks)
 Reads reporting options from a line of input data.
 
void report_writeLine (const char *line)
 Writes a line of text to the report file.
 
void report_writeSysTime (void)
 Writes starting/ending processing times to the report file.
 
void report_writeLogo (void)
 Writes report header lines to report file.
 
void report_writeTitle (void)
 Writes project title to report file.
 
void report_writeOptions (void)
 Writes analysis options in use to report file.
 
void report_writeReport (void)
 Writes project title to report file.
 
void report_writeRainStats (int i, TRainStats *r)
 Writes summary of rain data read from input file to report file.
 
void report_writeRdiiStats (double rainVol, double rdiiVol)
 Writes summary of RDII inflow to report file.
 
void report_writeControlActionsHeading (void)
 Writes summary control actions heading to report file.
 
void report_writeControlAction (DateTime aDate, char *linkID, double value, char *ruleID)
 Writes control action to report file.
 
void report_writeRunoffError (TRunoffTotals *totals, double totalArea)
 Writes runoff continuity error to report file.
 
void report_writeLoadingError (TLoadingTotals *totals)
 Writes runoff loading continuity error to report file.
 
void report_writeGwaterError (TGwaterTotals *totals, double gwArea)
 Writes groundwater continuity error to report file.
 
void report_writeFlowError (TRoutingTotals *totals)
 Writes flow routing continuity error to report file.
 
void report_writeQualError (TRoutingTotals *QualTotals)
 Writes quality routing continuity error to report file.
 
void report_writeMaxStats (TMaxStats maxMassBalErrs[], TMaxStats maxCourantCrit[], int nMaxStats)
 Lists nodes and links with highest mass balance errors and courant time step violations to report file.
 
void report_writeMaxFlowTurns (TMaxStats flowTurns[], int nMaxStats)
 Lists links with highest number of flow turns to report (i.e., fraction of time periods where the flow is higher (or lower) than the flows in the previous and following periods)
 
void report_writeNonconvergedStats (TMaxStats maxNonconverged[], int nMaxStats)
 Writes non-converging nodes to report file.
 
void report_writeTimeStepStats (TTimeStepStats *timeStepStats)
 Writes routing time step statistics to report file.
 
void report_writeErrorMsg (int code, char *s)
 Writes error message to report file.
 
void report_writeErrorCode (void)
 Writes error message to report file.
 
void report_writeInputErrorMsg (int k, int sect, char *line, long lineCount)
 Writes input error message to report file.
 
void report_writeWarningMsg (char *msg, char *id)
 Writes a warning message to report file.
 
void report_invokeWarningCallback (const char *msg)
 Invokes the registered warning callback (if any) with a message.
 
void report_writeTseriesErrorMsg (int code, TTable *tseries)
 Writes the date where a time series' data is out of order.
 
void inputrpt_writeInput (void)
 Writes summary of input data to report file.
 
void statsrpt_writeReport (void)
 Reports simulation summary statistics.
 
int climate_readParams (char *tok[], int ntoks)
 Reads climate/temperature parameters from input line of data.
 
int climate_readEvapParams (char *tok[], int ntoks)
 Reads evaporation parameters from input line of data.
 
int climate_readAdjustments (char *tok[], int ntoks)
 Reads adjustments to monthly evaporation or rainfall from input line of data.
 
void climate_validate (void)
 Validates climatological variables.
 
void climate_openFile (void)
 Opens a climate file and reads in first set of values.
 
void climate_initState (void)
 Initializes climate state variables.
 
void climate_setState (DateTime theDate)
 Sets climate variables for current date.
 
DateTime climate_getNextEvapDate (void)
 Gets the next date when evaporation rate changes.
 
void rain_open (void)
 Opens binary rainfall interface file and RDII processor.
 
void rain_close (void)
 Closes rain interface file and RDII processor.
 
int snow_readMeltParams (char *tok[], int ntoks)
 Reads snowmelt parameters from a tokenized line of input data.
 
int snow_createSnowpack (int subcatchIndex, int snowIndex)
 Creates a snowpack object for a subcatchment.
 
void snow_validateSnowmelt (int snowIndex)
 Checks for valid values in a snowmelt parameter set.
 
void snow_initSnowpack (int subcatchIndex)
 Initializes state of a subcatchment's snowpack.
 
void snow_initSnowmelt (int snowIndex)
 Initializes values in a snowmelt parameter set.
 
void snow_getState (int i, int j, double x[])
 Retrieves the current state of a snowpack object.
 
void snow_setState (int subcatchIndex, int subAreaIndex, double x[])
 Sets the current state of a snowpack object.
 
void snow_setMeltCoeffs (int snowIndex, double season)
 Sets values of snowmelt coefficients for a particular time of year.
 
void snow_plowSnow (int subcatchIndex, double tStep)
 Adds new snow to subcatchment and plows it between sub-areas.
 
double snow_getSnowMelt (int subcatchIndex, double rainfall, double snowfall, double tStep, double netPrecip[])
 Modifies rainfall input to subcatchment's subareas based on possible snow melt and updates snow depth over entire subcatchment.
 
double snow_getSnowCover (int subcatchIndex)
 Computes volume of snow on a subcatchment.
 
int runoff_open (void)
 Opens the runoff analyzer.
 
void runoff_execute (void)
 Computes runoff for each subcatchment at the current runoff time.
 
void runoff_close (void)
 Closes the runoff analyzer.
 
int routing_open (void)
 Initializes the routing analyzer.
 
double routing_getRoutingStep (int routingModel, double fixedStep)
 Determines time step used for flow routing at current time period.
 
void routing_execute (int routingModel, double routingStep)
 Executes the routing process at the current time period.
 
void routing_close (int routingModel)
 Closes down the routing analyzer.
 
int output_open (void)
 Writes basic project data to binary output file.
 
void output_end (void)
 Writes closing records to binary file.
 
void output_close (void)
 Frees memory used for accessing the binary file.
 
void output_saveResults (double reportTime)
 Writes computed results for current report time to binary file.
 
void output_updateAvgResults (void)
 Updates average results for current time period.
 
void output_readDateTime (long period, DateTime *days)
 Retrieves the date/time for a specific reporting period from the binary output file.
 
void output_readSubcatchResults (long period, int index)
 Reads computed results for a subcatchment at a specific time period.
 
void output_readNodeResults (long period, int index)
 Reads computed results for a node at a specific time period.
 
void output_readLinkResults (long period, int index)
 Reads computed results for a link at a specific time period.
 
int gwater_readAquiferParams (int aquiferIndex, char *tok[], int ntoks)
 Reads aquifer parameter values from line of input data.
 
int gwater_readGroundwaterParams (char *tok[], int ntoks)
 Reads groundwater inflow parameters for a subcatchment from a line of input data.
 
int gwater_readFlowExpression (char *tok[], int ntoks)
 Reads mathematical expression for lateral or deep groundwater flow for a subcatchment from a line of input data.
 
void gwater_deleteFlowExpression (int subcatchIndex)
 Veletes a subcatchment's custom groundwater flow expressions.
 
void gwater_validateAquifer (int aquiferIndex)
 Validates groundwater aquifer properties.
 
void gwater_validate (int subcatchIndex)
 Validates groundwater parameters for a subcatchment.
 
void gwater_initState (int subcatchIndex)
 Initializes state of subcatchment's groundwater.
 
void gwater_getState (int subcatchIndex, double x[])
 Retrieves state of subcatchment's groundwater.
 
void gwater_setState (int subcatchIndex, double x[])
 Assigns values to a subcatchment's groundwater state.
 
void gwater_getGroundwater (int j, double evap, double infil, double tStep)
 Computes groundwater flow for a subcatchment.
 
double gwater_getVolume (int subcatchIndex)
 Finds volume of groundwater stored in upper & lower zones.
 
int rdii_readRdiiInflow (char *tok[], int ntoks)
 Reads properties of an RDII inflow from a line of input.
 
void rdii_deleteRdiiInflow (int nodeIndex)
 Deletes RDII inflow data for a node.
 
void rdii_initUnitHyd (int unitHydIndex)
 Initializes properties of a unit hydrograph group.
 
int rdii_readUnitHydParams (char *tok[], int ntoks)
 Reads parameters of an RDII unit hydrograph from a line of input.
 
void rdii_openRdii (void)
 Opens an exisiting RDII interface file or creates a new one.
 
void rdii_closeRdii (void)
 Closes the RDII interface file.
 
int rdii_getNumRdiiFlows (DateTime aDate)
 Finds number of RDII inflows at a specified date.
 
void rdii_getRdiiFlow (int index, int *nodeIndex, double *q)
 Finds index and current RDII inflow for an RDII node.
 
int landuse_readParams (int landuseIndex, char *tok[], int ntoks)
 Reads landuse parameters from a tokenized line of input.
 
int landuse_readPollutParams (int pollutIndex, char *tok[], int ntoks)
 Reads pollutant parameters from a tokenized line of input.
 
int landuse_readBuildupParams (char *tok[], int ntoks)
 Reads pollutant buildup parameters from a tokenized line of input.
 
int landuse_readWashoffParams (char *tok[], int ntoks)
 Reads pollutant washoff parameters from a tokenized line of input.
 
void landuse_getInitBuildup (TLandFactor *landFactor, double *initBuildup, double area, double curb)
 Determines the initial buildup of each pollutant on each land use for a given subcatchment.
 
double landuse_getBuildup (int landuseIndex, int pollutIndex, double area, double curb, double buildup, double tStep)
 Computes new pollutant buildup on a landuse after a time increment.
 
double landuse_getWashoffLoad (int i, int p, double area, TLandFactor landFactor[], double runoff, double vOutflow)
 Computes pollutant load generated by a land use over a time step.
 
double landuse_getAvgBmpEffic (int subcatchIndex, int pollutIndex)
 Finds the overall average BMP removal achieved for pollutant pollutIndex treated in subcatchment j.
 
double landuse_getCoPollutLoad (int p, double washoff[])
 Finds washoff mass added by a co-pollutant of a given pollutant.
 
void flowrout_init (int routingModel)
 Initializes flow routing system.
 
void flowrout_close (int routingModel)
 Closes down flow routing system.
 
double flowrout_getRoutingStep (int routingModel, double fixedStep)
 Finds variable time step for dynamic wave routing.
 
int flowrout_execute (int links[], int routingModel, double tStep)
 Routes flow through conveyance network over current time step.
 
void toposort_sortLinks (int sortedLinks[])
 Sorts links from upstream to downstream.
 
int kinwave_execute (int linkIndex, double *qinflow, double *qoutflow, double tStep)
 Finds outflow over time step tStep given flow entering a conduit using Kinematic Wave flow routing.
 
void dynwave_validate (void)
 Adjusts dynamic wave routing options.
 
void dynwave_init (void)
 Initializes dynamic wave routing method.
 
void dynwave_close (void)
 Frees memory allocated for dynamic wave routing method.
 
double dynwave_getRoutingStep (double fixedStep)
 Computes variable routing time step if applicable.
 
int dynwave_execute (double tStep)
 Routes flows through drainage network over current time step.
 
void dwflow_findConduitFlow (int linkIndex, int steps, double omega, double dt)
 Updates flow in conduit link by solving finite difference form of continuity and momentum equations.
 
void qualrout_init (void)
 Initializes water quality concentrations in all nodes and links.
 
void qualrout_execute (double tStep)
 Routes water quality constituents through the drainage network over the current time step.
 
int treatmnt_open (void)
 Allocates memory for computing pollutant removals by treatment.
 
void treatmnt_close (void)
 Frees memory used for computing pollutant removals by treatment.
 
int treatmnt_readExpression (char *tok[], int ntoks)
 Reads a treatment expression from a tokenized line of input.
 
void treatmnt_delete (int nodeIndex)
 Deletes the treatment objects for each pollutant at a node.
 
void treatmnt_treat (int j, double q, double v, double tStep)
 Updates pollutant concentrations at a node after treatment.
 
void treatmnt_setInflow (double qIn, double wIn[])
 Computes and saves array of inflow concentrations to a node.
 
int massbal_open (void)
 Opens and initializes mass balance continuity checking.
 
void massbal_close (void)
 Frees memory used by mass balance system.
 
void massbal_report (void)
 Reports mass balance results.
 
void massbal_updateRunoffTotals (int flowType, double v)
 Updates runoff totals after current time step.
 
void massbal_updateLoadingTotals (int type, int p, double w)
 Adds inflow mass loading to loading totals for current time step.
 
void massbal_updateGwaterTotals (double vInfil, double vUpperEvap, double vLowerEvap, double vLowerPerc, double vGwater)
 Updates groundwater totals after current time step.
 
void massbal_updateRoutingTotals (double tStep)
 Updates overall routing totals with totals from current time step.
 
void massbal_initTimeStepTotals (void)
 Initializes routing totals for current time step.
 
void massbal_addInflowFlow (int type, double q)
 Adds flow inflow to routing totals for current time step.
 
void massbal_addInflowQual (int type, int pollutIndex, double w)
 Adds quality inflow to routing totals for current time step.
 
void massbal_addOutflowFlow (double q, int isFlooded)
 Adds flow outflow over current time step to routing totals.
 
void massbal_addOutflowQual (int p, double w, int isFlooded)
 Adds pollutant outflow over current time step to routing totals.
 
void massbal_addNodeLosses (double evapLoss, double seepLoss)
 Adds node losses over current time step to routing totals.
 
void massbal_addLinkLosses (double evapLoss, double seepLoss)
 Adds link losses over current time step to routing totals.
 
void massbal_addReactedMass (int pollutIndex, double w)
 Adds mass reacted during current time step to routing totals.
 
void massbal_addSeepageLoss (int pollutIndex, double w)
 Adds mass lost to seepage during current time step to routing totals.
 
void massbal_addToFinalStorage (int pollutIndex, double w)
 Adds mass remaining on dry surface to routing totals.
 
double massbal_getStepFlowError (void)
 Computes flow routing mass balance error at current time step.
 
double massbal_getRunoffError (void)
 Computes runoff mass balance error.
 
double massbal_getFlowError (void)
 Computes flow routing mass balance error.
 
int stats_open (void)
 Opens the simulation statistics system.
 
void stats_close (void)
 Closes the simulation statistics system.
 
void stats_report (void)
 Reports simulation statistics.
 
void stats_updateCriticalTimeCount (int nodeIndex, int linkIndex)
 Updates count of times a node or link was time step-critical.
 
void stats_updateFlowStats (double tStep, DateTime aDate)
 Updates various flow routing statistics at current time period.
 
void stats_updateTimeStepStats (double tStep, int trialsCount, int steadyState)
 Updates flow routing time step statistics.
 
void stats_updateSubcatchStats (int subcatchIndex, double rainVol, double runonVol, double evapVol, double infilVol, double impervVol, double pervVol, double runoffVol, double runoff)
 Updates totals of runoff components for a specific subcatchment.
 
void stats_updateGwaterStats (int subcatchIndex, double infil, double evap, double latFlow, double deepFlow, double theta, double waterTable, double tStep)
 Updates groundwater statistics for a specific subcatchment.
 
void stats_updateMaxRunoff (void)
 Updates value of maximum system runoff rate.
 
void stats_updateMaxNodeDepth (int j, double depth)
 Updates a node's maximum depth recorded at reporting times.
 
void stats_updateConvergenceStats (int node, int converged)
 Updates convergence statistics node.
 
int gage_readParams (int gageIndex, char *tok[], int ntoks)
 Reads rain gage parameters from a line of input data.
 
void gage_validate (int gageIndex)
 Checks for valid rain gage parameters.
 
void gage_initState (int j)
 Initializes state of a rain gage.
 
void gage_setState (int j, DateTime t)
 Updates state of rain gage for specified date.
 
double gage_getPrecip (int gageIndex, double *rainfall, double *snowfall)
 Determines whether gage's recorded rainfall is rain or snow.
 
void gage_setReportRainfall (int gageIndex, DateTime reportDate)
 Sets the rainfall value reported at the current reporting time.
 
DateTime gage_getNextRainDate (int gageIndex, DateTime aDate)
 Finds the next date from specified date when rainfall occurs.
 
void gage_updatePastRain (int gageIndex, int tStep)
 Updates past MAXPASTRAIN hourly rain totals.
 
double gage_getPastRain (int j, int n)
 Retrieves rainfall total over some previous number of hours.
 
int subcatch_readParams (int subcatchIndex, char *tok[], int ntoks)
 Reads subcatchment parameters from a tokenized line of input data.
 
int subcatch_readSubareaParams (char *tok[], int ntoks)
 Rreads subcatchment's subarea parameters from a tokenized line of input data.
 
int subcatch_readLanduseParams (char *tok[], int ntoks)
 Reads assignment of landuses to subcatchment from a tokenized line of input data.
 
int subcatch_readInitBuildup (char *tok[], int ntoks)
 Reads initial pollutant buildup on subcatchment from tokenized line of input data.
 
void subcatch_validate (int subcatchIndex)
 Checks for valid subcatchment input parameters.
 
void subcatch_initState (int subcatchIndex)
 Initializes state of a subcatchment.
 
void subcatch_setOldState (int subcatchIndex)
 Replaces old state of subcatchment with new state.
 
double subcatch_getFracPerv (int j)
 Determines what fraction of subcatchment area, including any LID area, is pervious.
 
double subcatch_getEvapRate (int subcatchIndex)
 Returns the potential evaporation rate for a subcatchment.
 
double subcatch_getStorage (int subcatchIndex)
 Finds total volume of water stored on a subcatchment's surface and its LIDs at the current time.
 
double subcatch_getDepth (int j)
 Finds average depth of water over the non-LID portion of a subcatchment.
 
void subcatch_getRunon (int subcatchIndex)
 Routes runoff from a subcatchment to its outlet subcatchment or between its subareas.
 
void subcatch_addRunonFlow (int subcatchIndex, double flow)
 Updates the total runon flow (ft/s) seen by a subcatchment that receives runon flow from an upstream subcatchment.
 
double subcatch_getRunoff (int subcatchIndex, double tStep)
 Computes runoff & new storage depth for subcatchment.
 
double subcatch_getWtdOutflow (int subcatchIndex, double f)
 Computes weighted combination of old and new subcatchment runoff.
 
void subcatch_getResults (int subcatchIndex, double wt, float x[])
 Computes wtd. combination of old and new subcatchment results.
 
void surfqual_initState (int subcatchIndex)
 Initializes pollutant buildup, ponded mass, and washoff.
 
void surfqual_getWashoff (int subcatchIndex, double runoff, double tStep)
 Computes new runoff quality for a subcatchment.
 
void surfqual_getBuildup (int subcatchIndex, double tStep)
 Adds to pollutant buildup on subcatchment surface.
 
void surfqual_applyAPIBuildup (int subcatchIndex)
 Applies the buildup of a pollutant over a subcatchment for a given time step.
 
void surfqual_sweepBuildup (int subcatchIndex, DateTime aDate)
 Reduces pollutant buildup over a subcatchment if sweeping occurs.
 
double surfqual_getWtdWashoff (int j, int p, double f)
 Finds wtd. combination of old and new washoff for a pollutant.
 
int node_readParams (int nodeIndex, int type, int k, char *tok[], int ntoks)
 Reads node properties from a tokenized line of input.
 
void node_validate (int nodeIndex)
 Validates a node's properties.
 
void node_initState (int nodeIndex)
 Initializes a node's state variables at start of simulation.
 
void node_initFlows (int nodeIndex, double tStep)
 Initializes a node's inflow/outflow/overflow at start of time step.
 
void node_setOldHydState (int nodeIndex)
 Replaces a node's old hydraulic state values with new ones.
 
void node_setOldQualState (int nodeIndex)
 Replaces a node's old water quality state values with new ones.
 
void node_setOutletDepth (int j, double yNorm, double yCrit, double z)
 Sets water depth at a node that serves as an outlet point.
 
double node_getSurfArea (int j, double d)
 Computes surface area of water stored at a node from water depth.
 
double node_getDepth (int nodeIndex, double v)
 Computes a node's water depth from its volume.
 
double node_getVolume (int nodeIndex, double depth)
 Computes volume stored at a node from its water depth.
 
double node_getPondedArea (int nodeIndex, double depth)
 Computes surface area of water at a node based on depth.
 
double node_getOutflow (int nodeIndex, int linkIndex)
 Computes outflow from node available for inflow into a link.
 
double node_getLosses (int nodeIndex, double tStep)
 Computes the rates of evaporation and infiltration over a given time step for a node.
 
double node_getMaxOutflow (int nodeIndex, double q, double tStep)
 Limits outflow rate from a node with storage volume.
 
double node_getSystemOutflow (int j, int *isFlooded)
 Computes flow rate at outfalls and flooded nodes.
 
void node_getResults (int nodeIndex, double wt, float x[])
 Computes weighted average of old and new results at a node.
 
int inflow_readExtInflow (char *tok[], int ntoks)
 Reads parameters of a direct external inflow from a line of input.
 
int inflow_readDwfInflow (char *tok[], int ntoks)
 Reads dry weather inflow parameters from line of input data.
 
int inflow_readDwfPattern (char *tok[], int ntoks)
 Reads values of a time pattern from a line of input data.
 
int inflow_setExtInflow (int nodeIndex, int param, int type, int tseries, int basePat, double cf, double baseline, double sf)
 This function assigns property values to the inflow object.
 
void inflow_initDwfInflow (TDwfInflow *inflow)
 Initialzes a dry weather inflow by ordering its time patterns.
 
void inflow_initDwfPattern (int patternIndex)
 Initialzes a dry weather inflow time pattern.
 
double inflow_getExtInflow (TExtInflow *inflow, DateTime aDate)
 Retrieves the value of an external inflow at a specific date and time.
 
double inflow_getDwfInflow (TDwfInflow *inflow, int month, int day, int hour)
 Computes dry weather inflow value at a specific point in time.
 
void inflow_deleteExtInflows (int nodeIndex)
 Deletes all time series inflow data for a node.
 
void inflow_deleteDwfInflows (int nodeIndex)
 Deletes all dry weather inflow data for a node.
 
int iface_readFileParams (char *tok[], int ntoks)
 Reads interface file information from a line of input data. Data format is: USE/SAVE FileType FileName.
 
void iface_openRoutingFiles (void)
 Opens routing interface files.
 
void iface_closeRoutingFiles (void)
 Closes routing interface files.
 
int iface_getNumIfaceNodes (DateTime aDate)
 Reads inflow data from interface file at current date.
 
int iface_getIfaceNode (int index)
 Finds index of project node associated with interface node index.
 
double iface_getIfaceFlow (int index)
 Finds interface flow for particular node index.
 
double iface_getIfaceQual (int index, int pollut)
 Finds interface concentration for particular node index & pollutant.
 
void iface_saveOutletResults (DateTime reportDate, FILE *file)
 Saves system outflows to routing interface file.
 
int hotstart_open (void)
 Restore configured input state and initialize configured hotstart outputs.
 
void hotstart_save (void)
 Saves hotstart files whose specified save time has arrived.
 
int hotstart_save_to_file (const char *hotstartFile)
 Save the current runoff and routing state to a named version-4 hotstart file.
 
int hotstart_is_valid (const char *hotstartFile, int *inputFileVersion)
 Recognize a hotstart file's header and version.
 
void hotstart_close (void)
 Saves and closes hotstart files that are to be written at end of simulation.
 
int link_readParams (int link, int type, int subIndex, char *tok[], int ntoks)
 Reads parameters for a specific type of link from a tokenized line of input data.
 
int link_readXsectParams (char *tok[], int ntoks)
 Reads a link's cross section parameters from a tokenized line of input data. Formats: Link Shape Geom1 Geom2 Geom3 Geom4 (Barrels Culvert) Link IRREGULAR TransectID Link STREET StreetID.
 
int link_readLossParams (char *tok[], int ntoks)
 Reads local loss parameters for a link from a tokenized line of input data. Format: LinkID cInlet cOutlet cAvg FlapGate(YES/NO) SeepRate.
 
void link_validate (int link)
 Validates a link's properties.
 
void link_initState (int link)
 Initializes a link's state variables at start of simulation.
 
void link_setOldHydState (int link)
 Replaces link's old hydraulic state values with current ones.
 
void link_setOldQualState (int link)
 Replaces link's old water quality state values with current ones.
 
void link_setTargetSetting (int j)
 Updates a link's target setting.
 
void link_setSetting (int j, double tstep)
 Updates a link's setting as a result of a control action.
 
int link_setFlapGate (int link, int n1, int n2, double q)
 Based on the sign of the flow, determines if a flap gate associated with the link should close or not.
 
double link_getInflow (int link)
 Finds total flow entering a link during current time step.
 
void link_setOutfallDepth (int link)
 Sets depth at outfall node connected to link j.
 
double link_getLength (int link)
 Finds true length of a link.
 
double link_getYcrit (int link, double q)
 Computes critical depth for given flow rate.
 
double link_getYnorm (int link, double q)
 Computes normal depth for given flow rate.
 
double link_getVelocity (int link, double q, double y)
 Finds flow velocity given flow and depth.
 
double link_getFroude (int link, double v, double y)
 Computes Froude Number for given velocity and flow depth.
 
double link_getPower (int link)
 Computes power consumed by head loss (or head gain) of water flowing through a link.
 
double link_getLossRate (int link, int routeModel, double q, double tstep)
 Computes rate at which flow volume is lost in a link due to evaporation and seepage.
 
char link_getFullState (double a1, double a2, double aFull)
 Determines if a link is upstream, downstream or completely full.
 
void link_getResults (int link, double wt, float x[])
 Retrieves time-weighted average of old and new results for a link.
 
int xsect_isOpen (int type)
 Determines if a xsection type is open or closed.
 
int xsect_setParams (TXsect *xsect, int type, double p[], double ucf)
 Assigns parameters to a cross section's data structure.
 
void xsect_setIrregXsectParams (TXsect *xsect)
 Assigns transect parameters to an irregular shaped cross section.
 
void xsect_setCustomXsectParams (TXsect *xsect)
 Assigns parameters to a custom-shaped cross section.
 
void xsect_setStreetXsectParams (TXsect *xsect)
 Assigns transect parameters to a street cross section.
 
double xsect_getAmax (TXsect *xsect)
 Finds xsection area at maximum flow depth.
 
double xsect_getSofA (TXsect *xsect, double area)
 Computes xsection's section factor at a given area.
 
double xsect_getYofA (TXsect *xsect, double area)
 Computes xsection's depth at a given area.
 
double xsect_getRofA (TXsect *xsect, double area)
 Computes xsection's hydraulic radius at a given area.
 
double xsect_getAofS (TXsect *xsect, double sFactor)
 Computes xsection's area at a given section factor.
 
double xsect_getdSdA (TXsect *xsect, double area)
 Computes xsection's derivative of its section factor with respect to area at a given area.
 
double xsect_getAofY (TXsect *xsect, double y)
 Computes xsection's area at a given depth.
 
double xsect_getRofY (TXsect *xsect, double y)
 Computes xsection's hydraulic radius at a given depth.
 
double xsect_getWofY (TXsect *xsect, double y)
 Computes xsection's top width at a given depth.
 
double xsect_getYcrit (TXsect *xsect, double q)
 Computes critical depth at a specific flow rate.
 
double culvert_getInflow (int link, double q, double h)
 Uses FHWA HEC-5 equations to find flow through inlet controlled culverts.
 
double roadway_getInflow (int link, double dir, double hcrest, double h1, double h2)
 Compute signed roadway overtopping discharge and its head derivative.
 
double forcemain_getEquivN (int j, int k)
 Computes a Mannng's n that results in the same normal flow value for a force main flowing full under fully turbulent conditions using either the Hazen-Williams or Dary-Weisbach flow equations.
 
double forcemain_getRoughFactor (int j, double lengthFactor)
 Computes an adjustment factor for a force main that compensates for any artificial lengthening the pipe may have received.
 
double forcemain_getFricSlope (int j, double v, double hrad)
 Computes the headloss per unit length used in dynamic wave flow routing for a pressurized force main using either the Hazen-Williams or Darcy-Weisbach flow equations.
 
int transect_create (int n)
 Creates an array of cross-section transects.
 
void transect_delete (void)
 Deletes memory allocated for all transects.
 
int transect_readParams (int *count, char *tok[], int ntoks)
 Parse an NC, X1 or GR transect input record.
 
void transect_validate (int j)
 Validates transect data and creates its geometry tables.
 
void transect_createStreetTransect (TStreet *street)
 Construct hydraulic geometry tables from a one- or two-sided street section.
 
int street_create (int nStreets)
 Allocate zero-initialized street cross-section definitions.
 
void street_delete ()
 Deletes the collection of Street objects.
 
int street_readParams (char *tok[], int ntoks)
 Parse a street cross section and construct its hydraulic transect tables.
 
double street_getExtentFilled (int link)
 Inspect the high-end depth or area of a street conduit.
 
int shape_validate (TShape *shape, TTable *curve)
 Computes the entries in a custom x-section shape's geometry tables from its user-supplied width v. height curve.
 
void controls_init (void)
 Initializes the control rule system.
 
void controls_addToCount (char *s)
 Updates the number of named variables or math expressions used by control rules.
 
int controls_create (int n)
 Creates an array of control rules.
 
void controls_delete (void)
 Deletes all control rules.
 
int controls_addVariable (char *tok[], int nToks)
 Adds a named variable to the control rule system from a tokenized line of input with formats:
 
int controls_addExpression (char *tok[], int nToks)
 Adds a math expression to the control rule system from a a tokenized line of input with format: EXPRESSION name = math expression containing VARIABLE names
 
int controls_addRuleClause (int r, int keyword, char *tok[], int nToks)
 Adds a new clause to a control rule.
 
int controls_evaluate (DateTime currentTime, DateTime elapsedTime, double tStep)
 Evaluates all control rules at the current time of the simulation.
 
int table_readCurve (char *tok[], int ntoks)
 Reads a tokenized line of data for a curve table.
 
int table_readTimeseries (char *tok[], int ntoks)
 Reads a tokenized line of data for a time series table.
 
int table_addEntry (TTable *table, double x, double y)
 Adds a new x/y entry to a table.
 
int table_getFirstEntry (TTable *table, double *x, double *y)
 Retrieves the first x/y entry in a table.
 
int table_getNextEntry (TTable *table, double *x, double *y)
 Retrieves the next x/y entry in a table.
 
void table_deleteEntries (TTable *table)
 Deletes all x/y entries in a table.
 
void table_init (TTable *table)
 Initializes properties when table is first created.
 
int table_validate (TTable *table)
 Checks that table's x-values are in ascending order.
 
double table_lookup (TTable *table, double x)
 Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary.
 
double table_lookupEx (TTable *table, double x)
 Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary within the table and linear extrapolation outside of the table.
 
double table_intervalLookup (TTable *table, double x)
 Retrieves the y-value corresponding to the first table entry whose x-value is > x.
 
double table_inverseLookup (TTable *table, double y)
 Retrieves the x-value corresponding to an y-value in a table, using interploation if necessary.
 
double table_getSlope (TTable *table, double x)
 Retrieves the slope of the curve at the line segment containing x.
 
double table_getMaxY (TTable *table, double x)
 Finds the largest y value in the initial non-decreasing portion of a table that appear before value x.
 
double table_getStorageVolume (TTable *table, double x)
 Finds volume for a given depth in a Storage Curve table.
 
double table_getStorageDepth (TTable *table, double v)
 Finds depth for a given volume in a Storage Curve table.
 
void table_tseriesInit (TTable *table)
 Initializes the time bracket within a time series table.
 
double table_tseriesLookup (TTable *table, double t, char extend)
 Retrieves the y-value corresponding to a time series date, using interploation if necessary.
 
double UCF (int u)
 Computes a conversion factor from SWMM's internal units to user's units.
 
int getInt (char *s, int *y)
 Converts a string to an int value.
 
int getFloat (char *s, float *y)
 Converts a string to a float value.
 
int getDouble (char *s, double *y)
 Converts a string to a double precision floating point number.
 
char * getTempFileName (char *fname)
 Creates a temporary file name with path prepended to it.
 
int findmatch (char *s, char *keyword[])
 Finds match between string and array of keyword strings.
 
int match (char *str, char *substr)
 Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).
 
int strcomp (const char *s1, const char *s2)
 Compares two strings (case insensitive).
 
size_t sstrncpy (char *dest, const char *src, size_t n)
 Copies a string to a new memory location in a safe way.
 
size_t sstrcat (char *dest, const char *src, size_t destsize)
 Safe string concatenation.
 
void writecon (const char *s)
 Writes string to console.
 
void getElapsedTime (DateTime aDate, int *days, int *hrs, int *mins)
 Finds elapsed simulation time for a given calendar date.
 
DateTime getDateTime (double elapsedMsec)
 Finds calendar date/time value for elapsed milliseconds of simulation time.
 
char * addAbsolutePath (char *fname)
 Adds an absolute path name to a file name.
 

Detailed Description

Header file for global interfacing functions.

Author
L. Rossman
M. Tryby (EPA)
Date
Created: 2023-06-12
Last updated: 2025-01-02
Version
5.3.0

Update History

  • Build 5.1.007:
  • Build 5.1.008:
    • Function list was re-ordered and blank lines added for readability.
    • Pollutant buildup/washoff functions for the new surfqual.c module added.
    • Several other functions added, re-named or have modified arguments.
  • Build 5.1.010:
  • Build 5.1.013:
    • Additional arguments added to function stats_updateSubcatchStats.
  • Build 5.1.014:
    • Arguments to link_getLossRate function changed.
  • Build 5.2.0:
    • Support added for Streets and Inlets.
    • Support added for reporting most frequent non-converging links.
    • Support added for named variables & math expressions in control rules.
    • Support added for tracking a gage's prior n-hour rainfall total.
    • Refactored external inflow code.
  • Build 5.2.4:
    • Additional arguments added to function link_getLossRate.
  • Build 5.3.0:
    • Modified code to allow saving multiple hotstart files at different times.
    • Added support for API provided pollutant build up and washoff.
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com (OpenSWMM maintenance and extensions)
License
Apache-2.0 for OpenSWMM contributions; original EPA SWMM provenance is retained.

Function Documentation

◆ culvert_getInflow()

double culvert_getInflow ( int j,
double q0,
double h )

Uses FHWA HEC-5 equations to find flow through inlet controlled culverts.

Parameters
[in]jLink index.
[in]q0Unmodified flow rate (cfs).
[in]hUpstream head (ft).
Returns
Modified flow rate through culvert (cfs).
Here is the caller graph for this function:

◆ forcemain_getEquivN()

double forcemain_getEquivN ( int j,
int k )

Computes a Mannng's n that results in the same normal flow value for a force main flowing full under fully turbulent conditions using either the Hazen-Williams or Dary-Weisbach flow equations.

Parameters
[in]jLink index.
[in]kConduit index.
Returns
An equivalent Manning's n for a force main.

◆ forcemain_getFricSlope()

double forcemain_getFricSlope ( int j,
double v,
double hrad )

Computes the headloss per unit length used in dynamic wave flow routing for a pressurized force main using either the Hazen-Williams or Darcy-Weisbach flow equations.

Parameters
[in]jLink index.
[in]vFlow velocity (ft/sec).
[in]hradHydraulic radius (ft).
Returns
A force main pipe's friction slope.
Note
The pipe's roughness factor was saved in xsect.sBot in conduit_validate() in LINK.C.
Here is the caller graph for this function:

◆ forcemain_getRoughFactor()

double forcemain_getRoughFactor ( int j,
double lengthFactor )

Computes an adjustment factor for a force main that compensates for any artificial lengthening the pipe may have received.

Parameters
[in]jLink index.
[in]lengthFactorFactor by which a pipe will be artifically lengthened.
Returns
A roughness adjustment factor for a force main.

◆ hotstart_close()

void hotstart_close ( void )

Saves and closes hotstart files that are to be written at end of simulation.

◆ hotstart_is_valid()

int hotstart_is_valid ( const char * hotstartFile,
int * inputFileVersion )

Recognize a hotstart file's header and version.

Parameters
[in]hotstartFileNon-null borrowed null-terminated path; opened in r+b mode, so writable access is required even though only the header is read.
[out]inputFileVersionNon-null caller-owned slot set to 1, 2, 3 or 4 on a recognized header; unchanged on reported open/format failure.
Returns
Zero for a recognized header, ERR_HOTSTART_FILE_OPEN on opening failure, or ERR_HOTSTART_FILE_FORMAT for an unrecognized version-1 header.
Note
This does not validate record counts, payload completeness or I/O status of every header read. The local stream is closed before returning.

◆ hotstart_open()

int hotstart_open ( void )

Restore configured input state and initialize configured hotstart outputs.

Returns
TRUE if input restoration and all output opens succeed, FALSE after a reported input/output initialization failure.
Postcondition
Successful output streams remain open for the hotstart lifecycle. On a later failure, earlier successful output opens remain for cleanup; this routine does not roll back model state restored from the input.
Here is the call graph for this function:

◆ hotstart_save()

void hotstart_save ( void )

Saves hotstart files whose specified save time has arrived.

◆ hotstart_save_to_file()

int hotstart_save_to_file ( const char * hotstartFile)

Save the current runoff and routing state to a named version-4 hotstart file.

Parameters
[in]hotstartFileNon-null borrowed null-terminated filename; relative paths are resolved through addAbsolutePath().
Returns
Zero after opening and writing the snapshot, or the opening error code from initializeSaveHotstartFile(). Individual writes/close are not checked.
Note
Creates or truncates the destination, closes its local stream, and frees its temporary descriptor. Allocation failure is not checked here.
Here is the call graph for this function:

◆ link_getFroude()

double link_getFroude ( int j,
double v,
double y )

Computes Froude Number for given velocity and flow depth.

Parameters
[in]jLink index.
[in]vFlow velocity (fps).
[in]yFlow depth (ft).
Returns
Froude Number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_getFullState()

char link_getFullState ( double a1,
double a2,
double aFull )

Determines if a link is upstream, downstream or completely full.

Parameters
[in]a1Upstream link area (ft2).
[in]a2Downstream link area (ft2).
[in]aFullArea of full conduit.
Returns
Fullness state of a link.
Here is the caller graph for this function:

◆ link_getInflow()

double link_getInflow ( int j)

Finds total flow entering a link during current time step.

Parameters
[in]jLink index.
Returns
Link flow rate (cfs).
Here is the call graph for this function:

◆ link_getLength()

double link_getLength ( int j)

Finds true length of a link.

Parameters
[in]jLink index.
Returns
Length (ft).
Here is the caller graph for this function:

◆ link_getLossRate()

double link_getLossRate ( int j,
int routeModel,
double q,
double tstep )

Computes rate at which flow volume is lost in a link due to evaporation and seepage.

Parameters
[in]jLink index.
[in]routeModelFlow routing model type.
[in]qFlow rate (ft3/sec).
[in]tstepTime step (sec).
Returns
Uniform loss rate in link (ft3/sec).
Here is the caller graph for this function:

◆ link_getPower()

double link_getPower ( int j)

Computes power consumed by head loss (or head gain) of water flowing through a link.

Parameters
[in]jLink index.
Returns
Power consumed by link in kwatts.

◆ link_getResults()

void link_getResults ( int j,
double f,
float x[] )

Retrieves time-weighted average of old and new results for a link.

Parameters
[in]jLink index.
[in]fTime weighting factor.
[out]xArray of weighted results.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_getVelocity()

double link_getVelocity ( int j,
double flow,
double depth )

Finds flow velocity given flow and depth.

Parameters
[in]jLink index.
[in]flowLink flow rate (cfs).
[in]depthLink flow depth (ft).
Returns
Flow velocity (fps).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_getYcrit()

double link_getYcrit ( int j,
double q )

Computes critical depth for given flow rate.

Parameters
[in]jLink index.
[in]qLink flow rate (cfs).
Returns
Critical depth (ft).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_getYnorm()

double link_getYnorm ( int j,
double q )

Computes normal depth for given flow rate.

Parameters
[in]jLink index.
[in]qLink flow rate (cfs).
Returns
Normal depth (ft).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_initState()

void link_initState ( int j)

Initializes a link's state variables at start of simulation.

Parameters
[in]jLink index.
Here is the caller graph for this function:

◆ link_readLossParams()

int link_readLossParams ( char * tok[],
int ntoks )

Reads local loss parameters for a link from a tokenized line of input data. Format: LinkID cInlet cOutlet cAvg FlapGate(YES/NO) SeepRate.

Parameters
tokArray of string tokens.
[in]ntoksNumber of tokens.
Returns
An error code.
Here is the call graph for this function:

◆ link_readParams()

int link_readParams ( int j,
int type,
int k,
char * tok[],
int ntoks )

Reads parameters for a specific type of link from a tokenized line of input data.

Parameters
[in]jLink index.
[in]typeLink type code.
[in]kLink type index.
tokArray of string tokens.
[in]ntoksNumber of tokens.
Returns
An error code.

◆ link_readXsectParams()

int link_readXsectParams ( char * tok[],
int ntoks )

Reads a link's cross section parameters from a tokenized line of input data. Formats: Link Shape Geom1 Geom2 Geom3 Geom4 (Barrels Culvert) Link IRREGULAR TransectID Link STREET StreetID.

Parameters
tokArray of string tokens.
[in]ntoksNumber of tokens.
Returns
An error code.
Here is the call graph for this function:

◆ link_setFlapGate()

int link_setFlapGate ( int j,
int n1,
int n2,
double q )

Based on the sign of the flow, determines if a flap gate associated with the link should close or not.

Parameters
[in]jLink index.
[in]n1Index of node on upstream end of link.
[in]n2Index of node on downstream end of link.
[in]qSigned flow value (value and units don't matter).
Returns
TRUE if there is reverse flow through a flap gate associated with the link.
Here is the caller graph for this function:

◆ link_setOldHydState()

void link_setOldHydState ( int j)

Replaces link's old hydraulic state values with current ones.

Parameters
[in]jLink index.

◆ link_setOldQualState()

void link_setOldQualState ( int j)

Replaces link's old water quality state values with current ones.

Parameters
[in]jLink index.

◆ link_setOutfallDepth()

void link_setOutfallDepth ( int j)

Sets depth at outfall node connected to link j.

Parameters
[in]jLink index.
Here is the call graph for this function:

◆ link_setSetting()

void link_setSetting ( int j,
double tstep )

Updates a link's setting as a result of a control action.

Parameters
[in]jLink index.
[in]tstepTime step over which setting is adjusted.

◆ link_setTargetSetting()

void link_setTargetSetting ( int j)

Updates a link's target setting.

Parameters
[in]jLink index.

◆ link_validate()

void link_validate ( int j)

Validates a link's properties.

Parameters
[in]jLink index.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ roadway_getInflow()

double roadway_getInflow ( int j,
double dir,
double hRoad,
double h1,
double h2 )

Compute signed roadway overtopping discharge and its head derivative.

Parameters
[in]jValid link index; non-WEIR links return zero without state updates.
[in]dirFlow direction multiplier, normally +1 or -1.
[in]hRoadRoad crest elevation in feet.
[in]h1Higher/upstream hydraulic head in feet for the selected direction.
[in]h2Lower/downstream hydraulic head in feet.
Returns
Signed roadway discharge in cubic feet per second; zero without sufficient crest head. Uses HDS-5 coefficients when width/surface are available.
Postcondition
Updates Link.dqdh, newDepth and flowClass for a weir link.

◆ shape_validate()

int shape_validate ( TShape * shape,
TTable * curve )

Computes the entries in a custom x-section shape's geometry tables from its user-supplied width v. height curve.

Parameters
shapePointer to a custom x-section TShape object.
curvePointer to shape's table of width v. height.
Returns
TRUE if successful. FALSE if not.
Here is the caller graph for this function:

◆ street_create()

int street_create ( int nStreets)

Allocate zero-initialized street cross-section definitions.

Parameters
[in]nStreetsNonnegative requested street count.
Returns
Zero on success, ERR_MEMORY when calloc returns NULL.
Postcondition
Resets Street and Nobjects[STREET], then assigns the new array/count on success. The project owns the allocation and street_delete() releases it.
Precondition
Any earlier Street allocation has been released before this call.

◆ street_delete()

void street_delete ( )

Deletes the collection of Street objects.

◆ street_getExtentFilled()

double street_getExtentFilled ( int link)

Inspect the high-end depth or area of a street conduit.

Parameters
[in]linkValid street conduit link index.
Returns
Maximum endpoint node depth in feet for dynamic-wave routing, otherwise maximum conduit endpoint flow area in square feet. Returns zero when the cross-section transect index is negative.
Note
The result is a dimensional depth/area, not a normalized fullness ratio.

◆ street_readParams()

int street_readParams ( char * tok[],
int ntoks )

Parse a street cross section and construct its hydraulic transect tables.

Parameters
[in]tokBorrowed ntoks non-null token strings: ID, crown width, curb height, cross slope, road n, then optional gutter/backing parameters. Lengths are authored ft/m and slopes are percentages.
[in]ntoksNumber of tokens; at least five required, with complete backing slope/roughness data required when backing width is positive.
Returns
Zero on success or an input error code for missing, unknown or invalid numeric items; error_setInpError stores the diagnostic token.
Postcondition
Stores Street properties in feet and dimensionless slope fractions and calls transect_createStreetTransect(). ID may be set before a later error.
Here is the call graph for this function:

◆ table_addEntry()

int table_addEntry ( TTable * table,
double x,
double y )

Adds a new x/y entry to a table.

Parameters
tablePointer to a TTable structure.
[in]xX value.
[in]yY value.
Returns
TRUE if successful, FALSE if not.
Here is the caller graph for this function:

◆ table_deleteEntries()

void table_deleteEntries ( TTable * table)

Deletes all x/y entries in a table.

Parameters
tablePointer to a TTable structure.

◆ table_getFirstEntry()

int table_getFirstEntry ( TTable * table,
double * x,
double * y )

Retrieves the first x/y entry in a table.

Parameters
tablePointer to a TTable structure.
[out]xX-value of first table entry.
[out]yY-value of first table entry.
Returns
TRUE if successful, FALSE if not.
Note
Also moves the current position pointer (thisEntry) to the 1st entry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_getMaxY()

double table_getMaxY ( TTable * table,
double x )

Finds the largest y value in the initial non-decreasing portion of a table that appear before value x.

Parameters
tablePointer to a TTable structure.
[in]xAn x-value.
Returns
The maximum y-value for x-values below x.

◆ table_getNextEntry()

int table_getNextEntry ( TTable * table,
double * x,
double * y )

Retrieves the next x/y entry in a table.

Parameters
tablePointer to a TTable structure.
[out]xX-value of next table entry.
[out]yY-value of next table entry.
Returns
TRUE if successful, FALSE if not.
Note
Also updates the current position pointer (thisEntry).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_getSlope()

double table_getSlope ( TTable * table,
double x )

Retrieves the slope of the curve at the line segment containing x.

Parameters
tablePointer to a TTable structure.
[in]xAn x-value.
Returns
The slope of the curve at x.

◆ table_getStorageDepth()

double table_getStorageDepth ( TTable * table,
double v )

Finds depth for a given volume in a Storage Curve table.

Parameters
tablePointer to a TTable structure.
[in]vA storage volume.
Returns
A storage depth.

◆ table_getStorageVolume()

double table_getStorageVolume ( TTable * table,
double x )

Finds volume for a given depth in a Storage Curve table.

Parameters
tablePointer to a TTable structure.
[in]xA depth value.
Returns
A storage volume.
Here is the call graph for this function:

◆ table_init()

void table_init ( TTable * table)

Initializes properties when table is first created.

Parameters
tablePointer to a TTable structure.

◆ table_intervalLookup()

double table_intervalLookup ( TTable * table,
double x )

Retrieves the y-value corresponding to the first table entry whose x-value is > x.

Parameters
tablePointer to a TTable structure.
[in]xAn x-value.
Returns
A y-value.

◆ table_inverseLookup()

double table_inverseLookup ( TTable * table,
double y )

Retrieves the x-value corresponding to an y-value in a table, using interploation if necessary.

Parameters
tablePointer to a TTable structure.
[in]yA y-value.
Returns
An x-value.
Note
If y is below the first table entry, then the first x-value is returned; if y is above the last entry, then the last x-value is returned.
Here is the call graph for this function:

◆ table_lookup()

double table_lookup ( TTable * table,
double x )

Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary.

Parameters
tablePointer to a TTable structure.
[in]xAn x-value.
Returns
A y-value.
Note
If x is below the first table entry, then the first y-value is returned; if x is above the last entry, then the last y-value is returned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_lookupEx()

double table_lookupEx ( TTable * table,
double x )

Retrieves the y-value corresponding to an x-value in a table, using interploation if necessary within the table and linear extrapolation outside of the table.

Parameters
tablePointer to a TTable structure.
[in]xAn x-value.
Returns
A y-value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_readCurve()

int table_readCurve ( char * tok[],
int ntoks )

Reads a tokenized line of data for a curve table.

Parameters
tokArray of string tokens.
[in]ntoksNumber of tokens.
Returns
An error code.
Here is the call graph for this function:

◆ table_readTimeseries()

int table_readTimeseries ( char * tok[],
int ntoks )

Reads a tokenized line of data for a time series table.

Parameters
tokArray of string tokens.
[in]ntoksNumber of tokens.
Returns
An error code.
Here is the call graph for this function:

◆ table_tseriesInit()

void table_tseriesInit ( TTable * table)

Initializes the time bracket within a time series table.

Parameters
tablePointer to a TTable structure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_tseriesLookup()

double table_tseriesLookup ( TTable * table,
double x,
char extend )

Retrieves the y-value corresponding to a time series date, using interploation if necessary.

Parameters
tablePointer to a TTable structure.
[in]xA date/time value.
[in]extendTRUE if time series extended on either end.
Returns
A y-value.
Note
If extend is FALSE and date x is outside the range of the table then 0 is returned; if TRUE then the first or last value is returned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ table_validate()

int table_validate ( TTable * table)

Checks that table's x-values are in ascending order.

Parameters
tablePointer to a TTable structure.
Returns
Error code.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ transect_create()

int transect_create ( int n)

Creates an array of cross-section transects.

Parameters
[in]nNumber of transect objects to create.
Returns
An error code.

◆ transect_createStreetTransect()

void transect_createStreetTransect ( TStreet * street)

Construct hydraulic geometry tables from a one- or two-sided street section.

Parameters
[in,out]streetNon-null borrowed street with validated internal-feet geometry, dimensionless slopes and Manning coefficients. Its transect tables and transect roughness are overwritten.
Postcondition
Reuses shared Station/Elev/Nstations and roughness/bank positions, then calls createTables() over the computed elevation range.
Note
No allocation or geometry status is returned; caller retains the street.
Here is the caller graph for this function:

◆ transect_delete()

void transect_delete ( void )

Deletes memory allocated for all transects.

◆ transect_readParams()

int transect_readParams ( int * count,
char * tok[],
int ntoks )

Parse an NC, X1 or GR transect input record.

Parameters
[in,out]countNon-null next-transect index; X1 increments it before assigning new parameters. NC validates the previous transect.
[in]tokBorrowed ntoks token strings; tok[0] must exist and select a supported record keyword. NC provides Manning values, X1 metadata and scaling, GR elevation/station pairs in authored length units.
[in]ntoksAvailable token count, at least one; record-specific minimums and pair completeness are checked.
Returns
Zero on success or an input/geometry error code. Global transect state or count may already have changed before an error return.
Note
The active transect and station arrays are module-level state; record order must follow the normal HEC-2-style input sequence.
Here is the call graph for this function:

◆ transect_validate()

void transect_validate ( int j)

Validates transect data and creates its geometry tables.

Parameters
[in]jTransect index.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xsect_getAmax()

double xsect_getAmax ( TXsect * xsect)

Finds xsection area at maximum flow depth.

Parameters
xsectPtr. to a cross section data structure.
Returns
Area (ft2).

◆ xsect_getAofS()

double xsect_getAofS ( TXsect * xsect,
double s )

Computes xsection's area at a given section factor.

Parameters
xsectPtr. to a cross section data structure.
[in]sSection factor (ft^(8/3)).
Returns
Area (ft2).
Here is the caller graph for this function:

◆ xsect_getAofY()

double xsect_getAofY ( TXsect * xsect,
double y )

Computes xsection's area at a given depth.

Parameters
xsectPtr. to a cross section data structure.
[in]yDepth (ft).
Returns
Area (ft2).
Here is the caller graph for this function:

◆ xsect_getdSdA()

double xsect_getdSdA ( TXsect * xsect,
double a )

Computes xsection's derivative of its section factor with respect to area at a given area.

Parameters
xsectPtr. to a cross section data structure.
[in]aArea (ft2).
Returns
Derivative of section factor w.r.t. area (ft^2/3).

◆ xsect_getRofA()

double xsect_getRofA ( TXsect * xsect,
double a )

Computes xsection's hydraulic radius at a given area.

Parameters
xsectPtr. to a cross section data structure.
[in]aArea (ft2).
Returns
Hydraulic radius (ft).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xsect_getRofY()

double xsect_getRofY ( TXsect * xsect,
double y )

Computes xsection's hydraulic radius at a given depth.

Parameters
xsectPtr. to a cross section data structure.
[in]yDepth (ft).
Returns
Hydraulic radius (ft).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xsect_getSofA()

double xsect_getSofA ( TXsect * xsect,
double a )

Computes xsection's section factor at a given area.

Parameters
xsectPtr. to a cross section data structure.
[in]aArea (ft2).
Returns
Section factor (ft^(8/3)).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xsect_getWofY()

double xsect_getWofY ( TXsect * xsect,
double y )

Computes xsection's top width at a given depth.

Parameters
xsectPtr. to a cross section data structure.
[in]yDepth ft).
Returns
Top width (ft).
Here is the caller graph for this function:

◆ xsect_getYcrit()

double xsect_getYcrit ( TXsect * xsect,
double q )

Computes critical depth at a specific flow rate.

Parameters
xsectPtr. to a cross section data structure.
[in]qFlow rate (cfs).
Returns
Critical depth (ft).
Here is the caller graph for this function:

◆ xsect_getYofA()

double xsect_getYofA ( TXsect * xsect,
double a )

Computes xsection's depth at a given area.

Parameters
xsectPtr. to a cross section data structure.
[in]aArea (ft2).
Returns
Depth (ft).
Here is the caller graph for this function:

◆ xsect_isOpen()

int xsect_isOpen ( int type)

Determines if a xsection type is open or closed.

Parameters
[in]typeType of xsection shape.
Returns
1 if xsection is open, 0 if not.
Here is the caller graph for this function:

◆ xsect_setCustomXsectParams()

void xsect_setCustomXsectParams ( TXsect * xsect)

Assigns parameters to a custom-shaped cross section.

Parameters
xsectPtr. to a cross section data structure.

◆ xsect_setIrregXsectParams()

void xsect_setIrregXsectParams ( TXsect * xsect)

Assigns transect parameters to an irregular shaped cross section.

Parameters
xsectPtr. to a cross section data structure.

◆ xsect_setParams()

int xsect_setParams ( TXsect * xsect,
int type,
double p[],
double ucf )

Assigns parameters to a cross section's data structure.

Parameters
xsectPtr. to a cross section data structure.
[in]typeXsection shape type.
pVector of xsection parameters.
[in]ucfUnits correction factor.
Returns
TRUE if successful, FALSE if not.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xsect_setStreetXsectParams()

void xsect_setStreetXsectParams ( TXsect * xsect)

Assigns transect parameters to a street cross section.

Parameters
xsectPtr. to a cross section data structure.