www.pudn.com > AFEM@matlab.rar > getmesh.m, change:2006-10-17,size:1537b


function mesh = getmesh(node,elem,Dirichlet,Neumann,type,solu)
% GETMESH generates initial mesh data structure.
% 
% USAGE
%    mesh = getmesh(node,elem,Dirichlet,Neumann,type,solu)
%
% INPUT 
%       node:  array of nodes (required)
%       elem:  array of element indices (required)
%  Dirichlet:  Dirichlet boundary edges (required)
%    Neumann:  Neumann boundary edges (required)
%       type:  node in use (optional)
%       solu:  initial solution (optional)
%
% OUTPUT
%    mesh:  current mesh
%

% L. Chen & C. Zhang 10-15-2006

%--------------------------------------------------------------------------
% Generate opitional data
%--------------------------------------------------------------------------
if nargin <= 5, solu = zeros(size(node,1),1); end
if nargin <= 4, type = uint8(ones(size(node,1),1)); end

%--------------------------------------------------------------------------
% Label the mesh by the longest edge rule
%--------------------------------------------------------------------------
elem = label(node,elem);

%--------------------------------------------------------------------------
% Generate mesh data structure
%--------------------------------------------------------------------------
mesh = struct('node',node, 'elem',elem, 'type',type, 'solu',solu, ...
              'Dirichlet',Dirichlet, 'Neumann',Neumann);
      
%--------------------------------------------------------------------------
% End of function GETMESH
%--------------------------------------------------------------------------