]> Creatis software - CreaPhase.git/blob - octave_packages/secs2d-0.0.8/Utilities/Ucomplap.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs2d-0.0.8 / Utilities / Ucomplap.m
1 function L = Ucomplap (mesh,coeff)
2   
3                                 % L = Ufastcomplap (mesh,coeff)
4
5
6 % This file is part of 
7 %
8 %            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
9 %         -------------------------------------------------------------------
10 %            Copyright (C) 2004-2006  Carlo de Falco
11 %
12 %
13 %
14 %  SECS2D is free software; you can redistribute it and/or modify
15 %  it under the terms of the GNU General Public License as published by
16 %  the Free Software Foundation; either version 2 of the License, or
17 %  (at your option) any later version.
18 %
19 %  SECS2D is distributed in the hope that it will be useful,
20 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 %  GNU General Public License for more details.
23 %
24 %  You should have received a copy of the GNU General Public License
25 %  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
26
27   
28   Nnodes = length(mesh.p);
29   Nelements = length(mesh.t);
30   
31   %%fprintf(1,'*--------------------*\n');
32   %%fprintf(1,'building Stiffness Matrix\n*');
33   
34   areak   = reshape(sum( mesh.wjacdet,1),1,1,Nelements);
35   shg     = mesh.shg(:,:,:);
36   M       = reshape(coeff,1,1,Nelements);
37   
38                                 % build local matrix    
39   Lloc=zeros(3,3,Nelements);    
40   for inode=1:3
41     for jnode=1:3
42       
43       Lloc(inode,jnode,:) = M .* sum( shg(:,inode,:) .* shg(:,jnode,:),1) .* areak;
44       %%fprintf(1,'-');
45       
46       ginode(inode,jnode,:)=mesh.t(inode,:);
47       gjnode(inode,jnode,:)=mesh.t(jnode,:);
48       
49       %%fprintf(1,'-');
50       
51     end
52   end           
53   
54   L = sparse(ginode(:),gjnode(:),Lloc(:));
55   %%fprintf(1,'--*\nDONE!\n\n\n');
56   
57