classdef Rungekutta4 < time.Timestepper
    properties
        F
        dt
        t
        v
        n
    end


    methods
        % Create a time stepper for
        %   v_t = F(t,v),  v(t0) = v0
        % with step size dt.
        function obj = Rungekutta4(F, dt, t0, v0)
            obj.F = F;
            obj.dt = dt;
            obj.t = t0;
            obj.v = v0;
            obj.n = 0;
        end

        function [v,t] = getV(obj)
            v = obj.v;
            t = obj.t;
        end

        function obj = step(obj)
            obj.v = time.rk.rungekutta_4(obj.v, obj.t, obj.dt, obj.F);
            obj.t = obj.t + obj.dt;
            obj.n = obj.n + 1;
        end
    end

    methods (Static)
        function dt = getTimeStep(lambda)
            dt = rk4.get_rk4_time_step(lambda);
        end
    end
end