Mercurial > repos > public > sbplib
comparison +scheme/Beam.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 | 2b1b944deae1 |
children | 5afc774fb7c4 |
comparison
equal
deleted
inserted
replaced
1007:9c8ed00732fd | 1042:8d73fcdb07a5 |
---|---|
238 | 238 |
239 % Returns the boundary operator op for the boundary specified by the string boundary. | 239 % Returns the boundary operator op for the boundary specified by the string boundary. |
240 % op -- string or a cell array of strings | 240 % op -- string or a cell array of strings |
241 % boundary -- string | 241 % boundary -- string |
242 function varargout = getBoundaryOperator(obj, op, boundary) | 242 function varargout = getBoundaryOperator(obj, op, boundary) |
243 | 243 assertIsMember(boundary, {'l', 'r'}) |
244 if ~ismember(boundary, {'l', 'r'}) | |
245 error('No such boundary: boundary = %s',boundary); | |
246 end | |
247 | 244 |
248 if ~iscell(op) | 245 if ~iscell(op) |
249 op = {op}; | 246 op = {op}; |
250 end | 247 end |
251 | 248 |
293 end | 290 end |
294 | 291 |
295 % Returns the boundary sign. The right boundary is considered the positive boundary | 292 % Returns the boundary sign. The right boundary is considered the positive boundary |
296 % boundary -- string | 293 % boundary -- string |
297 function s = getBoundarySign(obj, boundary) | 294 function s = getBoundarySign(obj, boundary) |
295 assertIsMember(boundary, {'l', 'r'}) | |
296 | |
298 switch boundary | 297 switch boundary |
299 case {'r'} | 298 case {'r'} |
300 s = 1; | 299 s = 1; |
301 case {'l'} | 300 case {'l'} |
302 s = -1; | 301 s = -1; |
303 otherwise | |
304 error('No such boundary: boundary = %s',boundary); | |
305 end | 302 end |
306 end | 303 end |
307 | 304 |
308 function N = size(obj) | 305 function N = size(obj) |
309 N = obj.grid.N; | 306 N = obj.grid.N; |