function [number,node2degree]=FindDOF(nodes)
% [number,node2degree]=FindDOF(nodes)
%   compute the number of degrees of freedom (DOF) in a given mesh
%
%   number gives the number of DOF
%   node2degree is a n column vector
%     component k gives the number of the degrees of freedom
%     if node2degree(k)==0 then we have a Dirichlet node, i.e. value of 
%     solution at this node is known
%
%     nodes is a nx3 matrix, the third column contains information about 
%     the type of node   0: interior node
%                        1: boundary node, Dirichlet type
%                        2: boundary node, Neumann type

number=0;
ln=length(nodes);
node2degree=zeros(ln,1);
for k=1:ln
  if (nodes(k,3)==0||nodes(k,3)==2) number++; node2degree(k)=number; endif
endfor
endfunction
