Mercurial > repos > public > sbplib
comparison +scheme/Hypsyst2d.m @ 1042:8d73fcdb07a5 feature/getBoundaryOp
Add asserts to boundary identifier inputs
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Jan 2019 16:47:34 +0100 |
parents | 78db023a7fe3 |
children |
comparison
equal
deleted
inserted
replaced
1007:9c8ed00732fd | 1042:8d73fcdb07a5 |
---|---|
296 | 296 |
297 % Returns the boundary operator op for the boundary specified by the string boundary. | 297 % Returns the boundary operator op for the boundary specified by the string boundary. |
298 % op -- string or a cell array of strings | 298 % op -- string or a cell array of strings |
299 % boundary -- string | 299 % boundary -- string |
300 function varargout = getBoundaryOperator(obj, op, boundary) | 300 function varargout = getBoundaryOperator(obj, op, boundary) |
301 assertIsMember(boundary, {'w', 'e', 's', 'n'}) | |
301 | 302 |
302 if ~iscell(op) | 303 if ~iscell(op) |
303 op = {op}; | 304 op = {op}; |
304 end | 305 end |
305 | 306 |
313 e = obj.e_e; | 314 e = obj.e_e; |
314 case 's' | 315 case 's' |
315 e = obj.e_s; | 316 e = obj.e_s; |
316 case 'n' | 317 case 'n' |
317 e = obj.e_n; | 318 e = obj.e_n; |
318 otherwise | |
319 error('No such boundary: boundary = %s',boundary); | |
320 end | 319 end |
321 varargout{i} = e; | 320 varargout{i} = e; |
322 end | 321 end |
323 end | 322 end |
324 end | 323 end |
326 % Returns square boundary quadrature matrix, of dimension | 325 % Returns square boundary quadrature matrix, of dimension |
327 % corresponding to the number of boundary points | 326 % corresponding to the number of boundary points |
328 % | 327 % |
329 % boundary -- string | 328 % boundary -- string |
330 function H_b = getBoundaryQuadrature(obj, boundary) | 329 function H_b = getBoundaryQuadrature(obj, boundary) |
330 assertIsMember(boundary, {'w', 'e', 's', 'n'}) | |
331 | 331 |
332 e = obj.getBoundaryOperator('e', boundary); | 332 e = obj.getBoundaryOperator('e', boundary); |
333 | 333 |
334 switch boundary | 334 switch boundary |
335 case 'w' | 335 case 'w' |
338 H_b = inv(e'*obj.Hyi*e); | 338 H_b = inv(e'*obj.Hyi*e); |
339 case 's' | 339 case 's' |
340 H_b = inv(e'*obj.Hxi*e); | 340 H_b = inv(e'*obj.Hxi*e); |
341 case 'n' | 341 case 'n' |
342 H_b = inv(e'*obj.Hxi*e); | 342 H_b = inv(e'*obj.Hxi*e); |
343 otherwise | |
344 error('No such boundary: boundary = %s',boundary); | |
345 end | 343 end |
346 end | 344 end |
347 | 345 |
348 end | 346 end |
349 end | 347 end |