# Generated Code

The following is c 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 1 entries in each of the rate and state variable arrays. There are a total of 6 entries in the constant variable array. */ /* * VOI is x in component main (dimensionless). * ALGEBRAIC[0] is sin1 in component main (dimensionless). * STATES[0] is sin2 in component main (dimensionless). * ALGEBRAIC[2] is sin3 in component main (dimensionless). * CONSTANTS[1] is k2_oPi in component main (dimensionless). * CONSTANTS[2] is k2Pi in component main (dimensionless). * CONSTANTS[3] is kPi_2 in component main (dimensionless). * CONSTANTS[4] is kPi in component main (dimensionless). * CONSTANTS[5] is kPi_32 in component main (dimensionless). * ALGEBRAIC[1] is z in component main (dimensionless). * CONSTANTS[0] is C in component main (dimensionless). * RATES[0] is d/dt sin2 in component main (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0; CONSTANTS[0] = 0.75; CONSTANTS[1] = 2.00000/ 3.14159265358979; CONSTANTS[2] = 2.00000* 3.14159265358979; CONSTANTS[3] = 3.14159265358979/2.00000; CONSTANTS[4] = 3.14159265358979; CONSTANTS[5] = ( 3.00000* 3.14159265358979)/2.00000; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[0] = cos(VOI); } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = sin(VOI); ALGEBRAIC[1] = (VOI<CONSTANTS[3] ? VOI*CONSTANTS[1] - 0.500000 : VOI<CONSTANTS[4] ? ( 3.14159265358979 - VOI)*CONSTANTS[1] - 0.500000 : VOI<CONSTANTS[5] ? (VOI - 3.14159265358979)*CONSTANTS[1] - 0.500000 : (CONSTANTS[2] - VOI)*CONSTANTS[1] - 0.500000); ALGEBRAIC[2] = (VOI<CONSTANTS[3] ? - ( ALGEBRAIC[1]*ALGEBRAIC[1])+CONSTANTS[0]+ALGEBRAIC[1] : VOI<CONSTANTS[4] ? - ( ALGEBRAIC[1]*ALGEBRAIC[1])+CONSTANTS[0]+ALGEBRAIC[1] : VOI<CONSTANTS[5] ? ( ALGEBRAIC[1]*ALGEBRAIC[1] - CONSTANTS[0]) - ALGEBRAIC[1] : ( ALGEBRAIC[1]*ALGEBRAIC[1] - CONSTANTS[0]) - ALGEBRAIC[1]); }