function [Uzly,Dimenze,Hrany,Prvky,Matice,PraveStrany,Omegy,Interpolace] = multigrid2D_setup(L)

% function [Uzly,Dimenze,Hrany,Prvky,Matice,PraveStrany,Omegy,Interpolace] = multigrid2D_setup(L)

h = 0.5;
[uzly,prvky,ID,IN,hrany,okrajoveHrany] = diskretizuj_obdelnik(1,1,h);
Uzly{1} = uzly;
Dimenze{1} = size(uzly,2);
Hrany{1} = hrany;
Prvky{1} = prvky;
Interpolace{1} = [];

n = size(uzly,2);
m = size(prvky,2);
ID = sort(union(hrany(1,okrajoveHrany),hrany(2,okrajoveHrany)));
f = ones(m,1);
[A,b] = mkp_2d(uzly,prvky,f,ID);
Matice{1} = A;
PraveStrany{1} = b;
    
    
for l=2:L
l
    [noveUzly,noveHrany,novePrvky,noveOkrHrany] = refine_L1tri(uzly,hrany,prvky,okrajoveHrany);        
    Uzly{l} = noveUzly;
    n = size(noveUzly,2);
    Dimenze{l} = n;
    Prvky{l} = novePrvky;
    m = size(novePrvky,2);
    Hrany{l} = noveHrany;
        
    uzly = noveUzly;
    hrany = noveHrany;
    prvky = novePrvky;
    okrajoveHrany = noveOkrHrany;
        
    ID = sort(union(hrany(1,okrajoveHrany),hrany(2,okrajoveHrany)));
    f = ones(m,1);
    [A,b] = mkp_2d(uzly,prvky,f,ID);
    Matice{l} = A;
    PraveStrany{l} = b;
    
    Omegy{l} = 1/Gershgorin(A);
    
    Interpolace{l} = speye(n,Dimenze{l-1});
    for i=1:size(Hrany{l-1},2)
        Interpolace{l}(Dimenze{l-1}+i,Hrany{l-1}(:,i)) = [1/2,1/2];
    end

end