Mercurial > repos > public > sbplib
changeset 928:1c61d8fa9903 feature/utux2D
Replace opts by type everywhere
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 03 Dec 2018 15:01:24 -0800 |
parents | 4291731570bb |
children | dd95470d4baf |
files | +multiblock/DiffOp.m +multiblock/setAllInterfaceOptions.m +multiblock/setAllInterfaceTypes.m +scheme/LaplaceCurvilinear.m |
diffstat | 4 files changed, 33 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
diff -r 4291731570bb -r 1c61d8fa9903 +multiblock/DiffOp.m --- a/+multiblock/DiffOp.m Mon Dec 03 14:53:52 2018 -0800 +++ b/+multiblock/DiffOp.m Mon Dec 03 15:01:24 2018 -0800 @@ -10,7 +10,7 @@ end methods - function obj = DiffOp(doHand, grid, order, doParam, intfOpts) + function obj = DiffOp(doHand, grid, order, doParam, intfTypes) % doHand -- may either be a function handle or a cell array of % function handles for each grid. The function handle(s) % should be on the form do = doHand(grid, order, ...) @@ -25,10 +25,10 @@ % doHand(..., doParam{i}{:}) Otherwise doParam is sent as % extra parameters to all doHand: doHand(..., doParam{:}) % - % intfOpts (optional) -- nBlocks x nBlocks cell array of options for + % intfTypes (optional) -- nBlocks x nBlocks cell array of types for % every interface. default_arg('doParam', []) - default_arg('intfOpts', cell(grid.nBlocks(), grid.nBlocks()) ); + default_arg('intfTypes', cell(grid.nBlocks(), grid.nBlocks()) ); [getHand, getParam] = parseInput(doHand, grid, doParam); @@ -69,11 +69,11 @@ continue end - [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, intfOpts{i,j}); + [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, intfTypes{i,j}); D{i,i} = D{i,i} + ii; D{i,j} = D{i,j} + ij; - [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, intfOpts{i,j}); + [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, intfTypes{i,j}); D{j,j} = D{j,j} + jj; D{j,i} = D{j,i} + ji; end
diff -r 4291731570bb -r 1c61d8fa9903 +multiblock/setAllInterfaceOptions.m --- a/+multiblock/setAllInterfaceOptions.m Mon Dec 03 14:53:52 2018 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -% g: multiblock grid -% opts: struct of options -% Returns g.nBlocks x g.nBlocks cell array with all interface opts set to opts. -function optsCell = setAllInterfaceOptions(g, opts) - - optsCell = cell(g.nBlocks(), g.nBlocks()); - for i = 1:g.nBlocks() - for j = 1:g.nBlocks - if ~isempty(g.connections{i,j}) - optsCell{i,j} = opts; - end - end - end - -end \ No newline at end of file
diff -r 4291731570bb -r 1c61d8fa9903 +multiblock/setAllInterfaceTypes.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+multiblock/setAllInterfaceTypes.m Mon Dec 03 15:01:24 2018 -0800 @@ -0,0 +1,15 @@ +% g: multiblock grid +% opts: struct of options +% Returns g.nBlocks x g.nBlocks cell array with all interface opts set to opts. +function optsCell = setAllInterfaceTypes(g, opts) + + optsCell = cell(g.nBlocks(), g.nBlocks()); + for i = 1:g.nBlocks() + for j = 1:g.nBlocks + if ~isempty(g.connections{i,j}) + optsCell{i,j} = opts; + end + end + end + +end \ No newline at end of file
diff -r 4291731570bb -r 1c61d8fa9903 +scheme/LaplaceCurvilinear.m --- a/+scheme/LaplaceCurvilinear.m Mon Dec 03 14:53:52 2018 -0800 +++ b/+scheme/LaplaceCurvilinear.m Mon Dec 03 15:01:24 2018 -0800 @@ -273,31 +273,31 @@ end end - % opts Struct that specifies the interface coupling. + % type Struct that specifies the interface coupling. % Fields: % -- tuning: penalty strength, defaults to 1.2 % -- interpolation: struct of interpolation operators (empty for conforming grids) - function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,opts) + function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type) defaultType.tuning = 1.2; defaultType.interpolation = 'none'; - default_struct('opts', defaultType); + default_struct('type', defaultType); - switch opts.interpolation + switch type.interpolation case {'none', ''} [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary); case {'op','OP'} - [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,opts); + [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type); otherwise error('Unknown type of interpolation: %s ', type.interpolation); end end - function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,opts) + function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) - default_arg('opts', struct); - default_field(opts, 'tuning', 1.2); - tuning = opts.tuning; + default_arg('type', struct); + default_field(type, 'tuning', 1.2); + tuning = type.tuning; % u denotes the solution in the own domain % v denotes the solution in the neighbour domain @@ -326,15 +326,15 @@ penalty = obj.a*obj.Hi*(-tau*e_v' + sig*d_v'); end - function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,opts) + function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type) % TODO: Make this work for curvilinear grids warning('LaplaceCurvilinear: Non-conforming grid interpolation only works for Cartesian grids.'); % User can request special interpolation operators by specifying type.interpOpSet - default_field(opts, 'interpOpSet', @sbp.InterpOpsOP); - interpOpSet = opts.interpOpSet; - tuning = opts.tuning; + default_field(type, 'interpOpSet', @sbp.InterpOpsOP); + interpOpSet = type.interpOpSet; + tuning = type.tuning; % u denotes the solution in the own domain