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 0 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 3 entries in the constant variable array.
 */
/*
 * VOI is t in component DampedForcedHarmonicOscillator (dimensionless).
 * STATES[0] is u in component DampedForcedHarmonicOscillator (dimensionless).
 * STATES[1] is v in component DampedForcedHarmonicOscillator (dimensionless).
 * CONSTANTS[0] is c in component DampedForcedHarmonicOscillator (dimensionless).
 * CONSTANTS[1] is a in component DampedForcedHarmonicOscillator (dimensionless).
 * CONSTANTS[2] is b in component DampedForcedHarmonicOscillator (dimensionless).
 * RATES[0] is d/dt u in component DampedForcedHarmonicOscillator (dimensionless).
 * RATES[1] is d/dt v in component DampedForcedHarmonicOscillator (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 1;
STATES[1] = 1;
CONSTANTS[0] = 1.00000;
CONSTANTS[1] = 1.00000;
CONSTANTS[2] = 1.00000;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - STATES[1];
resid[1] = RATES[1] - (CONSTANTS[0] -  2.00000*CONSTANTS[1]*STATES[1]) -  CONSTANTS[2]*STATES[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)
{
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}