%--------------------------------- 
% NPCODE.m 
%  
% A user INCLUDE code
%
% LNP(I,J,K) = node K, on side J
% of element I.
%-------------------------------------

% --------------------------------
% Set n-factor for number of nodes 
% on a side
% --------------------------------
   if NNPE == 6 | NNPE == 8
      n=2;
   else
      n=1;
   end  

% ------------------------
% Initialize NPcode array
% ------------------------
   for i=1:NUMNP
      NPcode(i)=0;
   end

%  ---------------------------------
%  Set NPcode = 1 on  lower boundary
%  ---------------------------------
   IEND = n*NDIV(1,1)+1; 
   for I=1:IEND
      NI=LNP(1,1,I);  
      NPcode(NI)=1;
   end

%  -----------------------------------
%  Set NPcode = 2 on right side of mesh
%  -----------------------------------
   IEND = n*NDIV(2,2)+1; 
   for I=1:IEND
      NI=LNP(2,2,I);  
      NPcode(NI)=2;
   end

%  ---------------------------------
%  Set NPcode = 3 on  top boundary
%  ---------------------------------
   IEND = n*NDIV(3,3)+1; 
   for I=1:IEND
      NI=LNP(3,3,I);  
      NPcode(NI)=3;
   end

%  ------------------------------------
%  Set NPcode = 4 on left side of mesh
%  ------------------------------------
   IEND = n*NDIV(1,4)+1; 
   for I=1:IEND
      NI=LNP(1,4,I);  
      NPcode(NI)=4;
   end

   IEND = n*NDIV(4,1)+1; 
   for I=1:IEND
      NI=LNP(4,1,I);  
      NPcode(NI)=4;
   end

   IEND = n*NDIV(3,4)+1; 
   for I=1:IEND
      NI=LNP(3,4,I);  
      NPcode(NI)=4;
   end

% ----------------------------------
% Set NPcode for corner points
% ----------------------------------
  NI=LNP(1,1,1);
  NPcode(NI) = 11;

  NI=LNP(1,2,1);
  NPcode(NI) = 12;

  NI=LNP(3,3,1);
  NPcode(NI) = 22;

  NI=LNP(3,4,1);
  NPcode(NI) = 21;


