Home > vbmeg > external > iso2mesh > removedupnodes.m

removedupnodes

PURPOSE ^

SYNOPSIS ^

function [newnode,newelem]=removedupnodes(node,elem,tol)

DESCRIPTION ^

 [newnode,newelem]=removedupnodes(node,elem)

 removing the duplicated nodes from a mesh

 author: Qianqian Fang <fangq at nmr.mgh.harvard.edu>

 input:
   elem: integer array with dimensions of NE x 4, each row contains
         the indices of all the nodes for each tetrahedron
   node: node coordinates, 3 columns for x, y and z respectively

 output:
   newnode: nodes without duplicates
   newelem: elements with only the unique nodes


 -- 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 [newnode,newelem]=removedupnodes(node,elem,tol)
0002 %
0003 % [newnode,newelem]=removedupnodes(node,elem)
0004 %
0005 % removing the duplicated nodes from a mesh
0006 %
0007 % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu>
0008 %
0009 % input:
0010 %   elem: integer array with dimensions of NE x 4, each row contains
0011 %         the indices of all the nodes for each tetrahedron
0012 %   node: node coordinates, 3 columns for x, y and z respectively
0013 %
0014 % output:
0015 %   newnode: nodes without duplicates
0016 %   newelem: elements with only the unique nodes
0017 %
0018 %
0019 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0020 %
0021 
0022 if(nargin>=3 && tol~=0)
0023     node=round(node/tol)*tol;
0024 end
0025 [newnode,I,J]=unique(node,'rows');
0026 if(iscell(elem))
0027     newelem=cellfun(@(x) J(x)', elem,'UniformOutput',false);
0028 else
0029     newelem=J(elem);
0030 end

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