epanet-plus 0.0.1__cp310-cp310-macosx_10_9_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-310-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
epanet-src/hash.c ADDED
@@ -0,0 +1,177 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.3
5
+ Module: hash.c
6
+ Description: implementation of a simple hash table
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 05/15/2019
11
+ ******************************************************************************
12
+ */
13
+
14
+ #include <stdlib.h>
15
+ #include <string.h>
16
+ #include "hash.h"
17
+
18
+ #define HASHTABLEMAXSIZE 128000
19
+
20
+ // An entry in the hash table
21
+ typedef struct DataEntryStruct
22
+ {
23
+ char *key;
24
+ int data;
25
+ struct DataEntryStruct *next;
26
+ } DataEntry;
27
+
28
+ // Hash a string to an integer
29
+ unsigned int gethash(const char *str)
30
+ {
31
+ unsigned int hash = 5381;
32
+ unsigned int retHash;
33
+ int c;
34
+ while ((c = *str++))
35
+ {
36
+ hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
37
+ }
38
+ retHash = hash % HASHTABLEMAXSIZE;
39
+ return retHash;
40
+ }
41
+
42
+ // Produce a duplicate string
43
+ char *dupstr(const char *s)
44
+ {
45
+ size_t size = strlen(s) + 1;
46
+ char *p = malloc(size);
47
+ if (p) memcpy(p, s, size);
48
+ return p;
49
+ }
50
+
51
+ // Create a hash table
52
+ HashTable *hashtable_create()
53
+ {
54
+ int i;
55
+ HashTable *ht = (HashTable *) calloc(HASHTABLEMAXSIZE, sizeof(HashTable));
56
+ if (ht != NULL)
57
+ {
58
+ for (i = 0; i < HASHTABLEMAXSIZE; i++) ht[i] = NULL;
59
+ }
60
+ return ht;
61
+ }
62
+
63
+ // Insert an entry into the hash table
64
+ int hashtable_insert(HashTable *ht, const char *key, int data)
65
+ {
66
+ unsigned int i = gethash(key);
67
+ DataEntry *entry;
68
+ if ( i >= HASHTABLEMAXSIZE ) return 0;
69
+ entry = (DataEntry *) malloc(sizeof(DataEntry));
70
+ if (entry == NULL) return(0);
71
+ entry->key = dupstr(key);
72
+ entry->data = data;
73
+ entry->next = ht[i];
74
+ ht[i] = entry;
75
+ return 1;
76
+ }
77
+
78
+ // Change the hash table's data entry for a particular key
79
+ int hashtable_update(HashTable *ht, const char *key, int new_data)
80
+ {
81
+ unsigned int i = gethash(key);
82
+ DataEntry *entry;
83
+
84
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
85
+ entry = ht[i];
86
+ while (entry != NULL)
87
+ {
88
+ if ( strcmp(entry->key, key) == 0 )
89
+ {
90
+ entry->data = new_data;
91
+ return 1;
92
+ }
93
+ entry = entry->next;
94
+ }
95
+ return NOTFOUND;
96
+ }
97
+
98
+ // Delete an entry in the hash table
99
+ int hashtable_delete(HashTable *ht, const char *key)
100
+ {
101
+ unsigned int i = gethash(key);
102
+ DataEntry *entry, *preventry;
103
+
104
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
105
+
106
+ preventry = NULL;
107
+ entry = ht[i];
108
+ while (entry != NULL)
109
+ {
110
+ if (strcmp(entry->key, key) == 0)
111
+ {
112
+ if (preventry == NULL) ht[i] = entry->next;
113
+ else preventry->next = entry->next;
114
+ free(entry->key);
115
+ free(entry);
116
+ return 1;
117
+ }
118
+ preventry = entry;
119
+ entry = entry->next;
120
+ }
121
+ return NOTFOUND;
122
+ }
123
+
124
+ // Find the data for a particular key
125
+ int hashtable_find(HashTable *ht, const char *key)
126
+ {
127
+ unsigned int i = gethash(key);
128
+ DataEntry *entry;
129
+
130
+ if ( i >= HASHTABLEMAXSIZE ) return NOTFOUND;
131
+ entry = ht[i];
132
+ while (entry != NULL)
133
+ {
134
+ if ( strcmp(entry->key, key) == 0 )
135
+ {
136
+ return entry->data;
137
+ }
138
+ entry = entry->next;
139
+ }
140
+ return NOTFOUND;
141
+ }
142
+
143
+ // Find a particular key in the hash table
144
+ char *hashtable_findkey(HashTable *ht, const char *key)
145
+ {
146
+ unsigned int i = gethash(key);
147
+ DataEntry *entry;
148
+ if ( i >= HASHTABLEMAXSIZE ) return NULL;
149
+ entry = ht[i];
150
+ while (entry != NULL)
151
+ {
152
+ if ( strcmp(entry->key, key) == 0 ) return entry->key;
153
+ entry = entry->next;
154
+ }
155
+ return NULL;
156
+ }
157
+
158
+ // Delete a hash table and free all of its memory
159
+ void hashtable_free(HashTable *ht)
160
+ {
161
+ DataEntry *entry, *nextentry;
162
+ int i;
163
+
164
+ for (i = 0; i < HASHTABLEMAXSIZE; i++)
165
+ {
166
+ entry = ht[i];
167
+ while (entry != NULL)
168
+ {
169
+ nextentry = entry->next;
170
+ free(entry->key);
171
+ free(entry);
172
+ entry = nextentry;
173
+ }
174
+ ht[i] = NULL;
175
+ }
176
+ free(ht);
177
+ }
epanet-src/hash.h ADDED
@@ -0,0 +1,28 @@
1
+ /*
2
+ ******************************************************************************
3
+ Project: OWA EPANET
4
+ Version: 2.3
5
+ Module: hash.h
6
+ Description: header for a simple hash table
7
+ Authors: see AUTHORS
8
+ Copyright: see AUTHORS
9
+ License: see LICENSE
10
+ Last Updated: 11/27/2018
11
+ ******************************************************************************
12
+ */
13
+ #ifndef HASH_H
14
+ #define HASH_H
15
+
16
+ #define NOTFOUND 0
17
+
18
+ typedef struct DataEntryStruct *HashTable;
19
+
20
+ HashTable *hashtable_create(void);
21
+ int hashtable_insert(HashTable *, const char *, int);
22
+ int hashtable_find(HashTable *, const char *);
23
+ char *hashtable_findkey(HashTable *, const char *);
24
+ void hashtable_free(HashTable *);
25
+ int hashtable_update(HashTable *ht, const char *key, int new_data);
26
+ int hashtable_delete(HashTable *ht, const char *key);
27
+
28
+ #endif