Mercurial > repos > public > sbplib
changeset 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 | 75f9b7a80f28 |
children | 6e6da40091b7 |
files | +multiblock/DiffOp.m +multiblock/Grid.m |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
diff -r 75f9b7a80f28 -r b0386d2c180d +multiblock/DiffOp.m --- a/+multiblock/DiffOp.m Thu Sep 07 14:08:31 2017 +0200 +++ b/+multiblock/DiffOp.m Fri Sep 08 11:08:50 2017 +0200 @@ -134,7 +134,7 @@ op = blockmatrix.toMatrix(blockOp); return case 'multiblock.BoundaryGroup' - op = []; + op = sparse(size(obj.D,1),0); for i = 1:length(boundary) op = [op, obj.getBoundaryOperator(opName, boundary{i})]; end @@ -155,7 +155,7 @@ case 'multiblock.BoundaryGroup' [n,m] = size(obj.D); closure = sparse(n,m); - penalty = []; + penalty = sparse(n,0); for i = 1:length(boundary) [closurePart, penaltyPart] = obj.boundary_condition(boundary{i}, type); closure = closure + closurePart;
diff -r 75f9b7a80f28 -r b0386d2c180d +multiblock/Grid.m --- a/+multiblock/Grid.m Thu Sep 07 14:08:31 2017 +0200 +++ b/+multiblock/Grid.m Fri Sep 08 11:08:50 2017 +0200 @@ -46,7 +46,7 @@ % Ns returns the number of points in each sub grid as a vector function o = Ns(obj) ns = zeros(1,obj.nBlocks); - for i = 1:obj.nBlocks; + for i = 1:obj.nBlocks ns(i) = obj.grids{i}.N(); end o = ns; @@ -63,7 +63,7 @@ % points returns a n x d matrix containing the coordinates for all points. function X = points(obj) - X = []; + X = sparse(0,obj.D()); for i = 1:length(obj.grids) X = [X; obj.grids{i}.points]; end @@ -80,7 +80,7 @@ N(i) = obj.grids{i}.N(); end - gfs = mat2cell(gf, N, 1); + gfs = blockmatrix.fromMatrix(gf, {N,1}); end % TODO: Split op? @@ -162,7 +162,7 @@ name = boundary{2}; b = obj.grids{I}.getBoundary(name); case 'multiblock.BoundaryGroup' - b = []; + b = sparse(0,obj.D()); for i = 1:length(boundary) b = [b; obj.getBoundary(boundary{i})]; end