Mercurial > repos > public > sbplib
diff +noname/calculateSolution.m @ 20:c7efff913935
Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Sep 2015 17:35:58 +0200 |
parents | 1644d000c304 |
children | 791decafe6e4 |
line wrap: on
line diff
--- a/+noname/calculateSolution.m Tue Sep 22 17:10:51 2015 +0200 +++ b/+noname/calculateSolution.m Tue Sep 22 17:35:58 2015 +0200 @@ -43,9 +43,8 @@ % Do we want to to save the initial conditions? if T(1) == 0 - v = discr.v0; - t = 0; - saveToFile(sf, method, order(i), m(j),T(1), v, t, NaN, NaN, discrHand); + snapshot = discr.getTimeSnapshot(0); + saveToFile(sf, method, order(i), m(j),T(1), snapshot, NaN, NaN, discrHand); T(1) = []; end @@ -61,9 +60,10 @@ end_step = N * time_multiples(l); fprintf('[order = %-*d, m = %-*d, T = %-*d]: ',orderWidth,order(i),mWidth,m(j),TWidth,T(l)); clock_start = tic(); - [v,t] = ts.stepN(end_step-ts.n,true); + ts.stepN(end_step-ts.n,true); runtime = runtime + toc(clock_start); - saveToFile(sf, method, order(i), m(j),T(l), v, t, runtime, k, discrHand); + snapshot = discr.getTimeSnapshot(ts); + saveToFile(sf, method, order(i), m(j),T(l), snapshot, runtime, k, discrHand); fprintf('Done! (%.3fs)\n',runtime); end else @@ -75,7 +75,8 @@ clock_start = tic(); [v,t] = ts.stepN(N-ts.n,true); runtime = toc(clock_start); - saveToFile(sf, method, order(i), m(j),T(l), v, t, runtime, k, discrHand); + snapshot = discr.getTimeSnapshot(ts); + saveToFile(sf, method, order(i), m(j),T(l), snapshot, runtime, k, discrHand); fprintf('Done! (%.3fs)\n',runtime); end @@ -86,14 +87,13 @@ end -function saveToFile(sf, method, order, m, T, v, t, runtime, k, discrHand) +function saveToFile(sf, method, order, m, T, snapshot, runtime, k, discrHand) key.method = method; key.order = order; key.m = m; key.T = T; - entry.v = v; - entry.t = t; + entry.repr = snapshot; entry.runtime = runtime; entry.k = k; entry.discrHand = discrHand;