1function [omesh,onodes,oelements]=Usubmesh(imesh,intrfc,sdl,short) 2 3# 4# [omesh,onodes,oelements]=Usubmesh(imesh,intrfc,sdl,short) 5# 6# builds the mesh structure for 7# the given list 8# of subdomains sdl 9# 10# NOTE: the intrfc parameter is unused and only kept 11# as a legacy 12 13 14 15% This file is part of 16% 17% SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator 18% ------------------------------------------------------------------- 19% Copyright (C) 2004-2006 Carlo de Falco 20% 21% 22% 23% SECS2D is free software; you can redistribute it and/or modify 24% it under the terms of the GNU General Public License as published by 25% the Free Software Foundation; either version 2 of the License, or 26% (at your option) any later version. 27% 28% SECS2D is distributed in the hope that it will be useful, 29% but WITHOUT ANY WARRANTY; without even the implied warranty of 30% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31% GNU General Public License for more details. 32% 33% You should have received a copy of the GNU General Public License 34% along with SECS2D; If not, see <http://www.gnu.org/licenses/>. 35 36 37 38 39 40nsd = length(sdl); 41 42####### 43# the shp field will remain unchanged 44if (~short) 45 omesh.shp = imesh.shp; 46end 47 48####### 49# set list of output triangles 50oelements=[]; 51for isd=1:nsd 52 oelements = [oelements find(imesh.t(4,:)==sdl(isd))]; 53end 54 55omesh.t = imesh.t(:,oelements); 56 57####### 58# discard unneeded part of shg and wjacdet 59if (~short) 60 omesh.shg= imesh.shg(:,:,oelements); 61 omesh.wjacdet = imesh.wjacdet(:,oelements); 62end 63 64####### 65# set list of output nodes 66onodes = unique(reshape(imesh.t(1:3,oelements),1,[])); 67omesh.p = imesh.p(:,onodes); 68 69 70####### 71# use new node numbering in connectivity matrix 72indx(onodes) = [1:length(onodes)]; 73iel = [1:length(oelements)]; 74omesh.t(1:3,iel) = indx(omesh.t(1:3,iel)); 75 76####### 77# set list of output edges 78omesh.e =[]; 79for isd=1:nsd 80 omesh.e = [omesh.e imesh.e(:,imesh.e(7,:)==sdl(isd))]; 81 omesh.e = [omesh.e imesh.e(:,imesh.e(6,:)==sdl(isd))]; 82end 83omesh.e=unique(omesh.e',"rows")'; 84 85####### 86# use new node numbering in boundary segment list 87ied = [1:size(omesh.e,2)]; 88omesh.e(1:2,ied) = indx(omesh.e(1:2,ied)); 89 90% Last Revision: 91% $Author: adb014 $ 92% $Date: 2008-02-04 16:26:27 +0100 (man, 04 feb 2008) $ 93 94