epanet-plus 0.0.1__cp313-cp313-win32.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.
- docs/conf.py +67 -0
- epanet-msx-src/dispersion.h +27 -0
- epanet-msx-src/hash.c +107 -0
- epanet-msx-src/hash.h +28 -0
- epanet-msx-src/include/epanetmsx.h +104 -0
- epanet-msx-src/include/epanetmsx_export.h +42 -0
- epanet-msx-src/mathexpr.c +937 -0
- epanet-msx-src/mathexpr.h +39 -0
- epanet-msx-src/mempool.c +204 -0
- epanet-msx-src/mempool.h +24 -0
- epanet-msx-src/msxchem.c +1285 -0
- epanet-msx-src/msxcompiler.c +368 -0
- epanet-msx-src/msxdict.h +42 -0
- epanet-msx-src/msxdispersion.c +586 -0
- epanet-msx-src/msxerr.c +116 -0
- epanet-msx-src/msxfile.c +260 -0
- epanet-msx-src/msxfuncs.c +175 -0
- epanet-msx-src/msxfuncs.h +35 -0
- epanet-msx-src/msxinp.c +1504 -0
- epanet-msx-src/msxout.c +398 -0
- epanet-msx-src/msxproj.c +791 -0
- epanet-msx-src/msxqual.c +2011 -0
- epanet-msx-src/msxrpt.c +400 -0
- epanet-msx-src/msxtank.c +422 -0
- epanet-msx-src/msxtoolkit.c +1164 -0
- epanet-msx-src/msxtypes.h +551 -0
- epanet-msx-src/msxutils.c +524 -0
- epanet-msx-src/msxutils.h +56 -0
- epanet-msx-src/newton.c +158 -0
- epanet-msx-src/newton.h +34 -0
- epanet-msx-src/rk5.c +287 -0
- epanet-msx-src/rk5.h +39 -0
- epanet-msx-src/ros2.c +293 -0
- epanet-msx-src/ros2.h +35 -0
- epanet-msx-src/smatrix.c +816 -0
- epanet-msx-src/smatrix.h +29 -0
- epanet-src/AUTHORS +60 -0
- epanet-src/LICENSE +21 -0
- epanet-src/enumstxt.h +151 -0
- epanet-src/epanet.c +5937 -0
- epanet-src/epanet2.c +961 -0
- epanet-src/epanet2.def +131 -0
- epanet-src/errors.dat +79 -0
- epanet-src/flowbalance.c +186 -0
- epanet-src/funcs.h +219 -0
- epanet-src/genmmd.c +1000 -0
- epanet-src/hash.c +177 -0
- epanet-src/hash.h +28 -0
- epanet-src/hydcoeffs.c +1303 -0
- epanet-src/hydraul.c +1164 -0
- epanet-src/hydsolver.c +781 -0
- epanet-src/hydstatus.c +442 -0
- epanet-src/include/epanet2.h +466 -0
- epanet-src/include/epanet2_2.h +1962 -0
- epanet-src/include/epanet2_enums.h +518 -0
- epanet-src/inpfile.c +884 -0
- epanet-src/input1.c +672 -0
- epanet-src/input2.c +970 -0
- epanet-src/input3.c +2265 -0
- epanet-src/leakage.c +527 -0
- epanet-src/mempool.c +146 -0
- epanet-src/mempool.h +24 -0
- epanet-src/output.c +853 -0
- epanet-src/project.c +1691 -0
- epanet-src/quality.c +695 -0
- epanet-src/qualreact.c +800 -0
- epanet-src/qualroute.c +696 -0
- epanet-src/report.c +1559 -0
- epanet-src/rules.c +1500 -0
- epanet-src/smatrix.c +871 -0
- epanet-src/text.h +508 -0
- epanet-src/types.h +928 -0
- epanet-src/util/cstr_helper.c +59 -0
- epanet-src/util/cstr_helper.h +38 -0
- epanet-src/util/errormanager.c +92 -0
- epanet-src/util/errormanager.h +39 -0
- epanet-src/util/filemanager.c +212 -0
- epanet-src/util/filemanager.h +81 -0
- epanet-src/validate.c +408 -0
- epanet.cp313-win32.pyd +0 -0
- epanet_plus/VERSION +1 -0
- epanet_plus/__init__.py +8 -0
- epanet_plus/epanet_plus.c +118 -0
- epanet_plus/epanet_toolkit.py +2730 -0
- epanet_plus/epanet_wrapper.py +2414 -0
- epanet_plus/include/epanet_plus.h +9 -0
- epanet_plus-0.0.1.dist-info/METADATA +152 -0
- epanet_plus-0.0.1.dist-info/RECORD +105 -0
- epanet_plus-0.0.1.dist-info/WHEEL +5 -0
- epanet_plus-0.0.1.dist-info/licenses/LICENSE +21 -0
- epanet_plus-0.0.1.dist-info/top_level.txt +11 -0
- examples/basic_usage.py +35 -0
- python-extension/ext.c +344 -0
- python-extension/pyepanet.c +2133 -0
- python-extension/pyepanet.h +143 -0
- python-extension/pyepanet2.c +1823 -0
- python-extension/pyepanet2.h +141 -0
- python-extension/pyepanet_plus.c +37 -0
- python-extension/pyepanet_plus.h +4 -0
- python-extension/pyepanetmsx.c +388 -0
- python-extension/pyepanetmsx.h +35 -0
- tests/test_epanet.py +16 -0
- tests/test_epanetmsx.py +36 -0
- tests/test_epyt.py +114 -0
- tests/test_load_inp_from_buffer.py +18 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
** MODULE: MATHEXPR.H
|
|
3
|
+
** PROJECT: EPANET-MSX
|
|
4
|
+
** DESCRIPTION: header file for the math expression parser in mathexpr.c.
|
|
5
|
+
** AUTHORS: see AUTHORS
|
|
6
|
+
** Copyright: see AUTHORS
|
|
7
|
+
** License: see LICENSE
|
|
8
|
+
** VERSION: 2.0.00
|
|
9
|
+
** LAST UPDATE: 2/8/11
|
|
10
|
+
******************************************************************************/
|
|
11
|
+
|
|
12
|
+
#ifndef MATHEXPR_H
|
|
13
|
+
#define MATHEXPR_H
|
|
14
|
+
|
|
15
|
+
// Node in a tokenized math expression list
|
|
16
|
+
struct ExprNode
|
|
17
|
+
{
|
|
18
|
+
int opcode; // operator code
|
|
19
|
+
int ivar; // variable index
|
|
20
|
+
double fvalue; // numerical value
|
|
21
|
+
struct ExprNode *prev; // previous node
|
|
22
|
+
struct ExprNode *next; // next node
|
|
23
|
+
};
|
|
24
|
+
typedef struct ExprNode MathExpr;
|
|
25
|
+
|
|
26
|
+
// Creates a tokenized math expression from a string
|
|
27
|
+
MathExpr* mathexpr_create(char* s, int (*getVar) (char *));
|
|
28
|
+
|
|
29
|
+
// Evaluates a tokenized math expression
|
|
30
|
+
double mathexpr_eval(MathExpr* expr, double (*getVal) (int));
|
|
31
|
+
|
|
32
|
+
// Deletes a tokenized math expression
|
|
33
|
+
void mathexpr_delete(MathExpr* expr);
|
|
34
|
+
|
|
35
|
+
// Returns reconstructed string version of a tokenized expression
|
|
36
|
+
char * mathexpr_getStr(MathExpr* expr, char* exprStr,
|
|
37
|
+
char * (*getVariableStr) (int, char *));
|
|
38
|
+
|
|
39
|
+
#endif
|
epanet-msx-src/mempool.c
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* mempool.c
|
|
2
|
+
**
|
|
3
|
+
** A simple fast memory allocation package.
|
|
4
|
+
**
|
|
5
|
+
** By Steve Hill in Graphics Gems III, David Kirk (ed.),
|
|
6
|
+
** Academic Press, Boston, MA, 1992
|
|
7
|
+
**
|
|
8
|
+
** Modified by Lew Rossman, 8/13/94.
|
|
9
|
+
**
|
|
10
|
+
** AllocInit() - create an alloc pool, returns the old pool handle
|
|
11
|
+
** Alloc() - allocate memory
|
|
12
|
+
** AllocReset() - reset the current pool
|
|
13
|
+
** AllocSetPool() - set the current pool
|
|
14
|
+
** AllocFree() - free the memory used by the current pool.
|
|
15
|
+
**
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#include <stdlib.h>
|
|
19
|
+
|
|
20
|
+
#include "mempool.h"
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
** ALLOC_BLOCK_SIZE - adjust this size to suit your installation - it
|
|
24
|
+
** should be reasonably large otherwise you will be mallocing a lot.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#define ALLOC_BLOCK_SIZE 64000 /*(62*1024)*/
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
** alloc_hdr_t - Header for each block of memory.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
typedef struct alloc_hdr_s
|
|
34
|
+
{
|
|
35
|
+
struct alloc_hdr_s *next; /* Next Block */
|
|
36
|
+
char *block, /* Start of block */
|
|
37
|
+
*free, /* Next free in block */
|
|
38
|
+
*end; /* block + block size */
|
|
39
|
+
} alloc_hdr_t;
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
** alloc_root_t - Header for the whole pool.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
typedef struct alloc_root_s
|
|
46
|
+
{
|
|
47
|
+
alloc_hdr_t *first, /* First header in pool */
|
|
48
|
+
*current; /* Current header */
|
|
49
|
+
} alloc_root_t;
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
** root - Pointer to the current pool.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
static alloc_root_t *root;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
** AllocHdr()
|
|
60
|
+
**
|
|
61
|
+
** Private routine to allocate a header and memory block.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
static alloc_hdr_t *AllocHdr(void);
|
|
65
|
+
|
|
66
|
+
static alloc_hdr_t * AllocHdr()
|
|
67
|
+
{
|
|
68
|
+
alloc_hdr_t *hdr;
|
|
69
|
+
char *block;
|
|
70
|
+
|
|
71
|
+
block = (char *) malloc(ALLOC_BLOCK_SIZE);
|
|
72
|
+
hdr = (alloc_hdr_t *) malloc(sizeof(alloc_hdr_t));
|
|
73
|
+
|
|
74
|
+
if (hdr == NULL || block == NULL) return(NULL);
|
|
75
|
+
hdr->block = block;
|
|
76
|
+
hdr->free = block;
|
|
77
|
+
hdr->next = NULL;
|
|
78
|
+
hdr->end = block + ALLOC_BLOCK_SIZE;
|
|
79
|
+
|
|
80
|
+
return(hdr);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
** AllocInit()
|
|
86
|
+
**
|
|
87
|
+
** Create a new memory pool with one block.
|
|
88
|
+
** Returns pointer to the new pool.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
alloc_handle_t * AllocInit()
|
|
92
|
+
{
|
|
93
|
+
alloc_handle_t *newpool;
|
|
94
|
+
|
|
95
|
+
root = (alloc_root_t *) malloc(sizeof(alloc_root_t));
|
|
96
|
+
if (root == NULL) return(NULL);
|
|
97
|
+
if ( (root->first = AllocHdr()) == NULL) return(NULL);
|
|
98
|
+
root->current = root->first;
|
|
99
|
+
newpool = (alloc_handle_t *) root;
|
|
100
|
+
return(newpool);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
** Alloc()
|
|
106
|
+
**
|
|
107
|
+
** Use as a direct replacement for malloc(). Allocates
|
|
108
|
+
** memory from the current pool.
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
char * Alloc(long size)
|
|
112
|
+
{
|
|
113
|
+
alloc_hdr_t *hdr = root->current;
|
|
114
|
+
char *ptr;
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
** Align to 4 byte boundary - should be ok for most machines.
|
|
118
|
+
** Change this if your machine has weird alignment requirements.
|
|
119
|
+
*/
|
|
120
|
+
size = (size + 3) & 0xfffffffc;
|
|
121
|
+
|
|
122
|
+
ptr = hdr->free;
|
|
123
|
+
hdr->free += size;
|
|
124
|
+
|
|
125
|
+
/* Check if the current block is exhausted. */
|
|
126
|
+
|
|
127
|
+
if (hdr->free >= hdr->end)
|
|
128
|
+
{
|
|
129
|
+
/* Is the next block already allocated? */
|
|
130
|
+
|
|
131
|
+
if (hdr->next != NULL)
|
|
132
|
+
{
|
|
133
|
+
/* re-use block */
|
|
134
|
+
hdr->next->free = hdr->next->block;
|
|
135
|
+
root->current = hdr->next;
|
|
136
|
+
}
|
|
137
|
+
else
|
|
138
|
+
{
|
|
139
|
+
/* extend the pool with a new block */
|
|
140
|
+
if ( (hdr->next = AllocHdr()) == NULL) return(NULL);
|
|
141
|
+
root->current = hdr->next;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* set ptr to the first location in the next block */
|
|
145
|
+
ptr = root->current->free;
|
|
146
|
+
root->current->free += size;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Return pointer to allocated memory. */
|
|
150
|
+
|
|
151
|
+
return(ptr);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
** AllocSetPool()
|
|
157
|
+
**
|
|
158
|
+
** Change the current pool. Return the old pool.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
alloc_handle_t * AllocSetPool(alloc_handle_t *newpool)
|
|
162
|
+
{
|
|
163
|
+
alloc_handle_t *old = (alloc_handle_t *) root;
|
|
164
|
+
root = (alloc_root_t *) newpool;
|
|
165
|
+
return(old);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
/*
|
|
170
|
+
** AllocReset()
|
|
171
|
+
**
|
|
172
|
+
** Reset the current pool for re-use. No memory is freed,
|
|
173
|
+
** so this is very fast.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
void AllocReset()
|
|
177
|
+
{
|
|
178
|
+
root->current = root->first;
|
|
179
|
+
root->current->free = root->current->block;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
** AllocFreePool()
|
|
185
|
+
**
|
|
186
|
+
** Free the memory used by the current pool.
|
|
187
|
+
** Don't use where AllocReset() could be used.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
void AllocFreePool()
|
|
191
|
+
{
|
|
192
|
+
alloc_hdr_t *tmp,
|
|
193
|
+
*hdr = root->first;
|
|
194
|
+
|
|
195
|
+
while (hdr != NULL)
|
|
196
|
+
{
|
|
197
|
+
tmp = hdr->next;
|
|
198
|
+
free((char *) hdr->block);
|
|
199
|
+
free((char *) hdr);
|
|
200
|
+
hdr = tmp;
|
|
201
|
+
}
|
|
202
|
+
free((char *) root);
|
|
203
|
+
root = NULL;
|
|
204
|
+
}
|
epanet-msx-src/mempool.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** mempool.h
|
|
3
|
+
**
|
|
4
|
+
** Header for mempool.c
|
|
5
|
+
**
|
|
6
|
+
** The type alloc_handle_t provides an opaque reference to the
|
|
7
|
+
** alloc pool - only the alloc routines know its structure.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef MEMPOOL_H
|
|
11
|
+
#define MEMPOOL_H
|
|
12
|
+
|
|
13
|
+
typedef struct
|
|
14
|
+
{
|
|
15
|
+
long dummy;
|
|
16
|
+
} alloc_handle_t;
|
|
17
|
+
|
|
18
|
+
alloc_handle_t *AllocInit(void);
|
|
19
|
+
char *Alloc(long);
|
|
20
|
+
alloc_handle_t *AllocSetPool(alloc_handle_t *);
|
|
21
|
+
void AllocReset(void);
|
|
22
|
+
void AllocFreePool(void);
|
|
23
|
+
|
|
24
|
+
#endif
|