function side_array_calc(i,i1,i2,i5,i7)
%   side_array_calc      CALCULATE SIDE ARRAYS   
%   This function makes an array of the nodes on the boundary of the loop,
%   going in order CCW around the loop.
%   Considers each loop independantly

% i : loop number
% i2: ndiv(i,1)+1 (# nodes along one side)
% i5: ndiv(i,2)+1 (# nodes along other side)
% i7: i2*i5 (number of nodes per loop)
global  lnr
global  ndiv

jbgn =1;
jend = i2;

j2 = i7-i2;
j4=i2+1;

for j=jbgn:jend                                        
j4=j4-1;                                                                                                 
lnr(i,1,j)=j;                                    
lnr(i,3,j4)=j2+j;
end

jbgn =1;
jend =i5;

j4=i5+1;

for j=jbgn:jend                                           
j4=j4-1;                                                
lnr(i,2,j)=j*i2;                                
lnr(i,4,j4)=(j-1)*i2+1;
end
