Mercurial > repos > public > sbplib
diff +scheme/Laplace1d.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 |
line wrap: on
line diff
--- a/+scheme/Laplace1d.m Wed Jan 16 11:31:04 2019 -0800 +++ b/+scheme/Laplace1d.m Tue Jan 22 16:47:34 2019 +0100 @@ -117,6 +117,7 @@ % op -- string or a cell array of strings % boundary -- string function varargout = getBoundaryOperator(obj, op, boundary) + assertIsMember(boundary, {'l', 'r'}) if ~iscell(op) op = {op}; @@ -130,8 +131,6 @@ e = obj.e_l; case 'r' e = obj.e_r; - otherwise - error('No such boundary: boundary = %s',boundary); end varargout{i} = e; @@ -141,8 +140,6 @@ d = obj.d_l; case 'r' d = obj.d_r; - otherwise - error('No such boundary: boundary = %s',boundary); end varargout{i} = d; end @@ -152,13 +149,13 @@ % Returns the boundary sign. The right boundary is considered the positive boundary % boundary -- string function s = getBoundarySign(obj, boundary) + assertIsMember(boundary, {'l', 'r'}) + switch boundary case {'r'} s = 1; case {'l'} s = -1; - otherwise - error('No such boundary: boundary = %s',boundary); end end