comparison +noname/calculateSolution.m @ 36:c6eb3af205c0

Better error handeling in noname.convergence. Better handeling of T=0 in noname.calculateSolution
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 06 Oct 2015 09:51:52 +0200
parents ddfb98209aa2
children 54d3ab296ba0
comparison
equal deleted inserted replaced
35:61367018c46f 36:c6eb3af205c0
20 sf = SolutionFile(filename); 20 sf = SolutionFile(filename);
21 21
22 % Make sure times are sorted 22 % Make sure times are sorted
23 T = sort(T); 23 T = sort(T);
24 24
25 % Find out if times to be calulated are integer multiples of the smallest one.
26 time_multiples = T/T(1);
27 is_int_multiples = all(time_multiples == int64(time_multiples));
28
29 if is_int_multiples
30 fprintf('Calculating time series in increments\n');
31 else
32 fprintf('Restarting for each time in timeseries\n');
33 end
34
35 25
36 orderWidth = findFieldWidth('%d',order); 26 orderWidth = findFieldWidth('%d',order);
37 mWidth = findFieldWidth('%d',m); 27 mWidth = findFieldWidth('%d',m);
38 TWidth = findFieldWidth('%d',T); 28 TWidth = findFieldWidth('%d',T);
39 29
45 % Do we want to to save the initial conditions? 35 % Do we want to to save the initial conditions?
46 if T(1) == 0 36 if T(1) == 0
47 snapshot = discr.getTimeSnapshot(0); 37 snapshot = discr.getTimeSnapshot(0);
48 saveToFile(sf, method, order(i), m(j),T(1), snapshot, NaN, NaN, discr); 38 saveToFile(sf, method, order(i), m(j),T(1), snapshot, NaN, NaN, discr);
49 T(1) = []; 39 T(1) = [];
40 end
41
42 % Find out if times to be calulated are integer multiples of the smallest one.
43 time_multiples = T/T(1);
44
45 is_int_multiples = all(time_multiples == int64(time_multiples));
46
47 if is_int_multiples
48 fprintf('Calculating time series in increments\n');
49 else
50 fprintf('Restarting for each time in timeseries\n');
50 end 51 end
51 52
52 % T now contains all the times we need to step to, 53 % T now contains all the times we need to step to,
53 % if T contained 0 it has now been removed. 54 % if T contained 0 it has now been removed.
54 55