DM_REFINE_POINTS: refine distmesh volume at point locations: h= dm_refine_points( pts, params ); pts is an array NxDims of node positions params.refine_pts - points at which to refine mesh (NxNdims) params.base_spacing - edge length away from refined nodes (eg 0.1) params.refine_ratio - relative refinement near points (eg. 10) params.gradient - transition slope of refinement (eg 0.1)
0001 function h = dm_refine_points( pts, params ); 0002 % DM_REFINE_POINTS: refine distmesh volume at point locations: 0003 % h= dm_refine_points( pts, params ); 0004 % pts is an array NxDims of node positions 0005 % params.refine_pts - points at which to refine mesh (NxNdims) 0006 % params.base_spacing - edge length away from refined nodes (eg 0.1) 0007 % params.refine_ratio - relative refinement near points (eg. 10) 0008 % params.gradient - transition slope of refinement (eg 0.1) 0009 0010 % (C) 2009 Andy Adler. License: GPL version 2 or version 3 0011 % $Id: dm_refine_points.m 1880 2009-06-23 09:09:29Z aadler $ 0012 0013 ep = params.refine_pts; 0014 maxsize= params.base_spacing; 0015 minsize= params.base_spacing / params.refine_ratio; 0016 grad = params.gradient; 0017 0018 op = ones(size(pts,1),1); 0019 for i=1:size(ep,1); 0020 de = sqrt( sum( (pts - op*ep(i,:)).^2 ,2) ); 0021 h_i = min(minsize+grad*de,maxsize); 0022 if i==1; h=h_i; 0023 else h = min(h,h_i); 0024 end 0025 end 0026