libroadrunner C API
Functions
Helper routines

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

Functions

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

Detailed Description

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

Function Documentation

◆ compileSource()

C_DECL_SPEC int rrcCallConv 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

◆ createRRMatrix()

C_DECL_SPEC RRDoubleMatrixPtr rrcCallConv createRRMatrix ( int  r,
int  c 
)

Create an empty matrix of size r by c.

Matrices are indexed from zero

Example:

m = createRRMatrix (2, 3);
C_DECL_SPEC RRDoubleMatrixPtr rrcCallConv createRRMatrix(int r, int c)
Create an empty matrix of size r by c.
Parameters
r,cRow and column sizes
Returns
Returns NULL if fails, otherwise returns a handle to the matrix

◆ createVector()

C_DECL_SPEC RRVectorPtr rrcCallConv createVector ( int  size)

Create a new vector with a given size.

Vectors are indexed from zero

Example:

myVector = createVector (10);
C_DECL_SPEC RRVectorPtr rrcCallConv createVector(int size)
Create a new vector with a given size.
Parameters
sizeThe number of element in the new vector
Returns
Returns null if it fails, otherwise returns a pointer to the new vector

◆ getComplexMatrixElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv getComplexMatrixElement(RRComplexMatrixPtr m, int r, int c, RRComplexPtr value)
Retrieve an element at a given row and column from a complex matrix type variable.
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

◆ getMatrixElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv getMatrixElement(RRDoubleMatrixPtr m, int r, int c, double *value)
Retrieve an element at a given row and column from a matrix type variable.
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

◆ getMatrixNumCols()

C_DECL_SPEC int rrcCallConv getMatrixNumCols ( RRDoubleMatrixPtr  m)

Retrieve the number of columns in the given matrix.

Matrices are indexed from zero

Example:

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

◆ getMatrixNumRows()

C_DECL_SPEC int rrcCallConv getMatrixNumRows ( RRDoubleMatrixPtr  m)

Retrieve the number of rows in the given matrix.

Matrices are indexed from zero

Example:

nRows = getMatrixNumRows (m);
C_DECL_SPEC int rrcCallConv getMatrixNumRows(RRDoubleMatrixPtr m)
Retrieve the number of rows in the given matrix.
Parameters
mA pointer to a matrix type variable
Returns
Returns -1 if fails, otherwise returns the number of rows

◆ getRRCDataElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv getRRCDataElement(RRCDataPtr rrData, int r, int c, double *value)
Retrieves an element at a given row and column from a RoadRunner data type variable.
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

◆ getRRDataColumnLabel()

C_DECL_SPEC char* rrcCallConv 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

◆ getRRDataNumCols()

C_DECL_SPEC int rrcCallConv getRRDataNumCols ( RRCDataPtr  rrData)

Retrieve the number of columns in the given rrData data (returned form simulate(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

◆ getRRDataNumRows()

C_DECL_SPEC int rrcCallConv getRRDataNumRows ( RRCDataPtr  rrData)

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

Example:

nRows = getRRDataNumRows (result);
C_DECL_SPEC int rrcCallConv getRRDataNumRows(RRCDataPtr rrData)
Retrieve the number of rows in the given RoadRunner numerical data (returned from simulate(RRHandle h...
Parameters
[in]rrDataA pointer to a RoadRunner numerical data type variable
Returns
Returns -1 if fails, otherwise returns the number of rows

◆ getVectorElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv getVectorElement(RRVectorPtr vector, int index, double *value)
Get a particular element from a vector.
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

◆ getVectorLength()

C_DECL_SPEC int rrcCallConv getVectorLength ( RRVectorPtr  vector)

Get the number of elements in a vector type.

Vectors are indexed from zero

Example:

count = getVectorLength (myVector);
C_DECL_SPEC int rrcCallConv getVectorLength(RRVectorPtr vector)
Get the number of elements in a vector type.
Parameters
vectorA pointer to the vector variable type
Returns
Returns -1 if it fails, otherwise returns the number of elements in the vector

◆ setComplexMatrixElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv 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.
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

◆ setMatrixElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv 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.
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

◆ setVectorElement()

C_DECL_SPEC int rrcCallConv 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);
C_DECL_SPEC int rrcCallConv setVectorElement(RRVectorPtr vector, int index, double value)
Set a particular element in a vector.
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

◆ writeRRData()

C_DECL_SPEC int rrcCallConv 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