Code cleanup

1. Added a standard header to each code module and removed obsolete comments.
2. Re-named several of the sub-structs in the project struct and re-arranged some of their contents.
3. Re-named _defaultModel to _defaultProject.
4. Removed the need to call EN_createproject and EN_deleteproject when working with the default project.
5. Made X & Y coords. part of Snode properties instead of a separate struct.
6. Moved the non-API functions in epanet.c into a new module named project.c.
7. Re-factored the quality module so that it uses the same nodal adjacency lists as the hydraulics solver.
8. Re-factored the sparse matrix module (smatrix.c) to be more memory efficient.
9. Restricted line lengths to < 90 columns.
10. Grouped the placement of functions in EPANET2.H and EPANET.C by category.
This commit is contained in:
Lew Rossman
2018-11-27 14:22:06 -05:00
parent 2988800448
commit 9a540cc0f4
29 changed files with 15140 additions and 15461 deletions

View File

@@ -1,22 +1,21 @@
/*
****************************************************
String Constants for EPANET Program
VERSION: 2.00
DATE: 5/8/00
10/25/00
8/15/07 (2.00.11)
2/14/08 (2.00.12)
AUTHOR: L. Rossman
US EPA - NRMRL
****************************************************
******************************************************************************
Project: OWA EPANET
Version: 2.2
Module: text.h
Description: string constants used throughout EPANET
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 11/27/2018
******************************************************************************
*/
/* ------------ Keyword Dictionary ---------- */
#ifndef TEXT_H
#define TEXT_H
//------- Keyword Dictionary ------------------------------
#define w_USE "USE"
#define w_SAVE "SAVE"
@@ -194,7 +193,8 @@ AUTHOR: L. Rossman
#define w_ELSE "ELSE"
#define w_PRIORITY "PRIO"
/* ---------Input Section Names ---------- */
// ------ Input File Section Names ------------------------
#define s_TITLE "[TITLE]"
#define s_JUNCTIONS "[JUNCTIONS]"
#define s_RESERVOIRS "[RESERVOIRS]"
@@ -225,8 +225,8 @@ AUTHOR: L. Rossman
#define s_TAGS "[TAGS]"
#define s_END "[END]"
/* ---------------- Units ---------------- */
/*** Limit units to MAXID or less characters ***/
//------- Units -------------------------------------------
#define u_CFS "cfs"
#define u_GPM "gpm"
#define u_AFD "a-f/d"
@@ -257,13 +257,15 @@ AUTHOR: L. Rossman
#define u_per1000FT "/1000ft"
#define u_HP "hp"
/* -------------- Curve Types ----------------- */
//------- Curve Types -------------------------------------
#define c_HEADLOSS "HEADLOSS"
#define c_PUMP "PUMP"
#define c_EFFIC "EFFIC"
#define c_VOLUME "VOLUME"
/* ------------------ Text Phrases ------------------- */
//------- Text Phrases ------------------------------------
#define t_ABOVE "above"
#define t_BELOW "below"
#define t_HW "Hazen-Williams"
@@ -334,7 +336,8 @@ AUTHOR: L. Rossman
#define t_ORIFICE "Orifice Flow"
/* ------------------ Format Messages ------------------*/
//----- Summary Report Format Strings ---------------------
#define LOGO1 \
"******************************************************************"
#define LOGO2 \
@@ -399,10 +402,9 @@ AUTHOR: L. Rossman
#define FMT47 " with %s below %-.2f %s"
#define FMT48 " with %s above %-.2f %s"
/* ---------- Status Report Format Strings ------------ */
#define FMT49 "Hydraulic Status:"
//----- Status Report Format Strings ----------------------
/*** Updated 6/24/02 ***/
#define FMT49 "Hydraulic Status:"
#define FMT50 "%10s: Tank %s is %s at %-.2f %s"
#define FMT51 "%10s: Reservoir %s is %s"
#define FMT52 "%10s: %s %s %s"
@@ -422,13 +424,12 @@ AUTHOR: L. Rossman
#define FMT63 "%10s: %s %s changed by rule %s"
#define FMT64 "%10s: Balancing the network:\n"
#define FMT65 " Trial %2d: relative flow change = %-.6f"
/*** End of update ***/
#define FMT66 " maximum flow change = %.4f for Link %s"
#define FMT67 " maximum flow change = %.4f for Node %s"
#define FMT68 " maximum head error = %.4f for Link %s\n"
/* -------------------- Energy Report Table ------------------- */
//----- Energy Report Table -------------------------------
#define FMT71 "Energy Usage:"
#define FMT72 \
" Usage Avg. Kw-hr Avg. Peak Cost"
@@ -437,18 +438,21 @@ AUTHOR: L. Rossman
#define FMT74 "%38s Demand Charge: %9.2f"
#define FMT75 "%38s Total Cost: %9.2f"
/* -------------------- Node Report Table --------------------- */
//----- Node Report Table ---------------------------------
#define FMT76 "%s Node Results:"
#define FMT77 "Node Results:"
#define FMT78 "Node Results at %s hrs:"
/* -------------------- Link Report Table --------------------- */
//----- Link Report Table ---------------------------------
#define FMT79 "%s Link Results:"
#define FMT80 "Link Results:"
#define FMT81 "Link Results at %s hrs:"
#define FMT82 "\n\f\n Page %-d %60.60s\n"
/* ------------------- Progress Messages ---------------------- */
//----- Progress Messages ---------------------------------
#define FMT100 " Retrieving network data ... "
#define FMT101 " Computing hydraulics at hour %-10s "
#define FMT102 " Computing water quality at hour %-10s "
@@ -457,16 +461,17 @@ AUTHOR: L. Rossman
#define FMT104 "Analysis begun %s"
#define FMT105 "Analysis ended %s"
/*------------------- Error Messages --------------------*/
//----- Rule Error Messages -------------------------------
#define R_ERR201 "Input Error 201: syntax error in following line of "
#define R_ERR202 "Input Error 202: illegal numeric value in following line of "
#define R_ERR203 "Input Error 203: undefined node in following line of "
#define R_ERR204 "Input Error 204: undefined link in following line of "
#define R_ERR207 "Input Error 207: attempt to control a CV in following line of "
#define R_ERR221 "Input Error 221: mis-placed clause in following line of "
/*-------------------- Specific Warning Messages -------------------------*/
//----- Specific Warning Messages -------------------------
#define WARN01 "WARNING: System unbalanced at %s hrs."
#define WARN02 \
"WARNING: Maximum trials exceeded at %s hrs. System may be unstable."
@@ -477,7 +482,8 @@ AUTHOR: L. Rossman
#define WARN05 "WARNING: %s %s %s at %s hrs."
#define WARN06 "WARNING: Negative pressures at %s hrs."
/*-------------------- General Warning Messages -------------------------*/
//----- General Warning Messages --------------------------
#define WARN1 "WARNING: System hydraulically unbalanced."
#define WARN2 "WARNING: System may be hydraulically unstable."
#define WARN3 "WARNING: System disconnected."