One option is to use classes that divide the solution of the ODE in its logical parts. For instance, one could argue that a setup part, followed by a time stepper, and finalized with some post checks sould work well. Another option would be to use a class that would calculate the complete solution of the ODEs over a given time interval.
The classes and objects are defined via the c++ syntax.
The Harmonic Oscillator (HO) is used as the basic skeleton code from which the solution of other set of ODEs can be derived.
The classes are:
The properties of the Step and PostCheck classes are received from the Setup class via inheritance. Look at the C++ syntax to do this in the codes.
In addition, the main program, HO.cpp , organizes the flow of operations in the time dependent solution. In particular the loop over the time intervals is done in the main program.
The HO codes can be foundin: Standard codes in tar format