EPANET
Functions
Data Curve Functions

These functions are used for working with data curves. More...

Functions

int DLLEXPORT EN_addcurve (EN_Project ph, const char *id)
 Adds a new data curve to a project. More...
 
int DLLEXPORT EN_deletecurve (EN_Project ph, int index)
 Deletes a data curve from a project. More...
 
int DLLEXPORT EN_getcurveindex (EN_Project ph, const char *id, int *out_index)
 Retrieves the index of a curve given its ID name. More...
 
int DLLEXPORT EN_getcurveid (EN_Project ph, int index, char *out_id)
 Retrieves the ID name of a curve given its index. More...
 
int DLLEXPORT EN_setcurveid (EN_Project ph, int index, const char *id)
 Changes the ID name of a data curve given its index. More...
 
int DLLEXPORT EN_getcurvelen (EN_Project ph, int index, int *out_len)
 Retrieves the number of points in a curve. More...
 
int DLLEXPORT EN_getcurvetype (EN_Project ph, int index, int *out_type)
 Retrieves a curve's type. More...
 
int DLLEXPORT EN_setcurvetype (EN_Project ph, int index, int type)
 Sets a curve's type. More...
 
int DLLEXPORT EN_getcurvevalue (EN_Project ph, int curveIndex, int pointIndex, double *out_x, double *out_y)
 Retrieves the value of a single data point for a curve. More...
 
int DLLEXPORT EN_setcurvevalue (EN_Project ph, int curveIndex, int pointIndex, double x, double y)
 Sets the value of a single data point for a curve. More...
 
int DLLEXPORT EN_getcurve (EN_Project ph, int index, char *out_id, int *out_nPoints, double *out_xValues, double *out_yValues)
 Retrieves all of a curve's data. More...
 
int DLLEXPORT EN_setcurve (EN_Project ph, int index, double *xValues, double *yValues, int nPoints)
 assigns a set of data points to a curve. More...
 

Detailed Description

These functions are used for working with data curves.

Function Documentation

◆ EN_addcurve()

int EN_addcurve ( EN_Project  ph,
const char *  id 
)

Adds a new data curve to a project.

Parameters
phan EPANET project handle.
idThe ID name of the curve to be added.
Returns
an error code.

The new curve contains a single data point (1.0, 1.0).

◆ EN_deletecurve()

int EN_deletecurve ( EN_Project  ph,
int  index 
)

Deletes a data curve from a project.

Parameters
phan EPANET project handle.
indexthe data curve's index (starting from 1).
Returns
an error code.

◆ EN_getcurve()

int EN_getcurve ( EN_Project  ph,
int  index,
char *  out_id,
int *  out_nPoints,
double *  out_xValues,
double *  out_yValues 
)

Retrieves all of a curve's data.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]out_idthe curve's ID name.
[out]out_nPointsthe number of data points on the curve.
[out]out_xValuesthe curve's x-values.
[out]out_yValuesthe curve's y-values.
Returns
an error code.

The calling program is responsible for making out_xValues and out_yValues large enough to hold out_nPoints number of data points and for sizing out_id to hold at least EN_MAXID+1 characters.

◆ EN_getcurveid()

int EN_getcurveid ( EN_Project  ph,
int  index,
char *  out_id 
)

Retrieves the ID name of a curve given its index.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]out_idthe curve's ID name.
Returns
an error code.

The ID name must be sized to hold at least EN_MAXID+1 characters.

◆ EN_getcurveindex()

int EN_getcurveindex ( EN_Project  ph,
const char *  id,
int *  out_index 
)

Retrieves the index of a curve given its ID name.

Parameters
phan EPANET project handle.
idthe ID name of a curve.
[out]out_indexThe curve's index (starting from 1).
Returns
an error code.

◆ EN_getcurvelen()

int EN_getcurvelen ( EN_Project  ph,
int  index,
int *  out_len 
)

Retrieves the number of points in a curve.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]out_lenThe number of data points assigned to the curve.
Returns
an error code.

◆ EN_getcurvetype()

int EN_getcurvetype ( EN_Project  ph,
int  index,
int *  out_type 
)

Retrieves a curve's type.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
[out]out_typethe curve's type (see EN_CurveType).
Returns
an error code.

◆ EN_getcurvevalue()

int EN_getcurvevalue ( EN_Project  ph,
int  curveIndex,
int  pointIndex,
double *  out_x,
double *  out_y 
)

Retrieves the value of a single data point for a curve.

Parameters
phan EPANET project handle.
curveIndexa curve's index (starting from 1).
pointIndexthe index of a point on the curve (starting from 1).
[out]out_xthe point's x-value.
[out]out_ythe point's y-value.
Returns
an error code.

◆ EN_setcurve()

int EN_setcurve ( EN_Project  ph,
int  index,
double *  xValues,
double *  yValues,
int  nPoints 
)

assigns a set of data points to a curve.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
xValuesan array of new x-values for the curve.
yValuesan array of new y-values for the curve.
nPointsthe new number of data points for the curve.
Returns
an error code.

xValues and yValues are zero-based arrays that contains nPoints elements.

Use this function to redefine (and resize) a curve all at once; use EN_setcurvevalue to revise a curve's data points one at a time.

◆ EN_setcurveid()

int EN_setcurveid ( EN_Project  ph,
int  index,
const char *  id 
)

Changes the ID name of a data curve given its index.

Parameters
phan EPANET project handle.
indexa data curve index (starting from 1).
idthe data curve's new ID name.
Returns
an error code.

The new ID name must not exceed EN_MAXID characters.

◆ EN_setcurvetype()

int EN_setcurvetype ( EN_Project  ph,
int  index,
int  type 
)

Sets a curve's type.

Parameters
phan EPANET project handle.
indexa curve's index (starting from 1).
typethe curve's type (see EN_CurveType).
Returns
an error code.

◆ EN_setcurvevalue()

int EN_setcurvevalue ( EN_Project  ph,
int  curveIndex,
int  pointIndex,
double  x,
double  y 
)

Sets the value of a single data point for a curve.

Parameters
phan EPANET project handle.
curveIndexa curve's index (starting from 1).
pointIndexthe index of a point on the curve (starting from 1).
xthe point's new x-value.
ythe point's new y-value.
Returns
an error code.