Mercurial > repos > public > sbplib
comparison +multiblock/Grid.m @ 1331:60c875c18de3 feature/D2_boundary_opt
Merge with feature/poroelastic for Elastic schemes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 10 Mar 2022 16:54:26 +0100 |
parents | ce422ba8964e |
children |
comparison
equal
deleted
inserted
replaced
1330:855871e0b852 | 1331:60c875c18de3 |
---|---|
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() |
153 end | 174 end |
154 end | 175 end |
155 end | 176 end |
156 | 177 |
157 % Return coordinates for the given boundary/boundaryGroup | 178 % Return coordinates for the given boundary/boundaryGroup |
158 function b = getBoundary(obj, boundary) | 179 function b = getBoundary(obj, boundary, varargin) |
159 switch class(boundary) | 180 switch class(boundary) |
160 case 'cell' | 181 case 'cell' |
161 I = boundary{1}; | 182 I = boundary{1}; |
162 name = boundary{2}; | 183 name = boundary{2}; |
163 b = obj.grids{I}.getBoundary(name); | 184 b = obj.grids{I}.getBoundary(name, varargin{:}); |
164 case 'multiblock.BoundaryGroup' | 185 case 'multiblock.BoundaryGroup' |
165 b = sparse(0,obj.D()); | 186 b = sparse(0,obj.D()); |
166 for i = 1:length(boundary) | 187 for i = 1:length(boundary) |
167 b = [b; obj.getBoundary(boundary{i})]; | 188 b = [b; obj.getBoundary(boundary{i}, varargin{:})]; |
168 end | 189 end |
169 otherwise | 190 otherwise |
170 error('Unknown boundary indentifier') | 191 error('Unknown boundary indentifier') |
171 end | 192 end |
172 end | 193 end |