Index

C++ Code Documentation

template <class A, class B> math::RungeKutta

File: BASE/math/RungeKutta.H

Runge-Kutta integrator template. Computes by fourth-order Runge-Kutta methods a solution to a first-order system of ordinary differential equations of the form dY/dx = F(x, Y) x is of type A (base type) Y is of type B (typically an A, a vector of A's, or a matrix of A's) type B must support vector-space operations Example:
#include "RungeKutta.H"

class RungeKuttaSubclass
: public math::RungeKutta, std::complex >
{
void function( std::complex &w,
std::complex const &z,
std::complex const & )
{ w = z*z; }
};

main()
{
RungeKuttaSubclass integrator;

std::complex x0 = 1;
std::complex x1 = 2;
uint steps = 100;
std::complex y = 0.0; // compute() adds to y

integrator.compute( y, x0, x1, steps );
std::cout << y << std::endl;
}


public:
  • RungeKutta();
    void constructor
  • virtual ~RungeKutta();
    destructor
  • void compute( B &Y, A const &x1, A const &x2, uint count );
    perform the integration along straight line from x1 to x2 in count steps, starting with Y. output in Y.
protected:
  • virtual void function( B &, A const &, B const & ) = 0;
    function to integrate (pure virtual)
private:
  • RungeKutta( RungeKutta const & );
    disabled (private) copy constructor
  • RungeKutta &operator=( RungeKutta const & );
    disabled (private) assignment operator


template <class A, class B> math::RungeKutta GANG