comparison +noname/convergence.m @ 217:fc07ebc49412 feature/beams

noname: Changed convergence to use grids in the representation of the solutions.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 27 Jun 2016 13:23:46 +0200
parents 7bb2ef637142
children 3e1d8051e68e
comparison
equal deleted inserted replaced
216:8b10476b9bb7 217:fc07ebc49412
28 % Get the solution to be compared 28 % Get the solution to be compared
29 v = v_repr.v; 29 v = v_repr.v;
30 30
31 % Get the reference solution vector 31 % Get the reference solution vector
32 if isa(reference,'function_handle'); 32 if isa(reference,'function_handle');
33 x = v_repr.x; 33 x = v_repr.grid.Points();
34 v_ref = reference(x,T); 34 v_ref = reference(x,T);
35 else 35 else
36 % Downsample the reference solution 36 % Downsample the reference solution
37 x = v_repr.x; 37 v_ref = reference.grid.restrictFunc(reference.v, v_repr.grid);
38 x_ref = reference.x;
39
40 [~,I] = ismember(x,x_ref,'rows');
41 if any(I == 0)
42 error('Solution and reference solution seem to be on different grids.');
43 end
44 v_ref = reference.v(I);
45 end 38 end
46 39
47 e = errorFunc(discr,v, v_ref); 40 e = errorFunc(discr,v, v_ref);
48 h = discr.h; 41 h = discr.h;
49 end 42 end