diff +rv/+diffops/constructFluxDiffOps.m @ 1190:79618b58b0a0 feature/rv

Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 08 Jul 2019 15:12:19 +0200
parents +rv/+diffops/constructFluxDiffOp.m@65a577db5ca0
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+rv/+diffops/constructFluxDiffOps.m	Mon Jul 08 15:12:19 2019 +0200
@@ -0,0 +1,15 @@
+function [D_f, closures, penalties] = constructFluxDiffOps(scheme, g, order, schemeParams, opSet, BCs)
+    diffOp = scheme(g, order, schemeParams{:}, opSet);
+    if ~isa(diffOp.D, 'function_handle')
+        D_f = @(v) diffOp.D*v;
+    else
+        D_f = diffOp.D;
+	end
+    penalties = cell(size(BCs));
+    closures = cell(size(BCs));
+    for i = 1:size(BCs,1)
+        for j = 1:size(BCs,2)
+            [closures{i,j}, penalties{i,j}] = diffOp.boundary_condition(BCs{i,j}.boundary, BCs{i,j}.type);
+        end
+    end
+end
\ No newline at end of file