epanet-plus 0.0.1__cp313-cp313-macosx_10_13_x86_64.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.

Potentially problematic release.


This version of epanet-plus might be problematic. Click here for more details.

Files changed (105) hide show
  1. docs/conf.py +67 -0
  2. epanet-msx-src/dispersion.h +27 -0
  3. epanet-msx-src/hash.c +107 -0
  4. epanet-msx-src/hash.h +28 -0
  5. epanet-msx-src/include/epanetmsx.h +104 -0
  6. epanet-msx-src/include/epanetmsx_export.h +42 -0
  7. epanet-msx-src/mathexpr.c +937 -0
  8. epanet-msx-src/mathexpr.h +39 -0
  9. epanet-msx-src/mempool.c +204 -0
  10. epanet-msx-src/mempool.h +24 -0
  11. epanet-msx-src/msxchem.c +1285 -0
  12. epanet-msx-src/msxcompiler.c +368 -0
  13. epanet-msx-src/msxdict.h +42 -0
  14. epanet-msx-src/msxdispersion.c +586 -0
  15. epanet-msx-src/msxerr.c +116 -0
  16. epanet-msx-src/msxfile.c +260 -0
  17. epanet-msx-src/msxfuncs.c +175 -0
  18. epanet-msx-src/msxfuncs.h +35 -0
  19. epanet-msx-src/msxinp.c +1504 -0
  20. epanet-msx-src/msxout.c +398 -0
  21. epanet-msx-src/msxproj.c +791 -0
  22. epanet-msx-src/msxqual.c +2011 -0
  23. epanet-msx-src/msxrpt.c +400 -0
  24. epanet-msx-src/msxtank.c +422 -0
  25. epanet-msx-src/msxtoolkit.c +1164 -0
  26. epanet-msx-src/msxtypes.h +551 -0
  27. epanet-msx-src/msxutils.c +524 -0
  28. epanet-msx-src/msxutils.h +56 -0
  29. epanet-msx-src/newton.c +158 -0
  30. epanet-msx-src/newton.h +34 -0
  31. epanet-msx-src/rk5.c +287 -0
  32. epanet-msx-src/rk5.h +39 -0
  33. epanet-msx-src/ros2.c +293 -0
  34. epanet-msx-src/ros2.h +35 -0
  35. epanet-msx-src/smatrix.c +816 -0
  36. epanet-msx-src/smatrix.h +29 -0
  37. epanet-src/AUTHORS +60 -0
  38. epanet-src/LICENSE +21 -0
  39. epanet-src/enumstxt.h +151 -0
  40. epanet-src/epanet.c +5937 -0
  41. epanet-src/epanet2.c +961 -0
  42. epanet-src/epanet2.def +131 -0
  43. epanet-src/errors.dat +79 -0
  44. epanet-src/flowbalance.c +186 -0
  45. epanet-src/funcs.h +219 -0
  46. epanet-src/genmmd.c +1000 -0
  47. epanet-src/hash.c +177 -0
  48. epanet-src/hash.h +28 -0
  49. epanet-src/hydcoeffs.c +1303 -0
  50. epanet-src/hydraul.c +1164 -0
  51. epanet-src/hydsolver.c +781 -0
  52. epanet-src/hydstatus.c +442 -0
  53. epanet-src/include/epanet2.h +466 -0
  54. epanet-src/include/epanet2_2.h +1962 -0
  55. epanet-src/include/epanet2_enums.h +518 -0
  56. epanet-src/inpfile.c +884 -0
  57. epanet-src/input1.c +672 -0
  58. epanet-src/input2.c +970 -0
  59. epanet-src/input3.c +2265 -0
  60. epanet-src/leakage.c +527 -0
  61. epanet-src/mempool.c +146 -0
  62. epanet-src/mempool.h +24 -0
  63. epanet-src/output.c +853 -0
  64. epanet-src/project.c +1691 -0
  65. epanet-src/quality.c +695 -0
  66. epanet-src/qualreact.c +800 -0
  67. epanet-src/qualroute.c +696 -0
  68. epanet-src/report.c +1559 -0
  69. epanet-src/rules.c +1500 -0
  70. epanet-src/smatrix.c +871 -0
  71. epanet-src/text.h +508 -0
  72. epanet-src/types.h +928 -0
  73. epanet-src/util/cstr_helper.c +59 -0
  74. epanet-src/util/cstr_helper.h +38 -0
  75. epanet-src/util/errormanager.c +92 -0
  76. epanet-src/util/errormanager.h +39 -0
  77. epanet-src/util/filemanager.c +212 -0
  78. epanet-src/util/filemanager.h +81 -0
  79. epanet-src/validate.c +408 -0
  80. epanet.cpython-313-darwin.so +0 -0
  81. epanet_plus/VERSION +1 -0
  82. epanet_plus/__init__.py +8 -0
  83. epanet_plus/epanet_plus.c +118 -0
  84. epanet_plus/epanet_toolkit.py +2730 -0
  85. epanet_plus/epanet_wrapper.py +2414 -0
  86. epanet_plus/include/epanet_plus.h +9 -0
  87. epanet_plus-0.0.1.dist-info/METADATA +152 -0
  88. epanet_plus-0.0.1.dist-info/RECORD +105 -0
  89. epanet_plus-0.0.1.dist-info/WHEEL +6 -0
  90. epanet_plus-0.0.1.dist-info/licenses/LICENSE +21 -0
  91. epanet_plus-0.0.1.dist-info/top_level.txt +11 -0
  92. examples/basic_usage.py +35 -0
  93. python-extension/ext.c +344 -0
  94. python-extension/pyepanet.c +2133 -0
  95. python-extension/pyepanet.h +143 -0
  96. python-extension/pyepanet2.c +1823 -0
  97. python-extension/pyepanet2.h +141 -0
  98. python-extension/pyepanet_plus.c +37 -0
  99. python-extension/pyepanet_plus.h +4 -0
  100. python-extension/pyepanetmsx.c +388 -0
  101. python-extension/pyepanetmsx.h +35 -0
  102. tests/test_epanet.py +16 -0
  103. tests/test_epanetmsx.py +36 -0
  104. tests/test_epyt.py +114 -0
  105. tests/test_load_inp_from_buffer.py +18 -0
docs/conf.py ADDED
@@ -0,0 +1,67 @@
1
+ """
2
+ Configuration file for the Sphinx documentation builder.
3
+
4
+ This file only contains a selection of the most common options. For a full
5
+ list see the documentation: http://www.sphinx-doc.org/en/master/config
6
+ """
7
+
8
+ # -- Path setup --------------------------------------------------------------
9
+
10
+ # If extensions (or modules to document with autodoc) are in another directory,
11
+ # add these directories to sys.path here. If the directory is relative to the
12
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
13
+ #
14
+ import os
15
+ import sys
16
+ sys.path.insert(0, os.path.abspath('../'))
17
+
18
+
19
+ # -- Project information -----------------------------------------------------
20
+
21
+ project = 'EPANET-PLUS'
22
+ copyright = 'EPANET-PLUS Developers'
23
+ author = 'André Artelt'
24
+
25
+
26
+ # -- General configuration ---------------------------------------------------
27
+
28
+ autodoc_mock_imports = ["numpy", "scipy"]
29
+
30
+ # Add any Sphinx extension module names here, as strings. They can be
31
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32
+ # ones.
33
+ extensions = [
34
+ 'sphinx.ext.autodoc',
35
+ 'sphinx.ext.napoleon',
36
+ 'sphinx.ext.viewcode',
37
+ 'nbsphinx'
38
+ ]
39
+
40
+ # Show line numbers in the source code
41
+ viewcode_line_numbers = True
42
+
43
+ # Add any paths that contain templates here, relative to this directory.
44
+ templates_path = ['_templates']
45
+
46
+ # List of patterns, relative to source directory, that match files and
47
+ # directories to ignore when looking for source files.
48
+ # This pattern also affects html_static_path and html_extra_path.
49
+ exclude_patterns = []
50
+
51
+ # LaTeX
52
+ latex_elements = {
53
+ 'maxlistdepth': "10",
54
+ 'printindex': r'\def\twocolumn[#1]{#1}\printindex'
55
+ }
56
+
57
+ # -- Options for HTML output -------------------------------------------------
58
+
59
+ # The theme to use for HTML and HTML Help pages. See the documentation for
60
+ # a list of builtin themes.
61
+ #
62
+ html_theme = 'sphinx_rtd_theme'
63
+
64
+ # Add any paths that contain custom static files (such as style sheets) here,
65
+ # relative to this directory. They are copied after the builtin static files,
66
+ # so a file named "default.css" will overwrite the builtin "default.css".
67
+ html_static_path = ['_static']
@@ -0,0 +1,27 @@
1
+ #ifndef DISPERSION_H
2
+ #define DISPERSION_H
3
+
4
+ #define MAXSEGMENTS 5000
5
+
6
+ typedef enum {
7
+ XHEAD, // pump cannot deliver head (closed)
8
+ TEMPCLOSED, // temporarily closed
9
+ CLOSED, // closed
10
+ OPEN, // open
11
+ ACTIVE, // valve active (partially open)
12
+ XFLOW, // pump exceeds maximum flow
13
+ XFCV, // FCV cannot supply flow
14
+ XPRESSURE, // valve cannot supply pressure
15
+ FILLING, // tank filling
16
+ EMPTYING, // tank emptying
17
+ OVERFLOWING // tank overflowing
18
+ } StatusType;
19
+
20
+ int dispersion_open();
21
+ int dispersion_close();
22
+ void dispersion_pipe(int m, double tstep); //effective dispersion coefficient and upstream/downstream node impact calculation
23
+ void solve_nodequal(int m, double tstep); //solve nodal concentration
24
+ void segqual_update(int m, double tstep); //update pipe segment concentration
25
+ void tridiag(int n, double *a, double *b, double *c, double *r, double *y);
26
+
27
+ #endif
epanet-msx-src/hash.c ADDED
@@ -0,0 +1,107 @@
1
+ //-----------------------------------------------------------------------------
2
+ // hash.c
3
+ //
4
+ // Implementation of a simple Hash Table for string storage & retrieval
5
+ // /
6
+ // Written by L. Rossman
7
+ // Last Updated on 6/19/03
8
+ //
9
+ // The hash table data structure (HTable) is defined in "hash.h".
10
+ // Interface Functions:
11
+ // HTcreate() - creates a hash table
12
+ // HTinsert() - inserts a string & its index value into a hash table
13
+ // HTfind() - retrieves the index value of a string from a table
14
+ // HTfree() - frees a hash table
15
+ //-----------------------------------------------------------------------------
16
+
17
+ #include <string.h>
18
+ #include <stdlib.h>
19
+
20
+ #include "hash.h"
21
+
22
+ /* Use Fletcher's checksum to compute 2-byte hash of string */
23
+ unsigned int hash(char *str)
24
+ {
25
+ unsigned int sum1= 0, check1;
26
+ unsigned long sum2= 0L;
27
+ while( '\0' != *str )
28
+ {
29
+ sum1 += (*str);
30
+ str++;
31
+ if ( 255 <= sum1 ) sum1 -= 255;
32
+ sum2 += sum1;
33
+ }
34
+ check1= sum2;
35
+ check1 %= 255;
36
+ check1= 255 - (sum1+check1) % 255;
37
+ sum1= 255 - (sum1+check1) % 255;
38
+ return( ( ( check1 << 8 ) | sum1 ) % HTMAXSIZE);
39
+ }
40
+
41
+ HTtable *HTcreate()
42
+ {
43
+ int i;
44
+ HTtable *ht = (HTtable *) calloc(HTMAXSIZE, sizeof(HTtable));
45
+ if (ht != NULL) for (i=0; i<HTMAXSIZE; i++) ht[i] = NULL;
46
+ return(ht);
47
+ }
48
+
49
+ int HTinsert(HTtable *ht, char *key, int data)
50
+ {
51
+ unsigned int i = hash(key);
52
+ struct HTentry *entry;
53
+ if ( i >= HTMAXSIZE ) return(0);
54
+ entry = (struct HTentry *) malloc(sizeof(struct HTentry));
55
+ if (entry == NULL) return(0);
56
+ entry->key = key;
57
+ entry->data = data;
58
+ entry->next = ht[i];
59
+ ht[i] = entry;
60
+ return(1);
61
+ }
62
+
63
+ int HTfind(HTtable *ht, char *key)
64
+ {
65
+ unsigned int i = hash(key);
66
+ struct HTentry *entry;
67
+ if ( i >= HTMAXSIZE ) return(NOTFOUND);
68
+ entry = ht[i];
69
+ while (entry != NULL)
70
+ {
71
+ if ( strcmp(entry->key,key) == 0 ) return(entry->data);
72
+ entry = entry->next;
73
+ }
74
+ return(NOTFOUND);
75
+ }
76
+
77
+ char *HTfindKey(HTtable *ht, char *key)
78
+ {
79
+ unsigned int i = hash(key);
80
+ struct HTentry *entry;
81
+ if ( i >= HTMAXSIZE ) return(NULL);
82
+ entry = ht[i];
83
+ while (entry != NULL)
84
+ {
85
+ if ( strcmp(entry->key,key) == 0 ) return(entry->key);
86
+ entry = entry->next;
87
+ }
88
+ return(NULL);
89
+ }
90
+
91
+ void HTfree(HTtable *ht)
92
+ {
93
+ struct HTentry *entry,
94
+ *nextentry;
95
+ int i;
96
+ for (i=0; i<HTMAXSIZE; i++)
97
+ {
98
+ entry = ht[i];
99
+ while (entry != NULL)
100
+ {
101
+ nextentry = entry->next;
102
+ free(entry);
103
+ entry = nextentry;
104
+ }
105
+ }
106
+ free(ht);
107
+ }
epanet-msx-src/hash.h ADDED
@@ -0,0 +1,28 @@
1
+ /* HASH.H
2
+ **
3
+ ** Header file for Hash Table module HASH.C
4
+ **
5
+ */
6
+
7
+ #ifndef HASH_H
8
+ #define HASH_H
9
+
10
+ #define HTMAXSIZE 1999
11
+ #define NOTFOUND 0
12
+
13
+ struct HTentry
14
+ {
15
+ char *key;
16
+ int data;
17
+ struct HTentry *next;
18
+ };
19
+
20
+ typedef struct HTentry *HTtable;
21
+
22
+ HTtable *HTcreate(void);
23
+ int HTinsert(HTtable *, char *, int);
24
+ int HTfind(HTtable *, char *);
25
+ char *HTfindKey(HTtable *, char *);
26
+ void HTfree(HTtable *);
27
+
28
+ #endif
@@ -0,0 +1,104 @@
1
+ /******************************************************************************
2
+ ** MODULE: EPANETMSX.H
3
+ ** PROJECT: EPANET-MSX
4
+ ** DESCRIPTION: C/C++ header file for EPANET Multi-Species Extension Toolkit
5
+ ** AUTHORS: see AUTHORS
6
+ ** Copyright: see AUTHORS
7
+ ** License: see LICENSE
8
+ ** VERSION: 2.0.0
9
+ ** LAST UPDATE: 11/01/10
10
+ *******************************************************************************/
11
+
12
+ #include "epanet2.h" // EPANET toolkit header file
13
+
14
+ #ifndef EPANETMSX_H
15
+ #define EPANETMSX_H
16
+
17
+ #define epanetmsx_EXPORTS
18
+
19
+ #ifndef MSXDLLEXPORT
20
+ #ifdef _WIN32
21
+ #ifdef epanetmsx_EXPORTS
22
+ #define MSXDLLEXPORT __declspec(dllexport) __stdcall
23
+ #else
24
+ #define MSXDLLEXPORT __declspec(dllimport) __stdcall
25
+ #endif
26
+ #elif defined(__CYGWIN__)
27
+ #define MSXDLLEXPORT __stdcall
28
+ #else
29
+ #define MSXDLLEXPORT
30
+ #endif
31
+ #endif
32
+
33
+ // --- Declare the EPANETMSX toolkit functions
34
+ #if defined(__cplusplus)
35
+ extern "C" {
36
+ #endif
37
+
38
+ // --- define MSX constants
39
+
40
+ #define MSX_NODE 0
41
+ #define MSX_LINK 1
42
+ #define MSX_TANK 2
43
+ #define MSX_SPECIES 3
44
+ #define MSX_TERM 4
45
+ #define MSX_PARAMETER 5
46
+ #define MSX_CONSTANT 6
47
+ #define MSX_PATTERN 7
48
+
49
+ #define MSX_BULK 0
50
+ #define MSX_WALL 1
51
+
52
+ #define MSX_NOSOURCE -1
53
+ #define MSX_CONCEN 0
54
+ #define MSX_MASS 1
55
+ #define MSX_SETPOINT 2
56
+ #define MSX_FLOWPACED 3
57
+
58
+ // --- declare MSX functions
59
+
60
+ int MSXDLLEXPORT MSXENopen(const char *inpFile, const char *rptFile,
61
+ const char *outFile);
62
+ int MSXDLLEXPORT MSXopen(char *fname);
63
+ int MSXDLLEXPORT MSXsolveH(void);
64
+ int MSXDLLEXPORT MSXusehydfile(char *fname);
65
+ int MSXDLLEXPORT MSXsolveQ(void);
66
+ int MSXDLLEXPORT MSXinit(int saveFlag);
67
+ int MSXDLLEXPORT MSXstep(double *t, double *tleft);
68
+ int MSXDLLEXPORT MSXsaveoutfile(char *fname);
69
+ int MSXDLLEXPORT MSXsavemsxfile(char *fname);
70
+ int MSXDLLEXPORT MSXreport(void);
71
+ int MSXDLLEXPORT MSXclose(void);
72
+ int MSXDLLEXPORT MSXENclose(void);
73
+
74
+ int MSXDLLEXPORT MSXgetindex(int type, char *id, int *index);
75
+ int MSXDLLEXPORT MSXgetIDlen(int type, int index, int *len);
76
+ int MSXDLLEXPORT MSXgetID(int type, int index, char *id, int len);
77
+ int MSXDLLEXPORT MSXgetcount(int type, int *count);
78
+ int MSXDLLEXPORT MSXgetspecies(int index, int *type, char *units, double *aTol,
79
+ double *rTol);
80
+ int MSXDLLEXPORT MSXgetconstant(int index, double *value);
81
+ int MSXDLLEXPORT MSXgetparameter(int type, int index, int param, double *value);
82
+ int MSXDLLEXPORT MSXgetsource(int node, int species, int *type, double *level,
83
+ int *pat);
84
+ int MSXDLLEXPORT MSXgetpatternlen(int pat, int *len);
85
+ int MSXDLLEXPORT MSXgetpatternvalue(int pat, int period, double *value);
86
+ int MSXDLLEXPORT MSXgetinitqual(int type, int index, int species, double *value);
87
+ int MSXDLLEXPORT MSXgetqual(int type, int index, int species, double *value);
88
+ int MSXDLLEXPORT MSXgeterror(int code, char *msg, int len);
89
+
90
+ int MSXDLLEXPORT MSXsetconstant(int index, double value);
91
+ int MSXDLLEXPORT MSXsetparameter(int type, int index, int param, double value);
92
+ int MSXDLLEXPORT MSXsetinitqual(int type, int index, int species, double value);
93
+ int MSXDLLEXPORT MSXsetsource(int node, int species, int type, double level,
94
+ int pat);
95
+ int MSXDLLEXPORT MSXsetpatternvalue(int pat, int period, double value);
96
+ int MSXDLLEXPORT MSXsetpattern(int pat, double mult[], int len);
97
+ int MSXDLLEXPORT MSXaddpattern(char *id);
98
+
99
+
100
+ #if defined(__cplusplus)
101
+ }
102
+ #endif
103
+
104
+ #endif
@@ -0,0 +1,42 @@
1
+
2
+ #ifndef MSXDLLEXPORT_H
3
+ #define MSXDLLEXPORT_H
4
+
5
+ #ifdef SHARED_EXPORTS_BUILT_AS_STATIC
6
+ # define MSXDLLEXPORT
7
+ # define EPANETMSX_NO_EXPORT
8
+ #else
9
+ # ifndef MSXDLLEXPORT
10
+ # ifdef epanetmsx_EXPORTS
11
+ /* We are building this library */
12
+ # define MSXDLLEXPORT __attribute__((visibility("default")))
13
+ # else
14
+ /* We are using this library */
15
+ # define MSXDLLEXPORT __attribute__((visibility("default")))
16
+ # endif
17
+ # endif
18
+
19
+ # ifndef EPANETMSX_NO_EXPORT
20
+ # define EPANETMSX_NO_EXPORT __attribute__((visibility("hidden")))
21
+ # endif
22
+ #endif
23
+
24
+ #ifndef EPANETMSX_DEPRECATED
25
+ # define EPANETMSX_DEPRECATED __attribute__ ((__deprecated__))
26
+ #endif
27
+
28
+ #ifndef EPANETMSX_DEPRECATED_EXPORT
29
+ # define EPANETMSX_DEPRECATED_EXPORT MSXDLLEXPORT EPANETMSX_DEPRECATED
30
+ #endif
31
+
32
+ #ifndef EPANETMSX_DEPRECATED_NO_EXPORT
33
+ # define EPANETMSX_DEPRECATED_NO_EXPORT EPANETMSX_NO_EXPORT EPANETMSX_DEPRECATED
34
+ #endif
35
+
36
+ #if 0 /* DEFINE_NO_DEPRECATED */
37
+ # ifndef EPANETMSX_NO_DEPRECATED
38
+ # define EPANETMSX_NO_DEPRECATED
39
+ # endif
40
+ #endif
41
+
42
+ #endif /* MSXDLLEXPORT_H */