function [uzly,prvky,ID,I] = diskretizuj_obdelnik_blokove(a,b,h,Nx,Ny)

nx = floor(a/h);
nxPerDomain = (nx+1)/Nx;
ny = floor(b/h);
nyPerDomain = (ny+1)/Ny;
hx = a/nx;
hy = b/ny;

n = (nx+1)*(ny+1);
m = nx*ny*2;

uzly = zeros(2,n);
prvky = zeros(3,m);
ID = [];

idx_uzly = 1;
idx_prvky = 1;

for i=1:Nx*Ny
    I{i} = [];
end

for i=0:nx
    x = i*hx;
    
    ix = ceil((i+1)/nxPerDomain);
    
    for j=0:ny
        y = j*hy;
        
        iy = ceil((j+1)/nyPerDomain);
        
        uzly(:,idx_uzly) = [x;y];
        
        if i>0 && j>0
            idx1 = idx_uzly-(ny+1)-1;
            idx2 = idx1+1;
            idx3 = idx_uzly-1;
            idx4 = idx_uzly;
            prvky(:,idx_prvky) = [ idx1 ; idx3 ; idx4 ];
            prvky(:,idx_prvky+1) = [ idx1 ; idx4 ; idx2 ];
            idx_prvky = idx_prvky+2;           
        end
        
        if i==0 || j==0 || i==nx || j==ny
            ID = [ ID , idx_uzly];
        end

        iDomain = (ix-1)*Ny+iy;
        I{iDomain} = [I{iDomain},idx_uzly];

        idx_uzly = idx_uzly + 1;
                
    end    
end