Skip to content

Commit

Permalink
Merge in USEPA-SWMM5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
karosc committed Mar 19, 2023
1 parent c2c0f4f commit e826472
Show file tree
Hide file tree
Showing 95 changed files with 7,756 additions and 3,510 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

.DS_Store

# Eclipse Stuff
.metadata/
.settings/
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif()


project(swmm-solver
VERSION 5.1.15
VERSION 5.2.0
LANGUAGES C CXX
)

Expand All @@ -48,6 +48,7 @@ set(CONFIG_DIST "cmake")
# Define build options
option(BUILD_TESTS "Build component tests (requires Boost)" OFF)
option(BUILD_DOCS "Build toolkit docs (requires Doxygen)" OFF)
option(BUILD_DEF "Builds library with def file interface" OFF)

# Added option to statically link libraries to address GitHub Ubuntu 20.04 symbol errors (issue #340)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
Expand Down
4 changes: 0 additions & 4 deletions extern/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# Author: Michael E. Tryby
# US EPA - ORD/CESER
#
# Usage:
# Create environment variable with the following pattern -- "BOOST_ROOT_X_XX_X"
# where Xs are the Boost version -- pointing to install location.
#


if(WIN32)
Expand Down
5 changes: 3 additions & 2 deletions src/outfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ install(
swmm-output-config.cmake
)


install(FILES ${SWMM_OUT_PUBLIC_HEADERS}
install(
FILES
${SWMM_OUT_PUBLIC_HEADERS}
DESTINATION
"${INCLUDE_DIST}"
)
Expand Down
2 changes: 2 additions & 0 deletions src/outfile/errormanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef ERRORMANAGER_H_
#define ERRORMANAGER_H_


#define ERR_MAXMSG 256

typedef struct error_s {
Expand All @@ -24,4 +25,5 @@ int set_error(error_handle_t* error_handle, int errorcode);
char* check_error(error_handle_t* error_handle);
void clear_error(error_handle_t* error_handle);


#endif /* ERRORMANAGER_H_ */
2 changes: 2 additions & 0 deletions src/outfile/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef SRC_MESSAGES_H_
#define SRC_MESSAGES_H_


#define MAXMSG 56

/*------------------- Error Messages --------------------*/
Expand All @@ -28,4 +29,5 @@

#define ERR440 "ERROR 440: an unspecified error has occurred"


#endif /* SRC_MESSAGES_H_ */
42 changes: 24 additions & 18 deletions src/run/main.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/*
* main.c - Main stub for the command line version of EPA SWMM 5.1
*
* Created on: October 9, 2020
* Updated on:
*
* Author: See CONTRIBUTORS
*/
//-----------------------------------------------------------------------------
// main.c
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 03/24/2021
// Author: L. Rossman

// Main stub for the command line version of EPA SWMM 5.2
// to be run with swmm5.dll.

#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include "swmm5.h"

// Private project includes
// OWA Addition #################################################################
#include <math.h>
#include "timer.h"

// Public project includes
#include "swmm5.h"
#include "toolkit.h"


Expand Down Expand Up @@ -74,20 +73,25 @@ void progress_bar(double *ratio)
pct, format_time(tmp, t_r));
write_console(msg);
}

// ##############################################################################

int main(int argc, char *argv[])
//
// Input: argc = number of command line arguments
// argv = array of command line arguments
// Output: returns error status
// Purpose: runs the command line version of EPA SWMM 5.1.
// Purpose: runs the command line version of EPA SWMM 5.2.
//
// Command line is: swmm5 f1 f2 f3
// Command line is: runswmm f1 f2 f3
// where f1 = name of input file, f2 = name of report file, and
// f3 = name of binary output file if saved (or blank if not saved).
//
{

// OWA Edit #####################################################################
// OWA runs adds a progress bar to the SWMM executable, so this main funciton is
// slightly diffent than EPA's

if (argc == 4) {
char *inputFile = argv[1];
char *reportFile = argv[2];
Expand Down Expand Up @@ -140,4 +144,6 @@ int main(int argc, char *argv[])
}

return 0;

// ##############################################################################
}
14 changes: 9 additions & 5 deletions src/solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CMakeLists.txt - CMake configuration file for swmm-solver/library
#
# Created: Jul 11, 2019
# Updated: May 19, 2021
# Updated: Dec 1, 2021
#
# Author: Michael E. Tryby
# US EPA ORD/CESER
Expand Down Expand Up @@ -31,7 +31,6 @@ file(GLOB
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.h
)


if(BUILD_DEF)
# Builds library with def file interface for backward compatibility
set_source_files_properties(${PROJECT_SOURCE_DIR}/bindings/swmm5.def
Expand All @@ -40,7 +39,7 @@ if(BUILD_DEF)

add_library(swmm5
${SWMM_SOURCES}
${PROJECT_SOURCE_DIR/bindings/swmm5.def}
${PROJECT_SOURCE_DIR}/bindings/swmm5.def
$<TARGET_OBJECTS:shared_objs>
)

Expand Down Expand Up @@ -126,9 +125,14 @@ install(
"${CONFIG_DIST}"
FILE
swmm5-config.cmake
)
)

install(FILES ${SWMM_PUBLIC_HEADERS} DESTINATION "${INCLUDE_DIST}")
install(
FILES
${SWMM_PUBLIC_HEADERS}
DESTINATION
"${INCLUDE_DIST}"
)


# copy swmm5 to build tree for testing
Expand Down
30 changes: 17 additions & 13 deletions src/solver/Roadmap.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
A Roadmap to the SWMM 5 Engine Source Code
==========================================

The SWMM 5 computational engine consists of 49 C-code files plus several
header files. The engine can be compiled either as a Dynamic Link Library
(DLL) under Windows or as a stand-alone console application under both
Windows and Linux, depending on which of the #define DLL and #define CLE
declarations at the top of swmm5.c is commented out.
The SWMM 5 computational engine consists of 55 C-code files plus 22
header files. The engine should be compiled into a Dynamic Link Library
(DLL) under Windows or to a shared object library under Linux or MacOS.
A main.c file is also provided to build an executable that uses the engine
library to run a complete SWMM simulation from the command line.

The following header files contain definitions that are used throughout the
code and should be consulted if the meaning of a variable, a data structure,
Expand All @@ -31,8 +31,8 @@ funcs.h contains prototypes of functions that can be called from any

The following modules form the main core of the SWMM 5 engine:

swmm5.c contains functions that provide supervisory control over the
program.
swmm5.c contains a small API with functions that provide supervisory
control over the program.

project.c contains functions that create and destroy all project data,
establish default values, and look up objects by ID name.
Expand All @@ -48,8 +48,7 @@ routing.c routes runoff and external inflows through the project's
massbal.c performs mass balance calculations for runoff and routing.

stats.c collects summary statistics on flow rates, water depths,
solution iterations, and variable time steps for a
simulation.
solution iterations, and variable time steps for a simulation.

statsrpt.c writes summary simulation results to a status report.

Expand All @@ -58,7 +57,7 @@ output.c writes/reads runoff and routing results to/from a binary

report.c prepares a status report of simulation results and, for the
command line version of SWMM 5, reports complete results for
selected subcatchments, nodes, and links.
selected subcatchments, nodes, and links.

inputrpt.c writes a summary of a project's input data to the status report.

Expand Down Expand Up @@ -103,11 +102,14 @@ flowrout.c implements top-level control of flow routing through a project's

inflow.c provides direct time series inflows and recurring dry weather
inflows to the drainage system's nodes at each step of the
simulation.
simulation.

rdii.c computes rainfall dependent infiltration/inflow at selected nodes
of the drainage network.

inlet.c computes flow captured by street inlet drains that is diverted to
sewer nodes using methods from the FHWA HEC-22 manual.

kinwave.c performs kinematic wave flow routing calculations at each time
step of the simulation.

Expand All @@ -125,7 +127,7 @@ qualrout.c performs routing of water quality constituents through the

treatmnt.c computes pollutant removal at specific nodes of the drainage
system where user-defined treatment functions have been
assigned.
assigned.

node.c contains functions used to compute the properties and behavior
of the drainage system's nodes which include junctions, flow
Expand Down Expand Up @@ -164,7 +166,7 @@ keywords.c defines lists of keywords that appear as part of a SWMM 5
input file.

mathexpr.c functions that parse and evaluate user-supplied mathematical
expressions for pollutant removal at treatment nodes.
expressions.

mempool.c functions that provide a memory pool used to store object
ID names.
Expand All @@ -175,6 +177,8 @@ odesolve.c implementation of a fifth-order Runge-Kutta ordinary
shape.c functions that compute the geometric cross-section properties
of closed conduits with user-defined shapes.

street.c reads the geometric properties of a street cross section.

table.c functions used for accessing lookup tables that contain
SWMM 5's curve data and time series data.

Expand Down
9 changes: 9 additions & 0 deletions src/solver/bindings/swmm5.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ LIBRARY SWMM5.DLL

EXPORTS
swmm_close = _swmm_close@0
swmm_decodeDate = _swmm_decodeDate@36
swmm_end = _swmm_end@0
swmm_getCount = _swmm_getCount@4
swmm_getError = _swmm_getError@8
swmm_getIndex = _swmm_getIndex@8
swmm_getMassBalErr = _swmm_getMassBalErr@12
swmm_getName = _swmm_getName@16
swmm_getSavedValue = _swmm_getSavedValue@12
swmm_getValue = _swmm_getValue@8
swmm_getVersion = _swmm_getVersion@0
swmm_getWarnings = _swmm_getWarnings@0
swmm_open = _swmm_open@12
swmm_report = _swmm_report@0
swmm_run = _swmm_run@12
swmm_setValue = _swmm_setValue@16
swmm_start = _swmm_start@4
swmm_step = _swmm_step@4
swmm_stride = _swmm_stride@8
swmm_writeLine = _swmm_writeLine@4
Loading

0 comments on commit e826472

Please sign in to comment.