Simpler, faster code using PUMPINDEX()
This commit is contained in:
22
src/epanet.c
22
src/epanet.c
@@ -2510,19 +2510,12 @@ int DLLEXPORT ENgetheadcurve(int index, char *id)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
strcpy(id,"");
|
strcpy(id,"");
|
||||||
if (!Openflag) return(102);
|
if (!Openflag) return(102);
|
||||||
for (i=1; i<=Npumps; i++)
|
if (index < 1 || index > Nlinks || PUMP != Link[index].Type) return(204);
|
||||||
{
|
strcpy(id,Curve[Pump[PUMPINDEX(index)].Hcurve].ID);
|
||||||
if(Pump[i].Link = index)
|
|
||||||
{
|
|
||||||
strcpy(id,Curve[Pump[i].Hcurve].ID);
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return(204);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DLLEXPORT ENgetpumptype(int index, int *type)
|
int DLLEXPORT ENgetpumptype(int index, int *type)
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
@@ -2534,19 +2527,12 @@ int DLLEXPORT ENgetpumptype(int index, int *type)
|
|||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
*type=-1;
|
*type=-1;
|
||||||
if (!Openflag) return(102);
|
if (!Openflag) return(102);
|
||||||
for (i=1; i<=Npumps; i++)
|
if (index < 1 || index > Nlinks || PUMP != Link[index].Type) return(204);
|
||||||
{
|
*type = Pump[PUMPINDEX(index)].Ptype;
|
||||||
if(Pump[i].Link = index)
|
|
||||||
{
|
|
||||||
*type = Pump[i].Ptype;
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return(204);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user