Home > vbmeg > external > iso2mesh > maxsurf.m

maxsurf

PURPOSE ^

SYNOPSIS ^

function [f maxsize]=maxsurf(facecell,node)

DESCRIPTION ^

 [f maxsize]=maxsurf(facecell,node)

 return the surface with the maximum element number or  
 total area from a cell arry of surfaces

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    facecell: a cell array, each element is a face array
    node: optional, node list, if given, the output is the
          surface with the largest surface area.

 output:
    f: the surface data (node indices) for the surface with the 
       most elements (or largest area when node is given)
    maxsize: if node is not given, maxisize is row number of f;
             otherwise, maxsize is the total area of f

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [f maxsize]=maxsurf(facecell,node)
0002 %
0003 % [f maxsize]=maxsurf(facecell,node)
0004 %
0005 % return the surface with the maximum element number or
0006 % total area from a cell arry of surfaces
0007 %
0008 % author: Qianqian Fang, <q.fang at neu.edu>
0009 %
0010 % input:
0011 %    facecell: a cell array, each element is a face array
0012 %    node: optional, node list, if given, the output is the
0013 %          surface with the largest surface area.
0014 %
0015 % output:
0016 %    f: the surface data (node indices) for the surface with the
0017 %       most elements (or largest area when node is given)
0018 %    maxsize: if node is not given, maxisize is row number of f;
0019 %             otherwise, maxsize is the total area of f
0020 %
0021 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0022 %
0023 
0024 maxsize=-1;
0025 maxid=-1;
0026 
0027 if(nargin==2)
0028     areas=zeros(1,length(facecell));
0029     for i=1:length(facecell)
0030        areas(i)=sum(elemvolume(node(:,1:3),facecell{i}));
0031     end
0032     [maxsize,maxid]=max(areas);
0033     f=facecell{maxid};
0034     return;
0035 else
0036     for i=1:length(facecell)
0037     if(length(facecell{i})>maxsize)
0038         maxsize=length(facecell{i});
0039         maxid=i;
0040     end
0041     end
0042     f=[];
0043     if(maxid>0)
0044     f=facecell{maxid};
0045     end
0046 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005