Fix PumpType and CurveType enums
Also adds a general \default curve type. Fixes #208.
This commit is contained in:
11
src/epanet.c
11
src/epanet.c
@@ -2933,7 +2933,7 @@ int DLLEXPORT EN_addcurve(EN_Project *p, char *id) {
|
||||
|
||||
strcpy(tmpCur[n].ID, id);
|
||||
tmpCur[n].Npts = 1;
|
||||
tmpCur[n].Type = -1;
|
||||
tmpCur[n].Type = G_CURVE;
|
||||
tmpCur[n].X = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
||||
tmpCur[n].Y = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
||||
if (tmpCur[n].X == NULL)
|
||||
@@ -2974,9 +2974,7 @@ int DLLEXPORT EN_addcurve(EN_Project *p, char *id) {
|
||||
int DLLEXPORT EN_setcurve(EN_Project *p, int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n) {
|
||||
|
||||
EN_Network *net = &p->network;
|
||||
Scurve *Curve = net->Curve;
|
||||
|
||||
|
||||
Scurve *Curve = net->Curve;
|
||||
int j;
|
||||
|
||||
/* Check for valid arguments */
|
||||
@@ -3007,12 +3005,9 @@ int DLLEXPORT EN_setcurve(EN_Project *p, int index, EN_API_FLOAT_TYPE *x, EN_API
|
||||
int DLLEXPORT EN_setcurvevalue(EN_Project *p, int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y) {
|
||||
|
||||
EN_Network *net = &p->network;
|
||||
|
||||
Scurve *Curve = net->Curve;
|
||||
|
||||
const int Ncurves = net->Ncurves;
|
||||
|
||||
|
||||
if (!p->Openflag)
|
||||
return (102);
|
||||
if (index <= 0 || index > Ncurves)
|
||||
@@ -3713,7 +3708,7 @@ int allocdata(EN_Project *p)
|
||||
}
|
||||
for (n = 0; n <= par->MaxCurves; n++) {
|
||||
net->Curve[n].Npts = 0;
|
||||
net->Curve[n].Type = -1;
|
||||
net->Curve[n].Type = G_CURVE;
|
||||
net->Curve[n].X = NULL;
|
||||
net->Curve[n].Y = NULL;
|
||||
}
|
||||
|
||||
@@ -151,8 +151,9 @@ typedef enum {
|
||||
V_CURVE, /* volume curve */
|
||||
P_CURVE, /* pump curve */
|
||||
E_CURVE, /* efficiency curve */
|
||||
H_CURVE
|
||||
} CurveType; /* head loss curve */
|
||||
H_CURVE, /* head loss curve */
|
||||
G_CURVE /* General\default curve */
|
||||
} CurveType;
|
||||
|
||||
typedef enum {
|
||||
CONST_HP, /* constant horsepower */
|
||||
|
||||
Reference in New Issue
Block a user