function ele = elements_mesh(mesh)
% The code is written by Behnaz Pirzamanbein, bepi@dtu.dk last version
% 2020.04.10
sz0 = size(mesh);
ny = sz0(1);
nz = sz0(2);
cnt = 1;
ele = zeros((nz-1)*(ny-1),9);
%h = waitbar(0,'1','Name',inputname(mesh));
for j = 1:ny-1
    for k = 1:nz-1
        i = (j-1)*nz+k;
        ele(cnt,:)=[cnt i ny*nz+i ny*nz+nz+i nz+i i+1 ny*nz+i+1 ny*nz+nz+i+1 nz+i+1];
        cnt=cnt+1; 
    end
    %waitbar(j/(ny-1),h,sprintf('j: %d',j))
end
%close(h)

end