diff +multiblock/DiffOp.m @ 907:c0652621bd69 feature/utux2D

Add new class multiblock.InterfaceOptions whose instances are passed to multiblock.DiffOp.
author Martin Almquist <malmquist@stanford.edu>
date Fri, 23 Nov 2018 20:12:54 -0800
parents 703183ed8c8b
children d232483eb72f
line wrap: on
line diff
--- a/+multiblock/DiffOp.m	Fri Nov 23 20:07:13 2018 -0800
+++ b/+multiblock/DiffOp.m	Fri Nov 23 20:12:54 2018 -0800
@@ -10,7 +10,7 @@
     end
 
     methods
-        function obj = DiffOp(doHand, grid, order, doParam, interfaceType)
+        function obj = DiffOp(doHand, grid, order, doParam, interfaceOptions)
             %  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,18 +25,20 @@
             %            doHand(..., doParam{i}{:}) Otherwise doParam is sent as
             %            extra parameters to all doHand: doHand(..., doParam{:})
             %
-            % interfaceType -- nBlocks x nBlocks cell array of types that specify
-            %                  that particular block-coupling is handled. (Could
-            %                  be non-conforming interface, etc.)
-            %                  Default: empty cell array.
+            % interfaceOptions (optional) -- An instance of class multiblock.InterfaceOptions
+            %                                               OR
+            %                                 nBlocks x nBlocks cell array of opts for
+            %                                 every interface.
             default_arg('doParam', [])
+            default_arg('interfaceOptions', multiblock.InterfaceOptions(grid) ); % Empty options
+            if isa(interfaceOptions, 'multiblock.InterfaceOptions');
+                interfaceOptions = interfaceOptions.getOptions;
+            end
 
             [getHand, getParam] = parseInput(doHand, grid, doParam);
 
+            obj.order = order;
             nBlocks = grid.nBlocks();
-            default_arg('interfaceType', cell(nBlocks, nBlocks));
-
-            obj.order = order;
 
             % Create the diffOps for each block
             obj.diffOps = cell(1, nBlocks);
@@ -72,11 +74,13 @@
                         continue
                     end
 
-                    [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, interfaceType{i,j});
+                    intfOpts = interfaceOptions{i,j};
+
+                    [ii, ij] = obj.diffOps{i}.interface(intf{1}, obj.diffOps{j}, intf{2}, intfOpts{1});
                     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}, interfaceType{j,i});
+                    [jj, ji] = obj.diffOps{j}.interface(intf{2}, obj.diffOps{i}, intf{1}, intfOpts{2});
                     D{j,j} = D{j,j} + jj;
                     D{j,i} = D{j,i} + ji;
                 end