libRoadRunner C API  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
Helper routines

Helper routines for accessing the various C API types, eg lists and arrays. More...

Functions

int getVectorLength (RRVectorPtr vector)
 Get the number of elements in a vector type. More...
 
RRVectorPtr createVector (int size)
 Create a new vector with a given size. More...
 
int getVectorElement (RRVectorPtr vector, int index, double *value)
 Get a particular element from a vector. More...
 
int setVectorElement (RRVectorPtr vector, int index, double value)
 Set a particular element in a vector. More...
 
RRDoubleMatrixPtr createRRMatrix (int r, int c)
 Create an empty matrix of size r by c. More...
 
int getMatrixNumRows (RRDoubleMatrixPtr m)
 Retrieve the number of rows in the given matrix. More...
 
int getMatrixNumCols (RRDoubleMatrixPtr m)
 Retrieve the number of columns in the given matrix. More...
 
int getMatrixElement (RRDoubleMatrixPtr m, int r, int c, double *value)
 Retrieve an element at a given row and column from a matrix type variable. More...
 
int setMatrixElement (RRDoubleMatrixPtr m, int r, int c, double value)
 Set an element at a given row and column with a given value in a matrix type variable. More...
 
int getComplexMatrixElement (RRComplexMatrixPtr m, int r, int c, RRComplexPtr value)
 Retrieve an element at a given row and column from a complex matrix type variable. More...
 
int setComplexMatrixElement (RRComplexMatrixPtr m, int r, int c, RRComplexPtr value)
 Set an element at a given row and column with a given value in a complex matrix type variable. More...
 
int getRRDataNumRows (RRCDataPtr rrData)
 Retrieve the number of rows in the given RoadRunner numerical data (returned from simulate(RRHandle handle)) More...
 
int getRRDataNumCols (RRCDataPtr rrData)
 Retrieve the number of columns in the given rrData data (returned form simulate(RRHandle handle)) More...
 
int getRRCDataElement (RRCDataPtr rrData, int r, int c, double *value)
 Retrieves an element at a given row and column from a RoadRunner data type variable. More...
 
char * getRRDataColumnLabel (RRCDataPtr rrData, int column)
 Retrieves a label for a given column in a rrData type variable. More...
 
int writeRRData (RRHandle handle, const char *fileNameAndPath)
 Writes RoadRunner data to file. More...
 
int compileSource (RRHandle handle, const char *sourceFileNameAndPath)
 Compiles source code. More...
 

Detailed Description

Helper routines for accessing the various C API types, eg lists and arrays.

Function Documentation

int compileSource ( RRHandle  handle,
const char *  sourceFileNameAndPath 
)

Compiles source code.

Parameters
handleHandle to a RRInstance
sourceFileNameAndPathPointer to string holding the file(with path) to compile
Returns
Returns a t/f indicating the result
RRDoubleMatrixPtr createRRMatrix ( int  r,
int  c 
)

Create an empty matrix of size r by c.

Matrices are indexed from zero

Example:

1 m = createRRMatrix (2, 3);
Parameters
r,cRow and column sizes
Returns
Returns NULL if fails, otherwise returns a handle to the matrix
RRVectorPtr createVector ( int  size)

Create a new vector with a given size.

Vectors are indexed from zero

Example:

1 myVector = createVector (10);
Parameters
sizeThe number of element in the new vector
Returns
Returns null if it fails, otherwise returns a pointer to the new vector
int getComplexMatrixElement ( RRComplexMatrixPtr  m,
int  r,
int  c,
RRComplexPtr  value 
)

Retrieve an element at a given row and column from a complex matrix type variable.

Matrices are indexed from zero

Example:

1 status = getComplexMatrixElement (m, 2, 4, &value);
Parameters
[in]mA pointer to a complex matrix type variable
[in]rThe row index to the matrix
[in]cThe column index to the matrix
[out]valueThe retrieved value from the matrix
Returns
Returns True if successful
int getMatrixElement ( RRDoubleMatrixPtr  m,
int  r,
int  c,
double *  value 
)

Retrieve an element at a given row and column from a matrix type variable.

Matrices are indexed from zero

Example:

1 status = getMatrixElement (m, 2, 4, &value);
Parameters
[in]mA pointer to a matrix type variable
[in]rThe row index to the matrix
[in]cThe column index to the matrix
[out]valueThe retrieved value from the matrix
Returns
Returns True if successful
int getMatrixNumCols ( RRDoubleMatrixPtr  m)

Retrieve the number of columns in the given matrix.

Matrices are indexed from zero

Example:

1 nRows = getMatrixNumCols (m);
Parameters
mA pointer to a matrix type variable
Returns
Returns -1 if fails, otherwise returns the number of columns
int getMatrixNumRows ( RRDoubleMatrixPtr  m)

Retrieve the number of rows in the given matrix.

Matrices are indexed from zero

Example:

1 nRows = getMatrixNumRows (m);
Parameters
mA pointer to a matrix type variable
Returns
Returns -1 if fails, otherwise returns the number of rows
int getRRCDataElement ( RRCDataPtr  rrData,
int  r,
int  c,
double *  value 
)

Retrieves an element at a given row and column from a RoadRunner data type variable.

RoadRunner numerical data are indexed from zero

Example:

1 status = getRRCDataElement (rrData, 2, 4, *value);
Parameters
[in]rrDataA pointer to a rrData type variable
[in]r-The row index to the rrData data
[in]c- The column index to the rrData data
[out]value- The retrieved value from the rrData data
Returns
Returns true if successful
char* getRRDataColumnLabel ( RRCDataPtr  rrData,
int  column 
)

Retrieves a label for a given column in a rrData type variable.

Result data are indexed from zero

Example:

1 str = getResultColumnLabel (rrData, 2, 4);
Parameters
[in]rrDataA pointer to a rrData type variable
[in]column- The column index for the rrData data (indexing from zero)
Returns
Returns null if fails, otherwise returns a pointer to the string column label
int getRRDataNumCols ( RRCDataPtr  rrData)

Retrieve the number of columns in the given rrData data (returned form simulate(RRHandle handle))

Example:

1 nRows = getResultNumCols (rrData);
Parameters
[in]rrDataA pointer to a rrData type variable
Returns
Returns -1 if fails, otherwise returns the number of columns
int getRRDataNumRows ( RRCDataPtr  rrData)

Retrieve the number of rows in the given RoadRunner numerical data (returned from simulate(RRHandle handle))

Example:

1 nRows = getRRDataNumRows (result);
Parameters
[in]rrDataA pointer to a RoadRunner numerical data type variable
Returns
Returns -1 if fails, otherwise returns the number of rows
int getVectorElement ( RRVectorPtr  vector,
int  index,
double *  value 
)

Get a particular element from a vector.

Vectors are indexed from zero

Example:

1 status = getVectorElement (myVector, 10, *value);
Parameters
vectorA pointer to the vector variable type
indexAn integer indicating the ith element to retrieve (indexing is from zero)
valueA pointer to the retrieved double value
Returns
Returns true if successful
int getVectorLength ( RRVectorPtr  vector)

Get the number of elements in a vector type.

Vectors are indexed from zero

Example:

1 count = getVectorLength (myVector);
Parameters
vectorA pointer to the vector variable type
Returns
Returns -1 if it fails, otherwise returns the number of elements in the vector
int setComplexMatrixElement ( RRComplexMatrixPtr  m,
int  r,
int  c,
RRComplexPtr  value 
)

Set an element at a given row and column with a given value in a complex matrix type variable.

Matrices are indexed from zero

Example:

1 status = setComplexMatrixElement (m, 2, 4, value);
Parameters
[in]mA pointer to a complex matrix type variable
[in]rThe row index to the matrix
[in]cThe column index to the matrix
[out]valueThe value to set to the complex matrix element
Returns
Returns True if successful
int setMatrixElement ( RRDoubleMatrixPtr  m,
int  r,
int  c,
double  value 
)

Set an element at a given row and column with a given value in a matrix type variable.

Matrices are indexed from zero

Example:

1 status = setMatrixElement (m, 2, 4, value);
Parameters
[in]mA pointer to a matrix type variable
[in]rThe row index to the matrix
[in]cThe column index to the matrix
[out]valueThe value to set to the matrix element
Returns
Returns True if successful
int setVectorElement ( RRVectorPtr  vector,
int  index,
double  value 
)

Set a particular element in a vector.

Vectors are indexed from zero

Example:

1 status = setVectorElement (myVector, 10, 3.1415);
Parameters
vectorA pointer to the vector variable type
indexAn integer indicating the ith element to set (indexing is from zero)
valueThe value to store in the vector at the indexth position
Returns
Returns true if successful
int writeRRData ( RRHandle  handle,
const char *  fileNameAndPath 
)

Writes RoadRunner data to file.

Parameters
handleHandle to a Roadrunner Instance
fileNameAndPathPointer to string holding the file(with path) to write data to
Returns
Returns a t/f indicating the result