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

Helper routines for acessing 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...
 
bool getVectorElement (RRVectorPtr vector, int index, double *value)
 Get a particular element from a vector. More...
 
bool 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...
 
bool getMatrixElement (RRDoubleMatrixPtr m, int r, int c, double *value)
 Retrieve an element at a given row and column from a matrix type variable. More...
 
bool 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...
 
bool 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...
 
bool 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...
 
RRCDataPtr createRRCData (RRDataHandle rrData)
 Create a RoadRunner C data structure (RRCDataPtr) from RoadRunner data. More...
 
int getRRDataNumRows (RRCDataPtr rrData)
 Retrieve the number of rows in the given RoadRunner numberical data (returned from simulate(RRHandle handle)) More...
 
int getRRDataNumCols (RRCDataPtr rrData)
 Retrieve the number of columns in the given rrData data (returned form simulat(RRHandle handle)) More...
 
bool 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...
 
bool writeRRData (RRHandle handle, const char *fileNameAndPath)
 Writes RoadRunner data to file. More...
 
bool compileSource (RRHandle handle, const char *sourceFileNameAndPath)
 Compiles source code. More...
 

Detailed Description

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

Function Documentation

bool 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
Returna a boolean indicating the result
RRCDataPtr createRRCData ( RRDataHandle  rrData)

Create a RoadRunner C data structure (RRCDataPtr) from RoadRunner data.

Parameters
[in]rrDataA pointer to a RoadRunner numerical data type variable
Returns
Returns NULL if fails, otherwise returns a RRCData handle
RRDoubleMatrixPtr createRRMatrix ( int  r,
int  c 
)

Create an empty matrix of size r by c.

Matrices are indexed from zero

Example:

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:

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
bool 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:

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 succesful
bool 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:

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 succesful
int getMatrixNumCols ( RRDoubleMatrixPtr  m)

Retrieve the number of columns in the given matrix.

Matrices are indexed from zero

Example:

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:

nRows = getMatrixNumRows (m);
Parameters
mA pointer to a matrix type variable
Returns
Returns -1 if fails, otherwise returns the number of rows
bool 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:

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 succesful
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:

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 simulat(RRHandle handle))

Example:

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 numberical data (returned from simulate(RRHandle handle))

Example:

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
bool getVectorElement ( RRVectorPtr  vector,
int  index,
double *  value 
)

Get a particular element from a vector.

Vectors are indexed from zero

Example:

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 succesful
int getVectorLength ( RRVectorPtr  vector)

Get the number of elements in a vector type.

Vectors are indexed from zero

Example:

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
bool 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:

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 succesful
bool 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:

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 succesful
bool setVectorElement ( RRVectorPtr  vector,
int  index,
double  value 
)

Set a particular element in a vector.

Vectors are indexed from zero

Example:

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 succesful
bool 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
Returna a boolean indicating the result