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 3 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 7 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (day).
 * CONSTANTS[0] is lambda in component model_parameters (cells_per_ml).
 * CONSTANTS[1] is delta_1 in component model_parameters (cells_per_day).
 * CONSTANTS[2] is delta in component model_parameters (cells_per_day).
 * CONSTANTS[3] is np in component model_parameters (dimensionless).
 * CONSTANTS[4] is c in component model_parameters (virons_per_day).
 * CONSTANTS[5] is k in component model_parameters (ml_per_virons_per_day).
 * CONSTANTS[6] is N in component model_parameters (virons_per_cell).
 * STATES[0] is T in component uninfected_T_cells (cells_per_ml).
 * STATES[1] is VI in component infectious_virus (virons_per_ml).
 * STATES[2] is T_star in component infected_T_cells (cells_per_ml).
 * ALGEBRAIC[0] is log_VI in component infectious_virus (dimensionless).
 * STATES[3] is VNI in component non_infectious_virus (virons_per_ml).
 * ALGEBRAIC[1] is virus_total in component total_virus (virons_per_ml).
 * ALGEBRAIC[2] is log_virus_total in component total_virus (dimensionless).
 * RATES[0] is d/dt T in component uninfected_T_cells (cells_per_ml).
 * RATES[2] is d/dt T_star in component infected_T_cells (cells_per_ml).
 * RATES[1] is d/dt VI in component infectious_virus (virons_per_ml).
 * RATES[3] is d/dt VNI in component non_infectious_virus (virons_per_ml).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 5.0;
CONSTANTS[1] = 0.03;
CONSTANTS[2] = 0.5;
CONSTANTS[3] = 1.0;
CONSTANTS[4] = 3;
CONSTANTS[5] = 3.43e-5;
CONSTANTS[6] = 480;
STATES[0] = 180.0;
STATES[1] = 134e3;
STATES[2] = 3.6;
STATES[3] = 0;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 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] - ( CONSTANTS[0]*1.00000 - ( CONSTANTS[1]*STATES[0])/1.00000) -  CONSTANTS[5]*STATES[1]*STATES[0];
resid[1] = RATES[2] -  CONSTANTS[5]*STATES[1]*STATES[0] -  (CONSTANTS[2]/1.00000)*STATES[2];
resid[2] = RATES[1] - ( (1.00000 - CONSTANTS[3])*CONSTANTS[6]*CONSTANTS[2]*STATES[2])/1.00000 - ( CONSTANTS[4]*STATES[1])/1.00000;
resid[3] = RATES[3] - ( CONSTANTS[3]*CONSTANTS[6]*CONSTANTS[2]*STATES[2])/1.00000 - ( CONSTANTS[4]*STATES[3])/1.00000;
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = arbitrary_log(STATES[1]/1.00000, 10);
ALGEBRAIC[1] = STATES[1]+STATES[3];
ALGEBRAIC[2] = arbitrary_log(ALGEBRAIC[1]/1.00000, 10);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
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)
{
}