Added ENgetcurvetype API

Also update curve type on EN_setheadcurveindex.

Co-Authored-By: milad ghiami <milad-ghiami@users.noreply.github.com>
This commit is contained in:
Elad Salomons
2018-08-20 21:10:49 +03:00
parent 634651d4e6
commit 761199b08e
4 changed files with 33 additions and 4 deletions

View File

@@ -435,6 +435,10 @@ int DLLEXPORT ENgetpumptype(int index, int *type) {
return EN_getpumptype(_defaultModel, index, type);
}
int DLLEXPORT ENgetcurvetype(int curveindex, int *type) {
return EN_getcurvetype(_defaultModel, curveindex, type);
}
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands) {
return EN_getnumdemands(_defaultModel, nodeIndex, numDemands);
}
@@ -3349,7 +3353,8 @@ int DLLEXPORT EN_setheadcurveindex(EN_Project *p, int index, int curveindex) {
pump->Q0 /= Ucf[FLOW];
pump->Qmax /= Ucf[FLOW];
pump->Hmax /= Ucf[HEAD];
p->network.Curve[curveindex].Type = P_CURVE;
return (0);
}
@@ -3370,6 +3375,18 @@ int DLLEXPORT EN_getpumptype(EN_Project *p, int index, int *type) {
return (0);
}
int DLLEXPORT EN_getcurvetype(EN_Project *p, int curveindex, int *type) {
EN_Network *net = &p->network;
if (!p->Openflag)
return (102);
if (curveindex < 1 || curveindex > net->Ncurves)
return (206);
*type = net->Curve[curveindex].Type;
return (0);
}
/*
----------------------------------------------------------------
Functions for opening files