comparison +scheme/Utux2d.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 5afc774fb7c4
comparison
equal deleted inserted replaced
1007:9c8ed00732fd 1042:8d73fcdb07a5
274 274
275 % Returns the boundary operator op for the boundary specified by the string boundary. 275 % Returns the boundary operator op for the boundary specified by the string boundary.
276 % op -- string or a cell array of strings 276 % op -- string or a cell array of strings
277 % boundary -- string 277 % boundary -- string
278 function varargout = getBoundaryOperator(obj, op, boundary) 278 function varargout = getBoundaryOperator(obj, op, boundary)
279 assertIsMember(boundary, {'w', 'e', 's', 'n'})
279 280
280 if ~iscell(op) 281 if ~iscell(op)
281 op = {op}; 282 op = {op};
282 end 283 end
283 284
291 e = obj.e_e; 292 e = obj.e_e;
292 case 's' 293 case 's'
293 e = obj.e_s; 294 e = obj.e_s;
294 case 'n' 295 case 'n'
295 e = obj.e_n; 296 e = obj.e_n;
296 otherwise
297 error('No such boundary: boundary = %s',boundary);
298 end 297 end
299 varargout{i} = e; 298 varargout{i} = e;
300 end 299 end
301 end 300 end
302 301
305 % Returns square boundary quadrature matrix, of dimension 304 % Returns square boundary quadrature matrix, of dimension
306 % corresponding to the number of boundary points 305 % corresponding to the number of boundary points
307 % 306 %
308 % boundary -- string 307 % boundary -- string
309 function H_b = getBoundaryQuadrature(obj, boundary) 308 function H_b = getBoundaryQuadrature(obj, boundary)
309 assertIsMember(boundary, {'w', 'e', 's', 'n'})
310 310
311 switch boundary 311 switch boundary
312 case 'w' 312 case 'w'
313 H_b = obj.H_y; 313 H_b = obj.H_y;
314 case 'e' 314 case 'e'
315 H_b = obj.H_y; 315 H_b = obj.H_y;
316 case 's' 316 case 's'
317 H_b = obj.H_x; 317 H_b = obj.H_x;
318 case 'n' 318 case 'n'
319 H_b = obj.H_x; 319 H_b = obj.H_x;
320 otherwise
321 error('No such boundary: boundary = %s',boundary);
322 end 320 end
323 end 321 end
324 322
325 function N = size(obj) 323 function N = size(obj)
326 N = obj.m; 324 N = obj.m;