1 function gpart = onedgrid_gridpart(grid,eind);
2 %
function gpart = onedgrid_gridpart(grid,eind);
4 %
function extracting a subgrid of grid with given indices and
5 % correct neighbour information.
7 error(
'eind not sorted!');
9 gpart.nelements = length(eind);
11 % initally mark all neighbours to non-existing
12 gpart.NBI = -10 * ones(length(eind),2);
13 %
set existing right neighbours
14 ndiff = [eind(2:end),0] - eind; % ndiff==1
if left neighbour in eind
17 %
set existing left neighbours
18 ndiff = eind - [1e10, eind(1:end-1)]; % ndiff==1
if left neighbour in eind
21 %
set existing dirichlet-boundary
23 gpart.NBI(1,2)= grid.NBI(1,2);
25 if eind(end) == grid.nelements
26 gpart.NBI(end,1)= grid.NBI(end,1);