comparison +grid/Curvilinear.m @ 173:f7bb2a94d291 feature/grids

Added functionallity for storing grid scaling on structured grids.
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 26 Feb 2016 16:06:03 +0100
parents c3483685116a
children c5ca9bbfed41
comparison
equal deleted inserted replaced
172:c3483685116a 173:f7bb2a94d291
27 obj.coords = zeros(N,D); 27 obj.coords = zeros(N,D);
28 28
29 if iscell(mapping) 29 if iscell(mapping)
30 obj.coords = cellMappingToCoords(mapping, N, D, obj.logic.m); 30 obj.coords = cellMappingToCoords(mapping, N, D, obj.logic.m);
31 elseif isnumeric(mapping) 31 elseif isnumeric(mapping)
32 obj.coords = matrixMappingToCoords(mapping, N, D) 32 obj.coords = matrixMappingToCoords(mapping, N, D);
33 else 33 else
34 error('grid:Curvilinear:Curvilinear','mapping must be a matrix or a cell array.'); 34 error('grid:Curvilinear:Curvilinear','mapping must be a matrix or a cell array.');
35 end 35 end
36 end 36 end
37 37
71 71
72 % Projects the grid function gf on obj to the grid g. 72 % Projects the grid function gf on obj to the grid g.
73 function gf = projectFunc(obj, gf, g) 73 function gf = projectFunc(obj, gf, g)
74 gf = obj.logic.projectFunc(gf,g.baseGrid()); 74 gf = obj.logic.projectFunc(gf,g.baseGrid());
75 end 75 end
76
77 function h = scaling(obj)
78 if isempty(obj.logic.h)
79 error('grid:Curvilinear:NoScalingSet','No scaling set');
80 end
81 h = obj.logic.h;
82 end
76 end 83 end
77 end 84 end
78 85
79 86
80 function coords = cellMappingToCoords(mapping, N, D, m) 87 function coords = cellMappingToCoords(mapping, N, D, m)
81 if ~isequal(size(mapping),[1 D]) 88 if ~isequal(size(mapping),[1 D])
82 error('grid:Curvilinear:Curvilinear','The cell array must be a row array.'); 89 error('grid:Curvilinear:Curvilinear','The cell array must be a 1xD array.');
83 end 90 end
84 91
85 if isequal(size(mapping{1}),[N 1]) 92 if isequal(size(mapping{1}),[N 1])
86 coords = cell2mat(mapping); 93 coords = cell2mat(mapping);
87 elseif isequal(size(mapping{1}), m) 94 elseif isequal(size(mapping{1}), m)