Mercurial > repos > public > sbplib
comparison +noname/animate.m @ 305:dfa4455033db feature/beams
Made opt more useful.
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Mon, 12 Sep 2016 14:08:27 +0200 |
| parents | 08d7bb7c8ac4 |
| children | 0da1c913a611 |
comparison
equal
deleted
inserted
replaced
| 304:499653b553b8 | 305:dfa4455033db |
|---|---|
| 3 % Example: | 3 % Example: |
| 4 % noname.animate(discr,timemodifier,tend) | 4 % noname.animate(discr,timemodifier,tend) |
| 5 % noname.animate(discr,1, [tstart tend],'my_mov', opt) | 5 % noname.animate(discr,1, [tstart tend],'my_mov', opt) |
| 6 | 6 |
| 7 function hand = animate(discretization, time_modifier, Tend, dirname, opt) | 7 function hand = animate(discretization, time_modifier, Tend, dirname, opt) |
| 8 default_arg('time_modifier',1); | 8 default_arg('time_modifier', 1); |
| 9 default_arg('Tend', Inf); | 9 default_arg('Tend', Inf); |
| 10 default_arg('dirname',''); | 10 default_arg('dirname', ''); |
| 11 default_arg('opt', []); | 11 |
| 12 optDefault.plotType = 'animation'; | |
| 13 optDefault.time = []; | |
| 14 | |
| 15 default_struct('opt', optDefault); | |
| 12 | 16 |
| 13 | 17 |
| 14 if time_modifier < 0 | 18 if time_modifier < 0 |
| 15 do_pause = true; | 19 do_pause = true; |
| 16 time_modifier = -time_modifier; | 20 time_modifier = -time_modifier; |
| 32 fprintf('Animating: %s\n',discretization.name); | 36 fprintf('Animating: %s\n',discretization.name); |
| 33 fprintf('order : %d\n',discretization.order); | 37 fprintf('order : %d\n',discretization.order); |
| 34 fprintf('m : %d\n',size(discretization)); | 38 fprintf('m : %d\n',size(discretization)); |
| 35 | 39 |
| 36 | 40 |
| 37 ts = discretization.getTimestepper(opt); | 41 ts = discretization.getTimestepper(opt.time); |
| 38 | 42 |
| 39 if numel(Tend) == 2 | 43 if numel(Tend) == 2 |
| 40 Tstart = Tend(1); | 44 Tstart = Tend(1); |
| 41 Tend = Tend(2); | 45 Tend = Tend(2); |
| 42 | 46 |
| 48 else | 52 else |
| 49 start_solution = discretization.getTimeSnapshot(0); | 53 start_solution = discretization.getTimeSnapshot(0); |
| 50 Tstart = start_solution.t; | 54 Tstart = start_solution.t; |
| 51 end | 55 end |
| 52 | 56 |
| 53 [update, figure_handle] = discretization.setupPlot('animation'); | 57 [update, figure_handle] = discretization.setupPlot(opt.plotType); |
| 54 if makemovies | 58 if makemovies |
| 55 save_frame = anim.setup_fig_mov(figure_handle,dirname); | 59 save_frame = anim.setup_fig_mov(figure_handle,dirname); |
| 56 end | 60 end |
| 57 | 61 |
| 58 % Initialize loop | 62 % Initialize loop |
