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 2 entries in the algebraic variable array.
There are a total of 4 entries in each of the rate and state variable arrays.
There are a total of 12 entries in the constant variable array.
*/
/*
* CONSTANTS[0] is n1_initial in component component (dimensionless).
* CONSTANTS[1] is d1_initial in component component (dimensionless).
* CONSTANTS[2] is n2_initial in component component (dimensionless).
* CONSTANTS[3] is d2_initial in component component (dimensionless).
* STATES[0] is n in component component (dimensionless).
* STATES[1] is d in component component (dimensionless).
* STATES[2] is n in component component (dimensionless).
* STATES[3] is d in component component (dimensionless).
* ALGEBRAIC[0] is cell_1_neighbourhood_d_average in component component (dimensionless).
* ALGEBRAIC[1] is cell_2_neighbourhood_d_average in component component (dimensionless).
* CONSTANTS[4] is start_boundary_d in component component (dimensionless).
* CONSTANTS[5] is a in component component (dimensionless).
* CONSTANTS[6] is b in component component (dimensionless).
* CONSTANTS[7] is v in component component (dimensionless).
* CONSTANTS[8] is k in component component (dimensionless).
* CONSTANTS[9] is h in component component (dimensionless).
* VOI is time in component component (dimensionless).
* CONSTANTS[10] is start_boundary_d in component component (dimensionless).
* CONSTANTS[11] is end_boundary_d in component component (dimensionless).
* RATES[0] is d/dt n in component component (dimensionless).
* RATES[1] is d/dt d in component component (dimensionless).
* RATES[2] is d/dt n in component component (dimensionless).
* RATES[3] is d/dt d in component component (dimensionless).
* There are a total of 0 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1.0;
CONSTANTS[1] = 1.0;
CONSTANTS[2] = 0.99;
CONSTANTS[3] = 0.99;
CONSTANTS[4] = 0.0;
CONSTANTS[5] = 0.01;
CONSTANTS[6] = 100;
CONSTANTS[7] = 1;
CONSTANTS[8] = 2;
CONSTANTS[9] = 2;
CONSTANTS[10] = 0.0;
CONSTANTS[11] = 0.0;
STATES[0] = CONSTANTS[0];
STATES[1] = CONSTANTS[1];
STATES[2] = CONSTANTS[2];
STATES[3] = CONSTANTS[3];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - pow(ALGEBRAIC[0], CONSTANTS[8])/(CONSTANTS[5]+pow(ALGEBRAIC[0], CONSTANTS[8])) - STATES[0];
resid[1] = RATES[1] - CONSTANTS[7]*(1.00000/(1.00000+ CONSTANTS[6]*pow(STATES[0], CONSTANTS[9])) - STATES[1]);
resid[2] = RATES[2] - pow(ALGEBRAIC[1], CONSTANTS[8])/(CONSTANTS[5]+pow(ALGEBRAIC[1], CONSTANTS[8])) - STATES[2];
resid[3] = RATES[3] - CONSTANTS[7]*(1.00000/(1.00000+ CONSTANTS[6]*pow(STATES[2], CONSTANTS[9])) - STATES[3]);
}
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] = (STATES[3]+CONSTANTS[4])*0.500000;
ALGEBRAIC[1] = (STATES[1]+CONSTANTS[11])*0.500000;
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}
