comparison +grid/Curvilinear.m @ 425:e56dbd9e4196 feature/grids

Merge feature/beams
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2017 16:09:02 +0100
parents 4f935415700e
children 692bf61385c0
comparison
equal deleted inserted replaced
423:a2cb0d4f4a02 425:e56dbd9e4196
5 end 5 end
6 6
7 methods 7 methods
8 % Creates a curvilinear grid. 8 % Creates a curvilinear grid.
9 % Ex: grid.Curvilinear(mapping, xi, eta, ...) 9 % Ex: grid.Curvilinear(mapping, xi, eta, ...)
10 % mapping -- either a matrix or a cell array with physical coordinates. 10 % mapping -- either a function handle, a matrix or a cell array with physical coordinates.
11 % A function handle should be a vector valued function of the coordinate mapping.
11 % A matrix should be a grid function (N*D x 1 vector) or a N x D 12 % A matrix should be a grid function (N*D x 1 vector) or a N x D
12 % A cell array should be a 1 x D cell array with either N x 1 vectors 13 % A cell array should be a 1 x D cell array with either N x 1 vectors
13 % or matrices of the same dimesions as the logical grid. 14 % or matrices of the same dimesions as the logical grid.
14 % xi, eta, ... -- are the coordinate positions of the cartesian logical grid. 15 % xi, eta, ... -- are the coordinate positions of the cartesian logical grid.
15 function obj = Curvilinear(mapping, varargin) 16 function obj = Curvilinear(mapping, varargin)
29 if iscell(mapping) 30 if iscell(mapping)
30 obj.coords = cellMappingToCoords(mapping, N, D, obj.logic.m); 31 obj.coords = cellMappingToCoords(mapping, N, D, obj.logic.m);
31 elseif isnumeric(mapping) 32 elseif isnumeric(mapping)
32 obj.coords = matrixMappingToCoords(mapping, N, D); 33 obj.coords = matrixMappingToCoords(mapping, N, D);
33 else 34 else
34 error('grid:Curvilinear:Curvilinear','mapping must be a matrix or a cell array.'); 35 error('grid:Curvilinear:Curvilinear','mapping must be a function handle, a matrix or a cell array.');
35 end 36 end
36 end 37 end
37 38
38 function m = size(obj) 39 function m = size(obj)
39 m = obj.logic.size(); 40 m = obj.logic.size();
64 X = obj.coords; 65 X = obj.coords;
65 end 66 end
66 67
67 % Restricts the grid function gf on obj to the subgrid g. 68 % Restricts the grid function gf on obj to the subgrid g.
68 function gf = restrictFunc(obj, gf, g) 69 function gf = restrictFunc(obj, gf, g)
69 gf = obj.logic.restrictFunc(gf, g.baseGrid()); 70 gf = obj.logic.restrictFunc(gf, g.logic);
70 end 71 end
71 72
72 % Projects the grid function gf on obj to the grid g. 73 % Projects the grid function gf on obj to the grid g.
73 function gf = projectFunc(obj, gf, g) 74 function gf = projectFunc(obj, gf, g)
74 gf = obj.logic.projectFunc(gf,g.baseGrid()); 75 gf = obj.logic.projectFunc(gf,g.logic);
75 end 76 end
76 77
77 function h = scaling(obj) 78 function h = scaling(obj)
78 if isempty(obj.logic.h) 79 if isempty(obj.logic.h)
79 error('grid:Curvilinear:NoScalingSet','No scaling set'); 80 error('grid:Curvilinear:NoScalingSet','No scaling set');