diff +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
line wrap: on
line diff
--- 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