comparison +grid/boundaryoptimized.m @ 1296:2853b655c172 feature/boundary_optimized_grids

Fix typos in comments
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 07 Jul 2020 16:00:24 +0200
parents 2fd2e2337b77
children
comparison
equal deleted inserted replaced
1290:b0208b130880 1296:2853b655c172
1 % Creates a cartesian grid of dimension length(m) 1 % Creates a Cartesian grid of dimension length(m)
2 % over the doman xlim, ylim, ... 2 % over the domain xlim, ylim, ...
3 % The grid is non-equidistant in the boundary regions, 3 % The grid is non-equidistant in the boundary regions,
4 % with node node placement based of boundary-optimized SBP operators. 4 % with node placement based on boundary-optimized SBP operators.
5 % Examples: 5 % Examples:
6 % g = grid.boundaryoptimized([mx, my], xlim, ylim, order, opt) 6 % g = grid.boundaryoptimized([mx, my], xlim, ylim, order, opt)
7 % g = grid.boundaryoptimized([10, 15], {0,1}, {0,2}, 4) - defaults to 'accurate' stencils 7 % g = grid.boundaryoptimized([10, 15], {0,1}, {0,2}, 4) - defaults to 'accurate' stencils
8 % g = grid.boundaryoptimized([10, 15], {0,1}, {0,2}, 4, 'minimal') 8 % g = grid.boundaryoptimized([10, 15], {0,1}, {0,2}, 4, 'minimal')
9 function g = boundaryoptimized(m, varargin) 9 function g = boundaryoptimized(m, varargin)
10 n = length(m); 10 n = length(m);
11 11
12 % Check that parameters matches dimensions 12 % Check that parameters matches dimensions
13 matchingParams = false; 13 matchingParams = false;
14 if length(varargin) == n+1 % Minimal number of arguments 14 if length(varargin) == n+1 % Minimal number of arguments
15 matchingParams = iscell([varargin{1:n}]) && ... 15 matchingParams = iscell([varargin{1:n}]) && ...
16 isfloat([varargin{n+1}]); 16 isfloat([varargin{n+1}]);
17 elseif length(varargin) == n+2 % Stencil options supplied 17 elseif length(varargin) == n+2 % Stencil options supplied
18 matchingParams = iscell([varargin{1:n}]) && ... 18 matchingParams = iscell([varargin{1:n}]) && ...
19 isfloat([varargin{n+1}]) && ... 19 isfloat([varargin{n+1}]) && ...
20 ischar([varargin{n+2}]); 20 ischar([varargin{n+2}]);
21 end 21 end
22 assert(matchingParams,'grid:boundaryoptimized:NonMatchingParameters','The number of parameters per dimensions do not match.'); 22 assert(matchingParams,'grid:boundaryoptimized:NonMatchingParameters','The number of parameters per dimensions do not match.');
23 23
24 % Check that stencil options are passed correctly (if supplied) 24 % Check that stencil options are passed correctly (if supplied)
25 if length(varargin) == n+2 % Stencil options supplied 25 if length(varargin) == n+2 % Stencil options supplied
26 availabe_opts = ["Accurate","accurate","A","Minimal","minimal","M"]; 26 availabe_opts = ["Accurate","accurate","A","Minimal","minimal","M"];
27 assert(any(varargin{n+2} == availabe_opts), ... 27 assert(any(varargin{n+2} == availabe_opts), ...
28 'grid:boundaryoptimized:InvalidOption',"The operator option must be 'accurate' or 'minimal.'"); 28 'grid:boundaryoptimized:InvalidOption',"The operator option must be 'accurate' or 'minimal.'");
29 else %If not passed, populate varargin with default option 'accurate' 29 else %If not passed, populate varargin with default option 'accurate'
30 varargin(n+2) = {'accurate'}; 30 varargin(n+2) = {'accurate'};
31 end 31 end
32 32
33 % Specify generating function 33 % Specify generating function
34 switch varargin{n+2} 34 switch varargin{n+2}
35 case {'Accurate','accurate','A'} 35 case {'Accurate','accurate','A'}
36 gridgenerator = @sbp.util.accurateBoundaryOptimizedGrid; 36 gridgenerator = @sbp.util.accurateBoundaryOptimizedGrid;
37 case {'Minimal','minimal','M'} 37 case {'Minimal','minimal','M'}