nodevol=nodevolume(node,elem) calculate the volumes of the cells in the barycentric dual-mesh (this is different from the Voronoi cells, which blong to the circumcentric dual mesh) author: Qianqian Fang, <q.fang at neu.edu> date: 2009/12/31 input: node: node coordinates elem: element table of a mesh output: nodevol: volume values for all nodes -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function nodevol=nodevolume(node,elem, evol) 0002 % 0003 % nodevol=nodevolume(node,elem) 0004 % 0005 % calculate the volumes of the cells in the barycentric dual-mesh 0006 % (this is different from the Voronoi cells, which blong to the 0007 % circumcentric dual mesh) 0008 % 0009 % author: Qianqian Fang, <q.fang at neu.edu> 0010 % date: 2009/12/31 0011 % 0012 % input: 0013 % node: node coordinates 0014 % elem: element table of a mesh 0015 % 0016 % output: 0017 % nodevol: volume values for all nodes 0018 % 0019 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0020 % 0021 0022 dim=4; 0023 if(size(elem,2)==3) dim=3; end 0024 0025 if(nargin<3) 0026 evol=elemvolume(node,elem(:,1:dim)); 0027 end 0028 0029 elemnum=size(elem,1); 0030 nodenum=size(node,1); 0031 nodevol=zeros(nodenum,1); 0032 for i=1:elemnum 0033 nodevol(elem(i,1:dim))=nodevol(elem(i,1:dim))+evol(i); 0034 end 0035 nodevol=nodevol/dim;