Mercurial > repos > public > sbplib
comparison +multiblock/+domain/Line.m @ 1078:532b58a9e849
Bugfix in multiblock.domain.Line method getGrid.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Wed, 20 Feb 2019 12:32:49 -0800 |
parents | c7b619cf5e34 |
children |
comparison
equal
deleted
inserted
replaced
1077:360280a55ae8 | 1078:532b58a9e849 |
---|---|
63 | 63 |
64 end | 64 end |
65 | 65 |
66 | 66 |
67 % Returns a multiblock.Grid given some parameters | 67 % Returns a multiblock.Grid given some parameters |
68 % ms: cell array of m values | 68 % ms: cell array of m values |
69 % For same m in every block, just input one scalar. | 69 % For same m in every block, just input one scalar. |
70 function g = getGrid(obj, ms, varargin) | 70 function g = getGrid(obj, ms, varargin) |
71 | 71 |
72 default_arg('ms',21) | 72 default_arg('ms',21) |
73 | 73 |
80 end | 80 end |
81 end | 81 end |
82 | 82 |
83 grids = cell(1, obj.nBlocks); | 83 grids = cell(1, obj.nBlocks); |
84 for i = 1:obj.nBlocks | 84 for i = 1:obj.nBlocks |
85 grids{i} = grid.equidistant(ms{i}, obj.xlims{i}, obj.ylims{i}); | 85 grids{i} = grid.equidistant(ms{i}, obj.xlims{i}); |
86 end | 86 end |
87 | 87 |
88 g = multiblock.Grid(grids, obj.connections, obj.boundaryGroups); | 88 g = multiblock.Grid(grids, obj.connections, obj.boundaryGroups); |
89 end | 89 end |
90 | 90 |
91 % Returns a multiblock.Grid given some parameters | 91 % Returns a multiblock.Grid given some parameters |
92 % ms: cell array of m values | 92 % ms: cell array of m values |
93 % For same m in every block, just input one scalar. | 93 % For same m in every block, just input one scalar. |
94 function g = getStaggeredGrid(obj, ms, varargin) | 94 function g = getStaggeredGrid(obj, ms, varargin) |
95 | 95 |
96 default_arg('ms',21) | 96 default_arg('ms',21) |
97 | 97 |
122 figure | 122 figure |
123 for i = 1:obj.nBlocks | 123 for i = 1:obj.nBlocks |
124 x = linspace(obj.xlims{i}{1}, obj.xlims{i}{2}, m); | 124 x = linspace(obj.xlims{i}{1}, obj.xlims{i}{2}, m); |
125 y = 0*x + 0.05* ( (-1)^i + 1 ) ; | 125 y = 0*x + 0.05* ( (-1)^i + 1 ) ; |
126 plot(x,y,'+'); | 126 plot(x,y,'+'); |
127 hold on | 127 hold on |
128 end | 128 end |
129 hold off | 129 hold off |
130 | 130 |
131 switch label | 131 switch label |
132 case 'name' | 132 case 'name' |