1 function [Fx,Fy]=Updegrad(mesh,F);
3 % [Fx,Fy]=Updegrad(mesh,F);
5 % computes piecewise constant
6 % gradient of a piecewise linear
7 % scalar function F defined on
8 % the mesh structure described by mesh
12 % This file is part of
14 % SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
15 % -------------------------------------------------------------------
16 % Copyright (C) 2004-2006 Carlo de Falco
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.
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.
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/>.
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);