savetetgennode(node,fname) save a mesh node list to tetgen .node format author: Qianqian Fang, <q.fang at neu.edu> input: node: node coordinates, dimension (nn,3) columns beyound the 3rd column are treated as markers and attributes associated with the node fname: output file name -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function savetetgennode(node,fname) 0002 % 0003 % savetetgennode(node,fname) 0004 % 0005 % save a mesh node list to tetgen .node format 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % 0009 % input: 0010 % node: node coordinates, dimension (nn,3) 0011 % columns beyound the 3rd column are treated as 0012 % markers and attributes associated with the node 0013 % fname: output file name 0014 % 0015 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0016 % 0017 0018 hasprop=0; 0019 attrstr=''; 0020 markers=''; 0021 0022 fid=fopen(fname,'wt'); 0023 if(fid==0) 0024 error(['can not write to file ' fname]); 0025 end 0026 if(size(node,2)>=5) 0027 hasprop=size(node,2)-4; 0028 attrstr=repmat('%e ',1,hasprop); 0029 end 0030 if(size(node,2)>=4) 0031 markers='%d'; 0032 end 0033 fprintf(fid,'%d %d %d %d\n',size(node,1),3,hasprop,size(node,2)>=4); 0034 fprintf(fid,['%d %e %e %e ' attrstr markers '\n'], [(1:size(node,1))'-1 node]'); 0035 fclose(fid);