Mercurial > repos > public > sbplib
comparison +multiblock/DiffOp.m @ 923:d232483eb72f feature/utux2D
Remove interfaceOptions class
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Sun, 02 Dec 2018 17:19:48 -0800 |
parents | c0652621bd69 |
children | 1c61d8fa9903 |
comparison
equal
deleted
inserted
replaced
922:1d91c2a8aada | 923:d232483eb72f |
---|---|
8 | 8 |
9 blockmatrixDiv | 9 blockmatrixDiv |
10 end | 10 end |
11 | 11 |
12 methods | 12 methods |
13 function obj = DiffOp(doHand, grid, order, doParam, interfaceOptions) | 13 function obj = DiffOp(doHand, grid, order, doParam, intfOpts) |
14 % doHand -- may either be a function handle or a cell array of | 14 % doHand -- may either be a function handle or a cell array of |
15 % function handles for each grid. The function handle(s) | 15 % function handles for each grid. The function handle(s) |
16 % should be on the form do = doHand(grid, order, ...) | 16 % should be on the form do = doHand(grid, order, ...) |
17 % Additional parameters for each doHand may be provided in | 17 % Additional parameters for each doHand may be provided in |
18 % the doParam input. | 18 % the doParam input. |
23 % to the number of blocks then each element is sent to the | 23 % to the number of blocks then each element is sent to the |
24 % corresponding function handle as extra parameters: | 24 % corresponding function handle as extra parameters: |
25 % doHand(..., doParam{i}{:}) Otherwise doParam is sent as | 25 % doHand(..., doParam{i}{:}) Otherwise doParam is sent as |
26 % extra parameters to all doHand: doHand(..., doParam{:}) | 26 % extra parameters to all doHand: doHand(..., doParam{:}) |
27 % | 27 % |
28 % interfaceOptions (optional) -- An instance of class multiblock.InterfaceOptions | 28 % intfOpts (optional) -- nBlocks x nBlocks cell array of options for |
29 % OR | |
30 % nBlocks x nBlocks cell array of opts for | |
31 % every interface. | 29 % every interface. |
32 default_arg('doParam', []) | 30 default_arg('doParam', []) |
33 default_arg('interfaceOptions', multiblock.InterfaceOptions(grid) ); % Empty options | 31 default_arg('intfOpts', cell(grid.nBlocks(), grid.nBlocks()) ); |
34 if isa(interfaceOptions, 'multiblock.InterfaceOptions'); | |
35 interfaceOptions = interfaceOptions.getOptions; | |
36 end | |
37 | 32 |
38 [getHand, getParam] = parseInput(doHand, grid, doParam); | 33 [getHand, getParam] = parseInput(doHand, grid, doParam); |
39 | 34 |
40 obj.order = order; | 35 obj.order = order; |
41 nBlocks = grid.nBlocks(); | 36 nBlocks = grid.nBlocks(); |
72 intf = grid.connections{i,j}; | 67 intf = grid.connections{i,j}; |
73 if isempty(intf) | 68 if isempty(intf) |
74 continue | 69 continue |
75 end | 70 end |
76 | 71 |
77 intfOpts = interfaceOptions{i,j}; | 72 [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, intfOpts{i,j}); |
78 | |
79 [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, intfOpts{1}); | |
80 D{i,i} = D{i,i} + ii; | 73 D{i,i} = D{i,i} + ii; |
81 D{i,j} = D{i,j} + ij; | 74 D{i,j} = D{i,j} + ij; |
82 | 75 |
83 [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, intfOpts{2}); | 76 [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, intfOpts{i,j}); |
84 D{j,j} = D{j,j} + jj; | 77 D{j,j} = D{j,j} + jj; |
85 D{j,i} = D{j,i} + ji; | 78 D{j,i} = D{j,i} + ji; |
86 end | 79 end |
87 end | 80 end |
88 obj.D = blockmatrix.toMatrix(D); | 81 obj.D = blockmatrix.toMatrix(D); |