function kindex = kindx(il,jl,N,J)
% Suppose the mesh points are ordered in each row from left to right
% starting with the mesh points at level y=0.
% Given a mesh point of the form (il*h,jl*h),
% with il = N/2-J(jl+1), N/2 + J(jl+1) and
% jl = 0, N/2, we wish to determine the index k of that mesh point
% in an ordered list beginning with 1.
%
N2 = N/2;
kk = 0;
if (jl >0)
for l = 1:jl
kk = kk + 2*J(l) + 1;
end
end
kindex = kk + il - N2 + J(jl+1) + 1;
%