view +time/ExpInt.m @ 503:feebfca90080 feature/quantumTriangles

Added the new abstract classes to hypsyst3D and Upwind1D to make them work with Jonatans changes
author Ylva Rydin <ylva.rydin@telia.com>
date Tue, 16 May 2017 09:18:10 +0200
parents 2d5dea05456d
children
line wrap: on
line source

classdef ExpInt < time.Timestepper
    properties
        F
        k
        t
        v
        m
        n
    end


    methods
        % Timesteps v_t = F(v,t), using RK4 fromt t = t0 with timestep k and initial conditions v = v0
        function obj = ExpInt(F, k, t0, v0)
            obj.F = F;
            obj.k = k;
            obj.t = t0;
            obj.v = v0;
            obj.m = length(v0);
            obj.n = 0;
        end

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

        function obj = step(obj)
            [t,  res] = exp4(obj.F, [obj.t obj.t+obj.k], obj.v );
            obj.t = t(end);
            obj.v = res(end,:)';
            obj.n = obj.n + 1;
        end
    end



end