comparison +time/Rungekutta4.m @ 816:b5e5b195da1e feature/timesteppers

Add getState to timesteppers, returning the relevant state of the timestepper - Add getState which returns the 'state' of the specialized timestepper.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 10 Sep 2018 16:19:16 +0200
parents ef5c9870f386
children 50d5a3843099
comparison
equal deleted inserted replaced
580:2ce903f28193 816:b5e5b195da1e
36 function [v,t] = getV(obj) 36 function [v,t] = getV(obj)
37 v = obj.v; 37 v = obj.v;
38 t = obj.t; 38 t = obj.t;
39 end 39 end
40 40
41 function state = getState(obj)
42 state = struct('v', obj.v, 't', obj.t, 'k', obj.k);
43 end
44
41 function obj = step(obj) 45 function obj = step(obj)
42 obj.v = time.rk4.rungekutta_4(obj.v, obj.t, obj.k, obj.F); 46 obj.v = time.rk4.rungekutta_4(obj.v, obj.t, obj.k, obj.F);
43 obj.t = obj.t + obj.k; 47 obj.t = obj.t + obj.k;
44 obj.n = obj.n + 1; 48 obj.n = obj.n + 1;
45 end 49 end