Mercurial > repos > public > sbplib
diff +noname/convergence.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 | 7bb2ef637142 |
line wrap: on
line diff
--- a/+noname/convergence.m Tue Oct 06 09:48:46 2015 +0200 +++ b/+noname/convergence.m Tue Oct 06 09:51:52 2015 +0200 @@ -1,14 +1,9 @@ % Reference is either a key or a function handle -function [q, e, h] = convergence(filename, errorFunc, reference, method, order, m, T) +function [q, e, h, runtime] = convergence(filename, errorFunc, reference, method, order, m, T) default_arg('errorFunc', @scheme.error1d); sf = SolutionFile(filename); - analytical_ref = isa(reference,'function_handle'); - if ~analytical_ref - reference = sf.get(reference); - end - % Generate convergence, error, and efficiency plots for each search key with more than one entry. for i = 1:length(m) @@ -20,6 +15,7 @@ entry = sf.get(key); [e(i),h(i)] = errorForEntry(key, entry, errorFunc, reference,T); + runtime(i) = entry.runtime; end q = convergence(e,h); @@ -42,6 +38,9 @@ x_ref = reference.x; [~,I] = ismember(x,x_ref,'rows'); + if any(I == 0) + error('Solution and reference solution seem to be on different grids.'); + end v_ref = reference.v(I); end