diff +scheme/Utux.m @ 998:2b1b944deae1 feature/getBoundaryOp

Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
author Martin Almquist <malmquist@stanford.edu>
date Sat, 12 Jan 2019 13:35:19 -0800
parents 6d2167719557
children 8d73fcdb07a5
line wrap: on
line diff
--- a/+scheme/Utux.m	Sat Jan 12 11:57:50 2019 -0800
+++ b/+scheme/Utux.m	Sat Jan 12 13:35:19 2019 -0800
@@ -72,6 +72,31 @@
 
          end
 
+        % Returns the boundary operator op for the boundary specified by the string boundary.
+        % op        -- string or a cell array of strings
+        % boundary  -- string
+        function varargout = getBoundaryOperator(obj, op, boundary)
+
+            if ~iscell(op)
+                op = {op};
+            end
+
+            for i = 1:numel(op)
+                switch op{i}
+                case 'e'
+                    switch boundary
+                    case 'l'
+                        e = obj.e_l;
+                    case 'r'
+                        e = obj.e_r;
+                    otherwise
+                        error('No such boundary: boundary = %s',boundary);
+                    end
+                    varargout{i} = e;
+                end
+            end
+        end
+
         function N = size(obj)
             N = obj.m;
         end