roadrunner  2.6.0
Fast simulator for SBML models
Functions
Library initialization and termination methods

Initialize library and terminate library instance. More...

Functions

C_DECL_SPEC RRHandle rrcCallConv createRRInstance (void)
 Initialize a new roadRunner instance and return a handle to it. More...
 
C_DECL_SPEC RRHandle rrcCallConv createRRInstanceEx (const char *tempFolder, const char *compiler)
 Initialize a new roadRunner instance and return a handle to it. More...
 
C_DECL_SPEC bool rrcCallConv freeRRInstance (RRHandle handle)
 Free the roadRunner instance. More...
 
char * getInstallFolder (void)
 Returns the folder in which the RoadRunner wrappers is installed. More...
 
C_DECL_SPEC bool rrcCallConv setInstallFolder (const char *folder)
 Set the internal string containing the folder in where the RoadRunner C wrappers is installed. More...
 
C_DECL_SPEC bool rrcCallConv setComputeAndAssignConservationLaws (RRHandle handle, const bool On_Or_Off)
 Enable or disable conservation analysis. More...
 
C_DECL_SPEC int rrcCallConv getComputeAndAssignConservationLaws (RRHandle handle, int *value)
 Get the value of the moiety conservation setting. More...
 

Detailed Description

Initialize library and terminate library instance.

RoadRunner C wrappers Library

Introduction

RoadRunner is a SBML compliant high performance and portable simulation engine for systems and synthetic biology. To run a simple SBML model and generate time series data we would write the following code:

#undef __cplusplus
#define STATIC_RRC
#include <stdio.h>
#include <stdlib.h>
#include "rrc_api.h"
#include "rrc_types.h"
#include "rrc_utilities.h"
int main (int argc, char *argv[]) {
RRHandle rrHandle;
RRCDataPtr result;
printf ("Starting Test Program %s\n", argv[0]);
rrHandle = createRRInstance();
if (!loadSBMLFromFile (rrHandle, "feedback.xml")) {
printf ("Failed to load model: %s\n", getLastError ());
getchar ();
exit (0);
}
result = simulateEx (rrHandle, 0, 10, 100);
printf (rrDataToString (result));
freeRRCData(result);
getchar ();
exit (0);
}
C_DECL_SPEC char *rrcCallConv getLastError(void)
Retrieve the current error string.
C_DECL_SPEC int rrcCallConv freeRRCData(RRCDataPtr handle)
Free the memory associated to a RRCData object.
C_DECL_SPEC RRHandle rrcCallConv createRRInstance(void)
Initialize a new roadRunner instance and return a handle to it.
C_DECL_SPEC bool rrcCallConv loadSBMLFromFile(RRHandle handle, const char *fileName)
Load a model from a SBML file.
C_DECL_SPEC RRCDataPtr rrcCallConv simulateEx(RRHandle handle, const double timeStart, const double timeEnd, const int numberOfPoints)
Carry out a time-course simulation based on the given arguments, time start, time end and number of p...
libRoadRunner C wrappers 2012-2013
roadRunner C wrappers 2012
void * RRHandle
Void pointer to a RoadRunner instance.
Definition: rrc_types.h:50
roadRunner C wrappers 2012
Structure for the result type from the simulate calls. The client is responsible for freeing the RRCD...
Definition: rrc_types.h:111

More complex example, using C wrappers:

#undef __cplusplus
#define STATIC_RRC
#include <stdio.h>
#include <stdlib.h>
#include "rrc_api.h"
#include "rrc_types.h"
#include "rrc_utilities.h"
int main (int argc, char *argv[]) {
RRHandle rrHandle;
RRCDataPtr result;
int index;
int col;
int row;
printf ("Starting Test Program %s\n", argv[0]);
rrHandle = createRRInstance();
if (!loadSBML (rrHandle, "feedback.xml")) {
printf ("Error while loading SBML file\n");
printf ("Error message: %s\n", getLastError());
getchar ();
exit (0);
}
result = simulateEx (rrHandle, 0, 10, 10); // start time, end time, and number of points
index = 0;
// Print out column headers... typically time and species.
for (col = 0; col < result->CSize; col++)
{
printf ("%10s", result->ColumnHeaders[index++]);
if (col < result->CSize - 1)
{
printf ("\t");
}
}
printf ("\n");
index = 0;
// Print out the data
for (row = 0; row < result->RSize; row++)
{
for (col = 0; col < result->CSize; col++)
{
printf ("%10f", result->Data[index++]);
if (col < result->CSize -1)
{
printf ("\t");
}
}
printf ("\n");
}
//Cleanup
freeRRCData (result);
freeRRInstance (rrHandle);
getchar ();
exit (0);
C_DECL_SPEC bool rrcCallConv freeRRInstance(RRHandle handle)
Free the roadRunner instance.
C_DECL_SPEC bool rrcCallConv loadSBML(RRHandle handle, const char *sbml)
Load a model from an SBML string.
double * Data
Definition: rrc_types.h:114
char ** ColumnHeaders
Definition: rrc_types.h:116
int CSize
Definition: rrc_types.h:113
int RSize
Definition: rrc_types.h:112

Would create output as shown below:

Starting Test Program: <File path Here>
Notice: Creating C based model generator using ..\compilers\tcc\tcc.exe compiler.
time [S1] [S2] [S3] [S4]
0.000000 0.000000 0.000000 0.000000 0.000000
1.111111 3.295975 1.677255 1.121418 1.074708
2.222222 0.971810 1.658970 1.841065 2.192728
3.333333 0.137340 0.501854 1.295138 2.444883
4.444445 0.141470 0.200937 0.549172 1.505662
5.555556 1.831017 1.317792 1.129982 1.351300
6.666667 0.306310 0.775477 1.304950 1.952076
7.777778 0.193459 0.268986 0.628542 1.483161
8.888889 1.566864 1.219950 1.105718 1.370199
10.000000 0.269437 0.678127 1.199353 1.868247

Note that if you are using a C++ compiler, you'll need to change the #include lines of both above programs to:

#include <stdio.h>
#include <stdlib.h>
#include "rrc_api.h"
#include "rrc_types.h"
#include "rrc_utilities.h"
using namespace rrc;

Installation

Installation documentation is provided at libRoadRunner.org.

License

Copyright (C) 2012 University of Washington, Seattle, WA, USA

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

In plain english this means:

You CAN freely download and use this software, in whole or in part, for personal, company internal, or commercial purposes;

You CAN use the software in packages or distributions that you create.

You SHOULD include a copy of the license in any redistribution you may make;

You are NOT required include the source of software, or of any modifications you may have made to it, in any redistribution you may assemble that includes it.

YOU CANNOT:

redistribute any piece of this software without proper attribution;

Function Documentation

◆ createRRInstance()

C_DECL_SPEC RRHandle rrcCallConv createRRInstance ( void  )

Initialize a new roadRunner instance and return a handle to it.

Returns
Returns a RoadRunner instance, returns null if it fails

◆ createRRInstanceEx()

C_DECL_SPEC RRHandle rrcCallConv createRRInstanceEx ( const char *  tempFolder,
const char *  compiler 
)

Initialize a new roadRunner instance and return a handle to it.

Parameters
[in]tempFolderset roadrunners temporary folder
[in]compilermay be NULL, if NULL, uses default compiler. If LLVM build is enabled, setting compiler to "llvm" enables llvm based model generation.
Returns
Returns a RoadRunner instance, returns null if it fails

◆ freeRRInstance()

C_DECL_SPEC bool rrcCallConv freeRRInstance ( RRHandle  handle)

Free the roadRunner instance.

Parameters
[in]handleHandle to a RoadRunner instance

◆ getComputeAndAssignConservationLaws()

C_DECL_SPEC int rrcCallConv getComputeAndAssignConservationLaws ( RRHandle  handle,
int *  value 
)

Get the value of the moiety conservation setting.

Parameters
[in]handleHandle to a RoadRunner instance
[out]valueA place to store the value
Returns
Returns true if successful

◆ getInstallFolder()

char* getInstallFolder ( void  )

Returns the folder in which the RoadRunner wrappers is installed.

Returns
Pointer to string holding the install folder

◆ setComputeAndAssignConservationLaws()

C_DECL_SPEC bool rrcCallConv setComputeAndAssignConservationLaws ( RRHandle  handle,
const bool  On_Or_Off 
)

Enable or disable conservation analysis.

Parameters
[in]handleHandle to a RoadRunner instance
[in]On_Or_OffSet true to switch on conservation analysis
Returns
Returns true if successful

◆ setInstallFolder()

C_DECL_SPEC bool rrcCallConv setInstallFolder ( const char *  folder)

Set the internal string containing the folder in where the RoadRunner C wrappers is installed.

Parameters
[in]folderPointer to string holding the install folder
Returns
Boolean indicating success