comparison +multiblock/Grid.m @ 425:e56dbd9e4196 feature/grids

Merge feature/beams
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2017 16:09:02 +0100
parents b8ee5212f651
children 819345fe7ff1
comparison
equal deleted inserted replaced
423:a2cb0d4f4a02 425:e56dbd9e4196
32 32
33 function n = size(obj) 33 function n = size(obj)
34 n = length(obj.grids); 34 n = length(obj.grids);
35 end 35 end
36 36
37 % n returns the number of points in the grid 37 % N returns the number of points in the grid
38 function o = N(obj) 38 function o = N(obj)
39 o = obj.nPoints; 39 o = obj.nPoints;
40 end
41
42 % Ns returns the number of points in each sub grid as a vector
43 function o = Ns(obj)
44 ns = zeros(1,obj.nBlocks);
45 for i = 1:obj.nBlocks;
46 ns(i) = obj.grids{i}.N();
47 end
48 o = ns;
40 end 49 end
41 50
42 function n = nBlocks(obj) 51 function n = nBlocks(obj)
43 n = length(obj.grids); 52 n = length(obj.grids);
44 end 53 end
60 function gfs = splitFunc(obj, gf) 69 function gfs = splitFunc(obj, gf)
61 nComponents = length(gf)/obj.nPoints; 70 nComponents = length(gf)/obj.nPoints;
62 nBlocks = length(obj.grids); 71 nBlocks = length(obj.grids);
63 72
64 % Collect number of points in each block 73 % Collect number of points in each block
65 N = cell(1,nBlocks); 74 N = zeros(1,nBlocks);
66 for i = 1:nBlocks 75 for i = 1:nBlocks
67 N{i} = obj.grids{i}.N(); 76 N(i) = obj.grids{i}.N();
68 end 77 end
69 78
70 gfs = mat2cell(gf, N, 1); 79 gfs = mat2cell(gf, N, 1);
71 end 80 end
72 81