Mercurial > repos > public > sbplib
comparison +time/Rungekutta.m @ 984:0585a2ee7ee7 feature/timesteppers
Inline the rk.rungekutta_4 function.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 08 Jan 2019 12:19:33 +0100 |
parents | 34b3d092a4d0 |
children | a32856fc2ad2 |
comparison
equal
deleted
inserted
replaced
983:b89379fb0814 | 984:0585a2ee7ee7 |
---|---|
28 % used for the RK updates from the Butcher tableua. | 28 % used for the RK updates from the Butcher tableua. |
29 [s,a,b,c] = time.rk.butcherTableau(method); | 29 [s,a,b,c] = time.rk.butcherTableau(method); |
30 obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); | 30 obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); |
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 obj.scheme = @(v,t,n) time.rk.rungekutta(v, t, dt, F, obj.coeffs); |
34 % might be slightly more efficient. Need to do some profiling before deciding whether or not to keep it. | |
35 if (method == "rk4") | |
36 obj.scheme = @(v,t,n) time.rk.rungekutta_4(v ,t, dt, F); | |
37 else | |
38 obj.scheme = @(v,t,n) time.rk.rungekutta(v, t, dt, F, obj.coeffs); | |
39 end | |
40 else | 34 else |
41 obj.scheme = @(v,t,n) time.rk.rungekuttaDiscreteData(v, t, dt, F, obj.coeffs, discreteData, n); | 35 obj.scheme = @(v,t,n) time.rk.rungekuttaDiscreteData(v, t, dt, F, obj.coeffs, discreteData, n); |
42 end | 36 end |
43 end | 37 end |
44 | 38 |