Mercurial > repos > public > sbplib
comparison +noname/calculateSolution.m @ 40:54d3ab296ba0
Added Dictionary class. Added string conversions for a bunch of types. Deprecated some replaced functions.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 12 Oct 2015 10:38:53 +0200 |
parents | c6eb3af205c0 |
children | 8298734b1938 |
comparison
equal
deleted
inserted
replaced
39:7249f105e67b | 40:54d3ab296ba0 |
---|---|
3 % method -- time stepping method | 3 % method -- time stepping method |
4 % m -- grid parameter | 4 % m -- grid parameter |
5 % order -- order of accuracy of the approximtion | 5 % order -- order of accuracy of the approximtion |
6 % T -- time to calculate solution for | 6 % T -- time to calculate solution for |
7 % input paramters m, t, order may all be vectors. | 7 % input paramters m, t, order may all be vectors. |
8 function [] = calculateSolution(filename, discrHand, method, m, T, order, force_flag) | 8 function [] = calculateSolution(filename, discrHand, method, m, T_in, order, force_flag) |
9 default_arg('force_flag',false); | 9 default_arg('force_flag',false); |
10 | 10 |
11 if exist(filename,'file') && ~force_flag | 11 if exist(filename,'file') && ~force_flag |
12 fprintf('File ''%s'' already exist.',filename); | 12 fprintf('File ''%s'' already exist.',filename); |
13 do_append = yesnoQuestion('Do you want to append to it?'); | 13 do_append = yesnoQuestion('Do you want to append to it?'); |
17 end | 17 end |
18 end | 18 end |
19 | 19 |
20 sf = SolutionFile(filename); | 20 sf = SolutionFile(filename); |
21 | 21 |
22 % Make sure times are sorted | |
23 T = sort(T); | |
24 | 22 |
25 | 23 |
26 orderWidth = findFieldWidth('%d',order); | 24 orderWidth = findFieldWidth('%d',order); |
27 mWidth = findFieldWidth('%d',m); | 25 mWidth = findFieldWidth('%d',m); |
28 TWidth = findFieldWidth('%d',T); | 26 TWidth = findFieldWidth('%d',T_in); |
29 | 27 |
30 for i = 1:length(order) | 28 for i = 1:length(order) |
31 for j = 1:length(m) | 29 for j = 1:length(m) |
30 T = sort(T_in); % Make sure times are sorted | |
31 | |
32 discr = discrHand(m(j),order(i)); | 32 discr = discrHand(m(j),order(i)); |
33 k_max = discr.getTimestep(method); | 33 k_max = discr.getTimestep(method); |
34 | 34 |
35 % Do we want to to save the initial conditions? | 35 % Do we want to to save the initial conditions? |
36 if T(1) == 0 | 36 if T(1) == 0 |