comparison +time/Rungekutta4proper.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 910a05dcdfdf
children 8894e9c49e40
comparison
equal deleted inserted replaced
580:2ce903f28193 816:b5e5b195da1e
16 obj.t = t0; 16 obj.t = t0;
17 obj.v = v0; 17 obj.v = v0;
18 obj.m = length(v0); 18 obj.m = length(v0);
19 obj.n = 0; 19 obj.n = 0;
20 end 20 end
21
22 function [v, t] = getV(obj)
23 v = obj.v;
24 t = obj.t
21 25
22 function [v,t] = getV(obj) 26 end
23 v = obj.v; 27
24 t = obj.t; 28 function state = getState(obj)
29 state = struct('v', obj.v, 't', obj.t, 'k', obj.k);
25 end 30 end
26 31
27 function obj = step(obj) 32 function obj = step(obj)
28 obj.v = time.rk4.rungekutta_4(obj.v, obj.t, obj.k, obj.F); 33 obj.v = time.rk4.rungekutta_4(obj.v, obj.t, obj.k, obj.F);
29 obj.t = obj.t + obj.k; 34 obj.t = obj.t + obj.k;