Mercurial > repos > public > sbplib
diff +multiblock/DefCurvilinear.m @ 1336:0666629aa183 feature/D2_boundary_opt
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 13 May 2022 13:26:16 +0200 |
parents | 60c875c18de3 |
children |
line wrap: on
line diff
--- a/+multiblock/DefCurvilinear.m Sat May 07 10:41:22 2022 +0200 +++ b/+multiblock/DefCurvilinear.m Fri May 13 13:26:16 2022 +0200 @@ -52,10 +52,9 @@ % If a scalar is passed, defer to getGridSizes implemented by subclass % TODO: This forces the interface of subclasses. % Should ms be included in varargin? Figure out bow to do it properly - if length(ms) == 1 + if ~iscell(ms) && length(ms) == 1 ms = obj.getGridSizes(ms); end - if isempty(varargin) || strcmp(varargin{1},'equidist') gridgenerator = @(blockMap,m) grid.equidistantCurvilinear(blockMap, m); elseif strcmp(varargin{1},'boundaryopt') @@ -63,13 +62,15 @@ stenciloption = varargin{3}; gridgenerator = @(blockMap,m) grid.boundaryOptimizedCurvilinear(blockMap,m,{0,1},{0,1},... order,stenciloption); - else - error('No grid type supplied!'); - end - grids = cell(1, obj.nBlocks); - for i = 1:obj.nBlocks + elseif strcmp(varargin{1},'general') + gridgenerator = @(blockMap,m) grid.generalCurvilinear(blockMap,m,{0,1},{0,1},varargin{2:end}); + else + error('No grid type supplied!'); + end + grids = cell(1, obj.nBlocks); + for i = 1:obj.nBlocks grids{i} = gridgenerator(obj.blockMaps{i}.S, ms{i}); - end + end g = multiblock.Grid(grids, obj.connections, obj.boundaryGroups); end