Mercurial > repos > public > sbplib
diff +time/Rk4SecondOrderNonlin.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 | cd2e28c5ecd2 |
children | 50d5a3843099 |
line wrap: on
line diff
--- a/+time/Rk4SecondOrderNonlin.m Thu Sep 07 09:54:21 2017 +0200 +++ b/+time/Rk4SecondOrderNonlin.m Mon Sep 10 16:19:16 2018 +0200 @@ -60,6 +60,12 @@ t = obj.t; end + function state = getState(obj) + [v, t] = obj.getV(); + [vt] = obj.getVt(); + state = struct('v', v, 'vt', vt, 't', t, 'k', obj.k); + end + function obj = step(obj) obj.w = time.rk4.rungekutta_4(obj.w, obj.t, obj.k, obj.F); obj.t = obj.t + obj.k;