Mercurial > repos > public > sbplib
comparison +scheme/Utux2d.m @ 1048:adbb80e60b10 feature/getBoundaryOp
Clean up Elastic2dVariable (partially), Utux, and Utux2d.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Tue, 22 Jan 2019 11:12:23 -0800 |
parents | 5afc774fb7c4 |
children | 84200bbae101 |
comparison
equal
deleted
inserted
replaced
1047:6bc55a773e7c | 1048:adbb80e60b10 |
---|---|
10 % Can either be a constant vector or a cell array of function handles. | 10 % Can either be a constant vector or a cell array of function handles. |
11 | 11 |
12 H % Discrete norm | 12 H % Discrete norm |
13 H_x, H_y % Norms in the x and y directions | 13 H_x, H_y % Norms in the x and y directions |
14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms | 14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms |
15 H_w, H_e, H_s, H_n % Boundary quadratures | |
15 | 16 |
16 % Derivatives | 17 % Derivatives |
17 Dx, Dy | 18 Dx, Dy |
18 | 19 |
19 % Boundary operators | 20 % Boundary operators |
57 Hx = ops_x.H; | 58 Hx = ops_x.H; |
58 Hy = ops_y.H; | 59 Hy = ops_y.H; |
59 Hxi = ops_x.HI; | 60 Hxi = ops_x.HI; |
60 Hyi = ops_y.HI; | 61 Hyi = ops_y.HI; |
61 | 62 |
63 obj.H_w = Hy; | |
64 obj.H_e = Hy; | |
65 obj.H_s = Hx; | |
66 obj.H_n = Hx; | |
62 obj.H_x = Hx; | 67 obj.H_x = Hx; |
63 obj.H_y = Hy; | 68 obj.H_y = Hy; |
64 obj.H = kron(Hx,Hy); | 69 obj.H = kron(Hx,Hy); |
65 obj.Hi = kron(Hxi,Hyi); | 70 obj.Hi = kron(Hxi,Hyi); |
66 obj.Hx = kron(Hx,Iy); | 71 obj.Hx = kron(Hx,Iy); |
270 end | 275 end |
271 | 276 |
272 | 277 |
273 end | 278 end |
274 | 279 |
275 % Returns the boundary operator op for the boundary specified by the string boundary. | 280 % Returns the boundary operator op for the boundary specified by the string boundary. |
276 % op -- string or a cell array of strings | 281 % op -- string |
277 % boundary -- string | 282 % boundary -- string |
278 function varargout = getBoundaryOperator(obj, op, boundary) | 283 function o = getBoundaryOperator(obj, op, boundary) |
284 assertIsMember(op, {'e'}) | |
279 assertIsMember(boundary, {'w', 'e', 's', 'n'}) | 285 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
280 | 286 |
281 if ~iscell(op) | 287 o = obj.([op, '_', boundary]); |
282 op = {op}; | |
283 end | |
284 | |
285 for i = 1:numel(op) | |
286 switch op{i} | |
287 case 'e' | |
288 switch boundary | |
289 case 'w' | |
290 e = obj.e_w; | |
291 case 'e' | |
292 e = obj.e_e; | |
293 case 's' | |
294 e = obj.e_s; | |
295 case 'n' | |
296 e = obj.e_n; | |
297 end | |
298 varargout{i} = e; | |
299 end | |
300 end | |
301 | |
302 end | 288 end |
303 | 289 |
304 % Returns square boundary quadrature matrix, of dimension | 290 % Returns square boundary quadrature matrix, of dimension |
305 % corresponding to the number of boundary points | 291 % corresponding to the number of boundary points |
306 % | 292 % |
307 % boundary -- string | 293 % boundary -- string |
308 function H_b = getBoundaryQuadrature(obj, boundary) | 294 function H_b = getBoundaryQuadrature(obj, boundary) |
309 assertIsMember(boundary, {'w', 'e', 's', 'n'}) | 295 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
310 | 296 |
311 switch boundary | 297 H_b = obj.('H_', boundary); |
312 case 'w' | |
313 H_b = obj.H_y; | |
314 case 'e' | |
315 H_b = obj.H_y; | |
316 case 's' | |
317 H_b = obj.H_x; | |
318 case 'n' | |
319 H_b = obj.H_x; | |
320 end | |
321 end | 298 end |
322 | 299 |
323 function N = size(obj) | 300 function N = size(obj) |
324 N = obj.m; | 301 N = obj.m; |
325 end | 302 end |