view diags.m @ 1329:7df63b17e078 feature/D2_boundary_opt

Add support for boundary optimized grids in DefCurvilinear, and add boundaryOptimizedCurvilinear for constructing a curvilinear grid with boundary optimized grid point placement.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 14 Feb 2022 14:55:29 +0100
parents 0b87863cb29c
children
line wrap: on
line source

function A = diags(B,d,m,n)
    assert(size(B,1) == m);

    A = repmat(B(:,1)*0, [1, n]);

    for i = 1:size(B,2)
        A(:,d(i)+ (1:m)) = A(:,d(i)+ (1:m)) + diag(B(:,i));
    end
end