comparison +multiblock/Grid.m @ 881:67228a10dfad feature/poroelastic

Add method expandFunc to multiblock.Grid
author Martin Almquist <malmquist@stanford.edu>
date Fri, 26 Oct 2018 15:41:26 -0700
parents a55d3c1e1f83
children e54c2f54dbfe ce422ba8964e
comparison
equal deleted inserted replaced
861:607c631f175e 881:67228a10dfad
130 % Find what grid a point lies on 130 % Find what grid a point lies on
131 end 131 end
132 132
133 end 133 end
134 134
135 % Pads a grid function that lives on a subgrid with
136 % zeros and gives it the size that mathces obj.
137 function gf = expandFunc(obj, gfSub, subGridId)
138 nComponents = length(gfSub)/obj.grids{subGridId}.N();
139 nBlocks = numel(obj.grids);
140
141 % Create sparse block matrix
142 gfs = cell(nBlocks,1);
143 for i = 1:nBlocks
144 N = obj.grids{i}.N()*nComponents;
145 gfs{i} = sparse(N, 1);
146 end
147
148 % Insert local gf
149 gfs{subGridId} = gfSub;
150
151 % Convert cell to vector
152 gf = blockmatrix.toMatrix(gfs);
153
154 end
155
135 % Find all non interface boundaries of all blocks. 156 % Find all non interface boundaries of all blocks.
136 % Return their grid.boundaryIdentifiers in a cell array. 157 % Return their grid.boundaryIdentifiers in a cell array.
137 function bs = getBoundaryNames(obj) 158 function bs = getBoundaryNames(obj)
138 bs = {}; 159 bs = {};
139 for i = 1:obj.nBlocks() 160 for i = 1:obj.nBlocks()