openswmm 5.3.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openswmm/CMakeLists.txt +31 -0
- openswmm/__init__.py +42 -0
- openswmm/_openswmm.pyx +12 -0
- openswmm/data/__init__.py +0 -0
- openswmm/gym/__init__.py +0 -0
- openswmm/openswmm.pxd +10 -0
- openswmm/output/CMakeLists.txt +45 -0
- openswmm/output/__init__.pxd +1 -0
- openswmm/output/__init__.py +13 -0
- openswmm/output/_output.pyi +732 -0
- openswmm/output/_output.pyx +1557 -0
- openswmm/output/output.pxd +368 -0
- openswmm/solver/CMakeLists.txt +50 -0
- openswmm/solver/__init__.pxd +1 -0
- openswmm/solver/__init__.py +22 -0
- openswmm/solver/_solver.pyi +1012 -0
- openswmm/solver/_solver.pyx +1646 -0
- openswmm/solver/solver.pxd +356 -0
- openswmm-5.3.0.dev0.dist-info/METADATA +228 -0
- openswmm-5.3.0.dev0.dist-info/RECORD +36 -0
- openswmm-5.3.0.dev0.dist-info/WHEEL +5 -0
- openswmm-5.3.0.dev0.dist-info/licenses/LICENSE +12 -0
- openswmm-5.3.0.dev0.dist-info/top_level.txt +2 -0
- tests/.DS_Store +0 -0
- tests/__init__.py +3 -0
- tests/data/.DS_Store +0 -0
- tests/data/__init__.py +3 -0
- tests/data/output/__init__.py +22 -0
- tests/data/output/example_output_1.out +0 -0
- tests/data/output/json_time_series.pickle +0 -0
- tests/data/solver/__init__.py +17 -0
- tests/data/solver/non_existent_input_file.rpt +2387 -0
- tests/data/solver/site_drainage_example.inp +499 -0
- tests/data/solver/site_drainage_example.rpt +354 -0
- tests/test_swmm_solver.py +716 -0
- tests/test_swwm_output.py +1048 -0
openswmm/CMakeLists.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Description: CMake configuration for openswmmcore python library
|
|
2
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
3
|
+
# Created on: 2024-11-19
|
|
4
|
+
|
|
5
|
+
# Add Cython targets for openswmmcore
|
|
6
|
+
add_cython_target(_openswmm _openswmm.pyx CXX PY3)
|
|
7
|
+
|
|
8
|
+
# Create Python extension modules
|
|
9
|
+
add_library(_openswmm MODULE ${_openswmm})
|
|
10
|
+
|
|
11
|
+
set_target_properties(_openswmm
|
|
12
|
+
PROPERTIES
|
|
13
|
+
VERSION ${LIBRARY_VERSION}
|
|
14
|
+
SOVERSION ${LIBRARY_SOVERSION}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
python_extension_module(_openswmm)
|
|
18
|
+
|
|
19
|
+
# Install the openswmmcore module
|
|
20
|
+
install(TARGETS _openswmm LIBRARY DESTINATION openswmm)
|
|
21
|
+
|
|
22
|
+
# Include the current source directory
|
|
23
|
+
target_include_directories(
|
|
24
|
+
_openswmm
|
|
25
|
+
PUBLIC
|
|
26
|
+
${CMAKE_CURRENT_SOURCE_DIR}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add subdirectories
|
|
30
|
+
add_subdirectory(solver)
|
|
31
|
+
add_subdirectory(output)
|
openswmm/__init__.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
openswmm Python API
|
|
3
|
+
|
|
4
|
+
This module provides a Python interface to the openswmm library.
|
|
5
|
+
"""
|
|
6
|
+
import os
|
|
7
|
+
import platform
|
|
8
|
+
import sys
|
|
9
|
+
import importlib.metadata
|
|
10
|
+
|
|
11
|
+
# Platform-specific DLL/library path configuration
|
|
12
|
+
if platform.system() == "Windows":
|
|
13
|
+
lib_dir = os.path.join(sys.prefix, "bin")
|
|
14
|
+
if hasattr(os, "add_dll_directory"):
|
|
15
|
+
conda_exists = os.path.exists(os.path.join(sys.prefix, "conda-meta"))
|
|
16
|
+
if conda_exists:
|
|
17
|
+
os.environ["CONDA_DLL_SEARCH_MODIFICATION_ENABLE"] = "1"
|
|
18
|
+
os.add_dll_directory(lib_dir)
|
|
19
|
+
else:
|
|
20
|
+
os.environ["PATH"] = lib_dir + ";" + os.environ["PATH"]
|
|
21
|
+
|
|
22
|
+
elif platform.system() == "Linux":
|
|
23
|
+
lib_dir = os.path.join(sys.prefix, "lib")
|
|
24
|
+
sys.path.append(lib_dir)
|
|
25
|
+
os.environ["LD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("LD_LIBRARY_PATH", "")
|
|
26
|
+
|
|
27
|
+
elif platform.system() == "Darwin": # macOS
|
|
28
|
+
lib_dir = os.path.join(sys.prefix, "lib")
|
|
29
|
+
sys.path.append(lib_dir)
|
|
30
|
+
os.environ["DYLD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("DYLD_LIBRARY_PATH", "")
|
|
31
|
+
|
|
32
|
+
lib_dir = os.path.join(sys.prefix, "bin")
|
|
33
|
+
os.environ["DYLD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("DYLD_LIBRARY_PATH", "")
|
|
34
|
+
|
|
35
|
+
# Get version from package metadata
|
|
36
|
+
__version__ = importlib.metadata.version('openswmm')
|
|
37
|
+
|
|
38
|
+
# Import submodules
|
|
39
|
+
from openswmm.solver import *
|
|
40
|
+
from openswmm.output import *
|
|
41
|
+
|
|
42
|
+
__all__ = ['__version__']
|
openswmm/_openswmm.pyx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# cython: language_level=3str
|
|
2
|
+
# Description: Cython module for encoding and decoding SWMM datetimes
|
|
3
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
4
|
+
# Created on: 2024-11-19
|
|
5
|
+
|
|
6
|
+
# python imports
|
|
7
|
+
|
|
8
|
+
# third-party imports
|
|
9
|
+
|
|
10
|
+
# project imports
|
|
11
|
+
from openswmm cimport openswmm
|
|
12
|
+
|
|
File without changes
|
openswmm/gym/__init__.py
ADDED
|
File without changes
|
openswmm/openswmm.pxd
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# CMake configuration for openswmmcore python library
|
|
2
|
+
#
|
|
3
|
+
# Created by: Caleb Buahin (EPA/ORD/CESER/WID)
|
|
4
|
+
# Created on: 2024-11-19
|
|
5
|
+
|
|
6
|
+
add_cython_target(_output _output.pyx LANGUAGE CXX PY3)
|
|
7
|
+
|
|
8
|
+
# Add Cython target
|
|
9
|
+
add_library(_output MODULE ${_output})
|
|
10
|
+
|
|
11
|
+
# Add library
|
|
12
|
+
target_link_libraries(
|
|
13
|
+
_output
|
|
14
|
+
OpenSWMMCore::openswmmcore
|
|
15
|
+
OpenSWMMCore::openswmmcore_output
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# Specify that this is a Python extension module
|
|
19
|
+
python_extension_module(_output)
|
|
20
|
+
|
|
21
|
+
if(APPLE)
|
|
22
|
+
set(INSTALL_LIB_ROOT "@loader_path;@rpath;@loader_path/../../../..;${OUTFILE_BUILD_DIR}")
|
|
23
|
+
set(BUILD_LIB_ROOT "@loader_path;@rpath;${OUTFILE_BUILD_DIR}")
|
|
24
|
+
elseif(UNIX)
|
|
25
|
+
set(INSTALL_LIB_ROOT "$ORIGIN;$ORIGIN/../../../..;${OUTFILE_BUILD_DIR}")
|
|
26
|
+
set(BUILD_LIB_ROOT "$ORIGIN;${OUTFILE_BUILD_DIR}")
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
# Set up rpath for runswmm inside install package
|
|
30
|
+
set_target_properties(_output
|
|
31
|
+
PROPERTIES
|
|
32
|
+
BUILD_RPATH "${BUILD_LIB_ROOT}"
|
|
33
|
+
INSTALL_RPATH "${INSTALL_LIB_ROOT}"
|
|
34
|
+
BUILD_WITH_INSTALL_RPATH True
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Install the target
|
|
38
|
+
install(TARGETS _output LIBRARY DESTINATION openswmm/output)
|
|
39
|
+
|
|
40
|
+
# Include directories
|
|
41
|
+
target_include_directories(
|
|
42
|
+
_output
|
|
43
|
+
PUBLIC
|
|
44
|
+
${CMAKE_CURRENT_SOURCE_DIR}
|
|
45
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .output cimport *
|