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


function utildemo
% UTILDEMO shows how to load initial mesh from a saved .mat file and how to
% use the utilities included in the package for debug purpose
%

% C. Zhang 10-13-2006

clear all; 

figure(1); set(gcf,'Units','normal'); set(gcf,'Position',[0.1,0.1,0.8,0.8]);


%--------------------------------------------------------------------------
% Load the initial mesh generated before hand
%--------------------------------------------------------------------------
load femesh.mat; 

%--------------------------------------------------------------------------
% Show current mesh
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
title('showmesh(node, elem)', 'FontSize',14);
pause

%--------------------------------------------------------------------------
% Plot node indices
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
plotnode(node); title('plotnode(node)', 'FontSize', 14);
pause

%--------------------------------------------------------------------------
% Plot element indices
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
plotelem(node,elem); title('plotelem(node,elem)', 'FontSize', 14);
pause

%--------------------------------------------------------------------------
% Plot edeg indices
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
edge = [elem(:,[1,2]); elem(:,[1,3]); elem(:,[2,3])];
edge = unique(sort(edge,2),'rows');
plotelem(node,edge); title('plotedge(node,edge)', 'FontSize', 14);
pause

%--------------------------------------------------------------------------
% Find a node 
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
findnode(node, 10); findnode(node, 21); findnode(node, 19); 
title('findnode(node, i)', 'FontSize', 14);
pause

%--------------------------------------------------------------------------
% Find an element
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
findelem(node, elem, 8); findelem(node, elem, 2); findelem(node, elem, 18); 
title('findelem(node, elem, i)', 'FontSize', 14);
pause

%--------------------------------------------------------------------------
% Find an edge
%--------------------------------------------------------------------------
hold off; showmesh(node, elem); hold on;
findedge(node, elem, 6); findedge(node, elem, 16); findedge(node, elem, 30);
title('findedge(node, edge, i)', 'FontSize', 14);

pause

%--------------------------------------------------------------------------
% Find an edge
%--------------------------------------------------------------------------
close(1); toolkit(node,elem);

%--------------------------------------------------------------------------
% End of function UTILDEMO
%--------------------------------------------------------------------------