comparison +multiblock/Grid.m @ 584:b0386d2c180d feature/grids

In case of empty grids, make grid functions with the correct dimensions
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 08 Sep 2017 11:08:50 +0200
parents 1fe16b34f114
children a55d3c1e1f83
comparison
equal deleted inserted replaced
583:75f9b7a80f28 584:b0386d2c180d
44 end 44 end
45 45
46 % Ns returns the number of points in each sub grid as a vector 46 % Ns returns the number of points in each sub grid as a vector
47 function o = Ns(obj) 47 function o = Ns(obj)
48 ns = zeros(1,obj.nBlocks); 48 ns = zeros(1,obj.nBlocks);
49 for i = 1:obj.nBlocks; 49 for i = 1:obj.nBlocks
50 ns(i) = obj.grids{i}.N(); 50 ns(i) = obj.grids{i}.N();
51 end 51 end
52 o = ns; 52 o = ns;
53 end 53 end
54 54
61 o = obj.grids{1}.D(); 61 o = obj.grids{1}.D();
62 end 62 end
63 63
64 % points returns a n x d matrix containing the coordinates for all points. 64 % points returns a n x d matrix containing the coordinates for all points.
65 function X = points(obj) 65 function X = points(obj)
66 X = []; 66 X = sparse(0,obj.D());
67 for i = 1:length(obj.grids) 67 for i = 1:length(obj.grids)
68 X = [X; obj.grids{i}.points]; 68 X = [X; obj.grids{i}.points];
69 end 69 end
70 end 70 end
71 71
78 N = zeros(1,nBlocks); 78 N = zeros(1,nBlocks);
79 for i = 1:nBlocks 79 for i = 1:nBlocks
80 N(i) = obj.grids{i}.N(); 80 N(i) = obj.grids{i}.N();
81 end 81 end
82 82
83 gfs = mat2cell(gf, N, 1); 83 gfs = blockmatrix.fromMatrix(gf, {N,1});
84 end 84 end
85 85
86 % TODO: Split op? 86 % TODO: Split op?
87 % Should the method to split an operator be moved here instead of being in multiblock.DiffOp? 87 % Should the method to split an operator be moved here instead of being in multiblock.DiffOp?
88 88
160 case 'cell' 160 case 'cell'
161 I = boundary{1}; 161 I = boundary{1};
162 name = boundary{2}; 162 name = boundary{2};
163 b = obj.grids{I}.getBoundary(name); 163 b = obj.grids{I}.getBoundary(name);
164 case 'multiblock.BoundaryGroup' 164 case 'multiblock.BoundaryGroup'
165 b = []; 165 b = sparse(0,obj.D());
166 for i = 1:length(boundary) 166 for i = 1:length(boundary)
167 b = [b; obj.getBoundary(boundary{i})]; 167 b = [b; obj.getBoundary(boundary{i})];
168 end 168 end
169 otherwise 169 otherwise
170 error('Unknown boundary indentifier') 170 error('Unknown boundary indentifier')