rbmatlab 0.10.01
grid/@onedgrid/gridpart.m
00001 function gridp = gridpart(grid,eind)
00002 %function gridp = gridpart(grid,eind)
00003 %
00004 % function extracting a part of a triagrid, rectgrid or onedgrid 
00005 % defined by the given 
00006 % element indices in the vector eind. The neighbour information of
00007 % the new resulting boundaries is set to -10
00008 
00009 % Bernard Haasdonk 18.6.2010
00010 
00011 %keyboard;
00012 gridp = onedgrid(grid);
00013 gridp.X = grid.X(eind);
00014 gridp.nelements = length(eind);
00015 gridp.global_eind = grid.global_eind(eind); % store original element indices
00016 
00017 % generate elementid translation map: T \mapsto T_{local} 
00018 new_el_id = zeros(1,grid.nelements);
00019 new_el_id(eind) = 1:length(eind);
00020 
00021 gridp.NBI = grid.NBI(eind,:);
00022 i = find(gridp.NBI>0);
00023 gridp.NBI(i) = new_el_id(gridp.NBI(i));
00024 i = find(gridp.NBI == 0);
00025 if ~isempty(i)
00026   gridp.NBI(i)= -10;
00027 end;
00028 
All Classes Namespaces Files Functions Variables