comparison +time/Rungekutta.m @ 932:3860dad28239 feature/timesteppers

Remove unnecessary(?) arguments in Rungekutta.scheme.
author Martin Almquist <malmquist@stanford.edu>
date Mon, 03 Dec 2018 16:33:27 -0800
parents 384ca2331a12
children 34b3d092a4d0
comparison
equal deleted inserted replaced
931:384ca2331a12 932:3860dad28239
31 31
32 if isempty(discreteData) 32 if isempty(discreteData)
33 % TODO: method "rk4" is also implemented in the butcher tableau, but the rungekutta_4.m implementation 33 % TODO: method "rk4" is also implemented in the butcher tableau, but the rungekutta_4.m implementation
34 % might be slightly more efficient. Need to do some profiling before deciding whether or not to keep it. 34 % might be slightly more efficient. Need to do some profiling before deciding whether or not to keep it.
35 if (method == "rk4") 35 if (method == "rk4")
36 obj.scheme = @(v,t,dt,F,n) time.rk.rungekutta_4(v ,t, dt, F); 36 obj.scheme = @(v,t,n) time.rk.rungekutta_4(v ,t, dt, F);
37 else 37 else
38 obj.scheme = @(v,t,dt,F,n) time.rk.rungekutta(v, t, dt, F, obj.coeffs); 38 obj.scheme = @(v,t,n) time.rk.rungekutta(v, t, dt, F, obj.coeffs);
39 end 39 end
40 else 40 else
41 obj.scheme = @(v,t,dt,F,n) time.rk.rungekuttaDiscreteData(v, t, dt, F, obj.coeffs, discreteData, n); 41 obj.scheme = @(v,t,n) time.rk.rungekuttaDiscreteData(v, t, dt, F, obj.coeffs, discreteData, n);
42 end 42 end
43 end 43 end
44 44
45 % v: Current solution 45 % v: Current solution
46 % t: Current time 46 % t: Current time
54 K = obj.K; 54 K = obj.K;
55 T = obj.t + obj.dt*obj.coeffs.b; 55 T = obj.t + obj.dt*obj.coeffs.b;
56 end 56 end
57 57
58 function obj = step(obj) 58 function obj = step(obj)
59 [obj.v, obj.V, obj.K] = obj.scheme(obj.v, obj.t, obj.dt, obj.F, obj.n); 59 [obj.v, obj.V, obj.K] = obj.scheme(obj.v, obj.t, obj.n);
60 obj.t = obj.t + obj.dt; 60 obj.t = obj.t + obj.dt;
61 obj.n = obj.n + 1; 61 obj.n = obj.n + 1;
62 end 62 end
63 end 63 end
64 end 64 end