diff +noname/convergence.m @ 820:501750fbbfdb

Merge with feature/grids
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Sep 2018 14:40:58 +0200
parents 3e1d8051e68e
children
line wrap: on
line diff
--- a/+noname/convergence.m	Fri Sep 07 14:39:38 2018 +0200
+++ b/+noname/convergence.m	Fri Sep 07 14:40:58 2018 +0200
@@ -1,5 +1,5 @@
 % Reference is either a key or a function handle
-function [q, e, h, runtime] = convergence(filename, errorFunc, reference, method, order, m, T)
+function [q, e, h, runtime] = convergence(filename, errorFunc, reference, name, order, m, T)
     default_arg('errorFunc', @scheme.error1d);
 
     sf = SolutionFile(filename);
@@ -7,7 +7,7 @@
 
     % Generate convergence, error, and efficiency plots for each search key with more than one entry.
     for i = 1:length(m)
-        key.method = method;
+        key.name = name;
         key.order = order;
         key.m = m(i);
         key.T = T;
@@ -30,18 +30,11 @@
 
     % Get the reference solution vector
     if isa(reference,'function_handle');
-        x = v_repr.x;
+        x = v_repr.grid.points();
         v_ref = reference(x,T);
     else
         % Downsample the reference solution
-        x = v_repr.x;
-        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);
+        v_ref = reference.grid.restrictFunc(reference.v, v_repr.grid);
     end
 
     e = errorFunc(discr,v, v_ref);