view +rv/+diffops/addClosuresToDiffOp.m @ 1172:9dd10dcff128 feature/rv

Dont return penalty terms from operators on coarse grid. One can use the penalty terms constructed for the fine grid
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 28 Jun 2019 13:22:03 +0200
parents 65a577db5ca0
children 79618b58b0a0
line wrap: on
line source

function [D, penalties] = addClosuresToDiffOp(diffOp, D, BCs)
    penalties = cell(size(BCs));
    for i = 1:size(BCs,1)
        for j = 1:size(BCs,2)
            [closure, penalties{i,j}] = diffOp.boundary_condition(BCs{i,j}.boundary, BCs{i,j}.type);
            if ~isa(closure, 'function_handle')
                closure = @(v) closure*v;
            end
            D = @(v) D(v) + closure(v);
        end
    end
end