]> Creatis software - CreaPhase.git/blob - octave_packages/secs2d-0.0.8/Utilities/Updegrad.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs2d-0.0.8 / Utilities / Updegrad.m
1 function [Fx,Fy]=Updegrad(mesh,F);
2
3 % [Fx,Fy]=Updegrad(mesh,F);
4 %
5 % computes piecewise constant
6 % gradient of a piecewise linear
7 % scalar function F defined on
8 % the mesh structure described by mesh
9
10
11
12 % This file is part of 
13 %
14 %            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
15 %         -------------------------------------------------------------------
16 %            Copyright (C) 2004-2006  Carlo de Falco
17 %
18 %
19 %
20 %  SECS2D is free software; you can redistribute it and/or modify
21 %  it under the terms of the GNU General Public License as published by
22 %  the Free Software Foundation; either version 2 of the License, or
23 %  (at your option) any later version.
24 %
25 %  SECS2D is distributed in the hope that it will be useful,
26 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
27 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28 %  GNU General Public License for more details.
29 %
30 %  You should have received a copy of the GNU General Public License
31 %  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
32
33
34
35
36 shgx = reshape(mesh.shg(1,:,:),3,[]);
37 Fx = sum(shgx.*F(mesh.t(1:3,:)),1);
38 shgy = reshape(mesh.shg(2,:,:),3,[]);
39 Fy = sum(shgy.*F(mesh.t(1:3,:)),1);