rbmatlab 0.10.01
grid/common/index_ext.m
00001 function einds_ext = index_ext(grid, einds, neigh_steps)
00002 %function einds_ext = index_ext(grid, einds, neigh_steps)
00003 %
00004 % function computing the sorted list of element indicés, which are
00005 % given by the neigh_steps number of neighbours of the elements with
00006 % indices einds in grid.
00007 % e.g. for neigh_steps = 0: einds_ext = einds 
00008 % e.g. for neigh_steps = 1: einds_ext = einds plus all edge-neighbours
00009 %      of elements 
00010 % e.g. for neigh_steps = 2: einds_ext = einds plus all edge-neighbours
00011 %      of elements plus all edge neighbours of these.
00012 
00013 % Bernard Haasdonk 18.6.2010
00014 
00015 mask = zeros(1,grid.nelements);
00016 mask(einds) = 1;
00017 einds_ext = einds;
00018 for n = 1:neigh_steps
00019   nbi  = grid.NBI(einds_ext,:);
00020   i    = find(nbi>0);
00021   mask(nbi(i)) = n+1;
00022   einds_ext = find(mask>0);
00023 end;
All Classes Namespaces Files Functions Variables