OptFEM2D Toolbox for Matlab  V1.2b1
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
 All Files Functions Pages
ElemMassWMatP1.m
Go to the documentation of this file.
1 function AElem=ElemMassWMatP1(area,w)
2 % function AElem=ElemMassWMatP1(area,w)
3 % Computation of the element weighted mass matrix for
4 % `P_1`-Lagrange finite elements
5 %
6 % Parameters:
7 % area: triangle area (double)
8 % w: values of the weight function at the triangle vertices,
9 % `3\times 1` array (double)
10 %
11 % Return values:
12 % AElem: Element weighted mass matrix, `3\times 3` matrix (double)
13 %
14 % Example:
15 % @verbatim
16 % area=1/2.;
17 % w=ones(3,1);
18 % AElem=ElemMassWMatP1(area);
19 % @endverbatim
20 %
21 % OptFEM2DP1 [V1.2b1] - Copyright (C) 2013 CJS (LAGA)
22 %
23 % This file is part of OptFEM2DP1.
24 % OptFEM2DP1 is free software: you can redistribute it and/or modify
25 % it under the terms of the GNU General Public License as published by
26 % the Free Software Foundation, either version 3 of the License, or
27 % (at your option) any later version.
28 %
29 % OptFEM2DP1 is distributed in the hope that it will be useful,
30 % but WITHOUT ANY WARRANTY; without even the implied warranty of
31 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 % GNU General Public License for more details.
33 %
34 % You should have received a copy of the GNU General Public License
35 % along with this program. If not, see <http://www.gnu.org/licenses/>.
36  AElem=(area/30)*[ 3*w(1)+w(2)+w(3), w(1)+w(2)+w(3)/2, w(1)+w(2)/2+w(3); ...
37  w(1)+w(2)+w(3)/2, w(1)+3*w(2)+w(3), w(1)/2+w(2)+w(3); ...
38  w(1)+w(2)/2+w(3), w(1)/2+w(2)+w(3), w(1)+w(2)+3*w(3)];