added getcurve function

This commit is contained in:
Sam Hatchett
2013-01-08 12:16:34 -05:00
parent e3615b9244
commit 566eb53eb4
3 changed files with 38 additions and 1 deletions

View File

@@ -229,7 +229,9 @@ extern "C" {
int DLLEXPORT ENgetlinktype(int, int *);
int DLLEXPORT ENgetlinknodes(int, int *, int *);
int DLLEXPORT ENgetlinkvalue(int, int, float *);
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues);
int DLLEXPORT ENgetversion(int *);
int DLLEXPORT ENsetcontrol(int, int, int, float, int, float);

View File

@@ -1714,6 +1714,39 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, float *value)
}
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues) // !sph
/*----------------------------------------------------------------
** Input: curveIndex = curve index
** Output: *nValues = number of points on curve
** *xValues = values for x
** *yValues = values for y
** Returns: error code
** Purpose: retrieves end nodes of a specific link
**----------------------------------------------------------------
*/
{
int err = 0;
Scurve curve = Curve[curveIndex];
int nPoints = curve.Npts;
float *pointX = calloc(nPoints, sizeof(float));
float *pointY = calloc(nPoints, sizeof(float));
for (int iPoint = 0; iPoint < nPoints; iPoint++) {
double x = curve.X[iPoint] * Ucf[LENGTH];
double y = curve.Y[iPoint] * Ucf[VOLUME];
pointX[iPoint] = (float)x;
pointY[iPoint] = (float)y;
}
*nValues = nPoints;
*xValues = pointX;
*yValues = pointY;
return err;
}
/*
----------------------------------------------------------------
Functions for changing network data

View File

@@ -221,6 +221,8 @@ extern "C" {
int DLLEXPORT ENgetlinktype(int, int *);
int DLLEXPORT ENgetlinknodes(int, int *, int *);
int DLLEXPORT ENgetlinkvalue(int, int, float *);
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues);
int DLLEXPORT ENgetversion(int *);