Mercurial > repos > public > sbplib
changeset 1045:dc1bcbef2a86 feature/getBoundaryOp
Remove ability to get several boundary ops at the same time from a few of the schemes
While it can be handy the code for the getBoundaryOp methods get needlessly cluttered
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Jan 2019 17:12:22 +0100 |
parents | 5afc774fb7c4 |
children | 19ed046aec52 |
files | +scheme/Beam.m +scheme/Laplace1d.m +scheme/LaplaceCurvilinear.m |
diffstat | 3 files changed, 39 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/+scheme/Beam.m Tue Jan 22 16:50:50 2019 +0100 +++ b/+scheme/Beam.m Tue Jan 22 17:12:22 2019 +0100 @@ -86,7 +86,10 @@ function [closure, penalty] = boundary_condition(obj,boundary,type) default_arg('type','dn'); - [e, d1, d2, d3] = obj.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, boundary); + e = obj.getBoundaryOperator('e', boundary); + d1 = obj.getBoundaryOperator('d1', boundary); + d2 = obj.getBoundaryOperator('d2', boundary); + d3 = obj.getBoundaryOperator('d3', boundary); s = obj.getBoundarySign(boundary); gamm = obj.gamm; delt = obj.delt; @@ -174,10 +177,16 @@ function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary, type) % u denotes the solution in the own domain % v denotes the solution in the neighbour domain - [e_u, d1_u, d2_u, d3_u] = obj.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, boundary); + e_u = obj.getBoundaryOperator('e', boundary); + d1_u = obj.getBoundaryOperator('d1', boundary); + d2_u = obj.getBoundaryOperator('d2', boundary); + d3_u = obj.getBoundaryOperator('d3', boundary); s_u = obj.getBoundarySign(boundary); - [e_v, d1_v, d2_v, d3_v] = neighbour_scheme.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, neighbour_boundary); + e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); + d1_v = neighbour_scheme.getBoundaryOperator('d1', neighbour_boundary); + d2_v = neighbour_scheme.getBoundaryOperator('d2', neighbour_boundary); + d3_v = neighbour_scheme.getBoundaryOperator('d3', neighbour_boundary); s_v = neighbour_scheme.getBoundarySign(neighbour_boundary); alpha_u = obj.alpha; @@ -237,17 +246,12 @@ end % Returns the boundary operator op for the boundary specified by the string boundary. - % op -- string or a cell array of strings + % op -- string % boundary -- string - function varargout = getBoundaryOperator(obj, op, boundary) + function o = getBoundaryOperator(obj, op, boundary) assertIsMember(boundary, {'l', 'r'}) - if ~iscell(op) - op = {op}; - end - - for i = 1:numel(op) - switch op{i} + switch op case 'e' switch boundary case 'l' @@ -255,7 +259,7 @@ case 'r' e = obj.e_r; end - varargout{i} = e; + o = e; case 'd1' switch boundary @@ -264,7 +268,7 @@ case 'r' d1 = obj.d1_r; end - varargout{i} = d1; + o = d1; end case 'd2' @@ -274,7 +278,7 @@ case 'r' d2 = obj.d2_r; end - varargout{i} = d2; + o = d2; end case 'd3' @@ -284,8 +288,7 @@ case 'r' d3 = obj.d3_r; end - varargout{i} = d3; - end + o = d3; end end
--- a/+scheme/Laplace1d.m Tue Jan 22 16:50:50 2019 +0100 +++ b/+scheme/Laplace1d.m Tue Jan 22 17:12:22 2019 +0100 @@ -56,7 +56,8 @@ default_arg('type','neumann'); default_arg('data',0); - [e, d] = obj.getBoundaryOperator({'e', 'd'}, boundary); + e = obj.getBoundaryOperator('e', boundary); + d = obj.getBoundaryOperator('d', boundary); s = obj.getBoundarySign(boundary); switch type @@ -114,17 +115,12 @@ end % Returns the boundary operator op for the boundary specified by the string boundary. - % op -- string or a cell array of strings + % op -- string % boundary -- string - function varargout = getBoundaryOperator(obj, op, boundary) + function o = getBoundaryOperator(obj, op, boundary) assertIsMember(boundary, {'l', 'r'}) - if ~iscell(op) - op = {op}; - end - - for i = 1:numel(op) - switch op{i} + switch op case 'e' switch boundary case 'l' @@ -132,7 +128,7 @@ case 'r' e = obj.e_r; end - varargout{i} = e; + o = e; case 'd' switch boundary @@ -141,8 +137,7 @@ case 'r' d = obj.d_r; end - varargout{i} = d; - end + o = d; end end
--- a/+scheme/LaplaceCurvilinear.m Tue Jan 22 16:50:50 2019 +0100 +++ b/+scheme/LaplaceCurvilinear.m Tue Jan 22 17:12:22 2019 +0100 @@ -345,14 +345,16 @@ % u denotes the solution in the own domain % v denotes the solution in the neighbour domain - [e_u, d_u] = obj.getBoundaryOperator({'e', 'd'}, boundary); - H_b_u = obj.getBoundaryQuadrature(boundary); - I_u = obj.getBoundaryIndices(boundary); + e_u = obj.getBoundaryOperator('e', boundary); + d_u = obj.getBoundaryOperator('d', boundary); + H_b_u = obj.getBoundaryQuadrature(boundary); + I_u = obj.getBoundaryIndices(boundary); gamm_u = obj.getBoundaryBorrowing(boundary); - [e_v, d_v] = neighbour_scheme.getBoundaryOperator({'e', 'd'}, neighbour_boundary); - H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary); - I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary); + e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); + d_v = neighbour_scheme.getBoundaryOperator('d', neighbour_boundary); + H_b_v = neighbour_scheme.getBoundaryQuadrature(neighbour_boundary); + I_v = neighbour_scheme.getBoundaryIndices(neighbour_boundary); gamm_v = neighbour_scheme.getBoundaryBorrowing(neighbour_boundary); @@ -396,17 +398,12 @@ end % Returns the boundary operator op for the boundary specified by the string boundary. - % op -- string or a cell array of strings + % op -- string % boundary -- string - function varargout = getBoundaryOperator(obj, op, boundary) + function o = getBoundaryOperator(obj, op, boundary) assertIsMember(boundary, {'w', 'e', 's', 'n'}) - if ~iscell(op) - op = {op}; - end - - for i = 1:numel(op) - switch op{i} + switch op case 'e' switch boundary case 'w' @@ -418,7 +415,7 @@ case 'n' e = obj.e_n; end - varargout{i} = e; + o = e; case 'd' switch boundary @@ -431,8 +428,7 @@ case 'n' d = obj.d_n; end - varargout{i} = d; - end + o = d; end end