Mercurial > repos > public > sbplib
diff +noname/animate.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | 082c7bf3192e |
children | c9147e05d228 |
line wrap: on
line diff
--- a/+noname/animate.m Mon Sep 10 16:19:16 2018 +0200 +++ b/+noname/animate.m Thu Nov 15 16:36:21 2018 -0800 @@ -1,14 +1,18 @@ -% hand = noname.animate(discretization, time_modifier, Tend, dirname, opt) +% noname.animate(discretization, time_modifier, Tend, dirname, opt) % % Example: % noname.animate(discr,timemodifier,tend) % noname.animate(discr,1, [tstart tend],'my_mov', opt) -function hand = animate(discretization, time_modifier, Tend, dirname, opt) - default_arg('time_modifier',1); +function animate(discretization, time_modifier, Tend, dirname, opt) + default_arg('time_modifier', 1); default_arg('Tend', Inf); - default_arg('dirname',''); - default_arg('opt', []); + default_arg('dirname', ''); + + optDefault.plotType = 'animation'; + optDefault.time = []; + + default_struct('opt', optDefault); if time_modifier < 0 @@ -34,7 +38,7 @@ fprintf('m : %d\n',size(discretization)); - ts = discretization.getTimestepper(opt); + ts = discretization.getTimestepper(opt.time); if numel(Tend) == 2 Tstart = Tend(1); @@ -50,7 +54,7 @@ Tstart = start_solution.t; end - [update, figure_handle] = discretization.setupPlot('animation'); + [update, figure_handle] = discretization.setupPlot(opt.plotType); if makemovies save_frame = anim.setup_fig_mov(figure_handle,dirname); end @@ -83,7 +87,8 @@ pause anim.animate(@G, Tstart, Tend, time_modifier); else - while true + pause + while ts.t < Tend ts.step(); sol = discretization.getTimeSnapshot(ts); update(sol);