diff +multiblock/DiffOp.m @ 884:7d4f57725192 feature/poroelastic

Add a getBoundaryOperator method in multiblock.DiffOp that uses the the diffop get_boundary_operator method rather than its properties. Werpers might not like this.
author Martin Almquist <malmquist@stanford.edu>
date Fri, 02 Nov 2018 10:47:03 -0700
parents 5cf9fdf4c98f
children 386ef449df51 72cd29107a9a
line wrap: on
line diff
--- a/+multiblock/DiffOp.m	Fri Nov 02 10:44:59 2018 -0700
+++ b/+multiblock/DiffOp.m	Fri Nov 02 10:47:03 2018 -0700
@@ -148,6 +148,28 @@
             end
         end
 
+        % Get a boundary operator specified by opName for the given boundary/BoundaryGroup
+        function op = getBoundaryOperatorWrapper(obj, opName, boundary)
+            switch class(boundary)
+                case 'cell'
+                    blockId = boundary{1};
+                    localOp = obj.diffOps{blockId}.get_boundary_operator(opName, boundary{2});
+
+                    div = {obj.blockmatrixDiv{1}, size(localOp,2)};
+                    blockOp = blockmatrix.zero(div);
+                    blockOp{blockId,1} = localOp;
+                    op = blockmatrix.toMatrix(blockOp);
+                    return
+                case 'multiblock.BoundaryGroup'
+                    op = sparse(size(obj.D,1),0);
+                    for i = 1:length(boundary)
+                        op = [op, obj.getBoundaryOperatorWrapper(opName, boundary{i})];
+                    end
+                otherwise
+                    error('Unknown boundary indentifier')
+            end
+        end
+
         function op = getBoundaryQuadrature(obj, boundary)
             opName = 'H';
             switch class(boundary)