Generated Code

The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 1 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 2 entries in the constant variable array.
 */
/*
 * STATES[0] is A in component BidirectionalExampleComponent (uM).
 * STATES[1] is B in component BidirectionalExampleComponent (uM).
 * STATES[2] is C in component BidirectionalExampleComponent (uM).
 * ALGEBRAIC[0] is J in component BidirectionalExampleComponent (uM_per_s).
 * CONSTANTS[0] is kf in component BidirectionalExampleComponent (per_uM_per_s).
 * CONSTANTS[1] is kr in component BidirectionalExampleComponent (per_s).
 * VOI is t in component BidirectionalExampleComponent (second).
 * RATES[0] is d/dt A in component BidirectionalExampleComponent (uM).
 * RATES[1] is d/dt B in component BidirectionalExampleComponent (uM).
 * RATES[2] is d/dt C in component BidirectionalExampleComponent (uM).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 10;
STATES[1] = 5;
STATES[2] = 0;
CONSTANTS[0] = 0.2;
CONSTANTS[1] = 0.05;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - ALGEBRAIC[0];
resid[1] = RATES[1] - - ALGEBRAIC[0];
resid[2] = RATES[2] - ALGEBRAIC[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[0]*STATES[0]*STATES[1] -  CONSTANTS[1]*STATES[2];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}