quality=meshquality(node,elem) compute the Joe-Liu mesh quality measure of an N-D mesh (N<=3) author: Qianqian Fang, <q.fang at neu.edu> date: 2011/02/26 input: node: node coordinates of the mesh (nn x 3) elem: element table of an N-D mesh (ne x (N+1)) output: quality: a vector of the same length as size(elem,1), with each element being the Joe-Liu mesh quality metric (0-1) of the corresponding element. A value close to 1 represents higher mesh quality (1 means equilateral tetrahedron); a value close to 0 means nearly degenerated element. reference: A. Liu, B. Joe, Relationship between tetrahedron shape measures, BIT 34 (2) (1994) 268-287. -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function quality=meshquality(node,elem,maxnode) 0002 % 0003 % quality=meshquality(node,elem) 0004 % 0005 % compute the Joe-Liu mesh quality measure of an N-D mesh (N<=3) 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % date: 2011/02/26 0009 % 0010 % input: 0011 % node: node coordinates of the mesh (nn x 3) 0012 % elem: element table of an N-D mesh (ne x (N+1)) 0013 % 0014 % output: 0015 % quality: a vector of the same length as size(elem,1), with 0016 % each element being the Joe-Liu mesh quality metric (0-1) of 0017 % the corresponding element. A value close to 1 represents 0018 % higher mesh quality (1 means equilateral tetrahedron); 0019 % a value close to 0 means nearly degenerated element. 0020 % 0021 % reference: 0022 % A. Liu, B. Joe, Relationship between tetrahedron shape measures, 0023 % BIT 34 (2) (1994) 268-287. 0024 % 0025 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0026 % 0027 0028 if(nargin<3) 0029 maxnode=4; 0030 end 0031 if(size(elem,2)>maxnode) 0032 elem=elem(:,1:maxnode); 0033 end 0034 enum=size(elem,1); 0035 vol=elemvolume(node,elem); 0036 edges=meshedge(elem); 0037 ed=node(edges(:,1),:)-node(edges(:,2),:); 0038 ed=sum((ed.*ed)'); 0039 ed=sum(reshape(ed,[enum length(ed)/enum])')'; 0040 dim=size(elem,2)-1; 0041 0042 coeff=10/9; % for tetrahedral 0043 if(dim==2) 0044 coeff=1; 0045 end 0046 quality=coeff*dim*2^(2*(1-1./dim))*3^((dim-1)/2)*vol.^(2/dim)./ed; 0047 maxquality=max(quality); 0048 if(maxquality>1) 0049 quality=quality./maxquality; 0050 end