rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
gridpart.m
1 function gridp = gridpart(grid,eind)
2 %function gridp = gridpart(grid,eind)
3 %
4 % function extracting a part of a triagrid, rectgrid or onedgrid
5 % defined by the given
6 % element indices in the vector eind. The neighbour information of
7 % the new resulting boundaries is set to -10
8 
9 % Bernard Haasdonk 18.6.2010
10 
11 %keyboard;
12 gridp = onedgrid(grid);
13 gridp.X = grid.X(eind);
14 gridp.nelements = length(eind);
15 gridp.global_eind = grid.global_eind(eind); % store original element indices
16 
17 % generate elementid translation map: T \mapsto T_{local}
18 new_el_id = zeros(1,grid.nelements);
19 new_el_id(eind) = 1:length(eind);
20 
21 gridp.NBI = grid.NBI(eind,:);
22 i = find(gridp.NBI>0);
23 gridp.NBI(i) = new_el_id(gridp.NBI(i));
24 i = find(gridp.NBI == 0);
25 if ~isempty(i)
26  gridp.NBI(i)= -10;
27 end;
28 
A triangular conforming grid in two dimensions.
Definition: triagrid.m:17
A cartesian rectangular grid in two dimensions with axis parallel elements.
Definition: rectgrid.m:17
a one dimensional grid implementation
Definition: onedgrid.m:17