OptFEM3DP1 Toolbox: Opt/MassAssembling3DP1OptV0.m Source File

| OptFEM3DP1 Toolbox 20130614_170440 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Variables Pages
MassAssembling3DP1OptV0.m
Go to the documentation of this file.
1 function M=MassAssembling3DP1OptV0(nq,nme,me,volumes)
2 % function M=MassAssembling3DP1OptV0(nq,nme,me,volumes)
3 % Assembly of the Mass Matrix by `P_1`-Lagrange finite elements in 3D
4 % - OptV0 version (see report).
5 %
6 % The Mass Matrix `\Masse` is given by
7 % ``\Masse_{i,j}=\int_\DOMH \FoncBase_i(\q)\, \FoncBase_j(\q)\, d\q,\ \forall (i,j)\in{\ENS{1}{\nq}}^2``
8 % where `\FoncBase_i` are `P_1`-Lagrange basis functions.
9 % Parameters:
10 % nq: total number of vertices, also denoted by `\nq`.
11 % nme: total number of elements, also denoted by `\nme`.
12 % me: Connectivity array, `4\times\nme` array. <br/>
13 % `\me(\jl,k)` is the storage index of the
14 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
15 % `k\in{\ENS{1}{\nme}}`.
16 % volumes: Array of volumes, `1\times\nme array`. volumes(k) is the volume
17 % of the k-th tetrahedron.
18 %
19 % Return values:
20 % M: Global mass matrix, `\nq\times\nq` sparse matrix.
21 %
22 % Example:
23 % @verbatim
24 % Th=CubeMesh(10);
25 % M=MassAssembling3DP1OptV0(Th.nq,Th.nme,Th.me,Th.volumes);
26 % @endverbatim
27 %
28 % See also:
29 % #ElemMassMat3DP1D0
30 % Copyright:
31 % See \ref license
32 M=sparse(nq,nq);
33 for k=1:nme
34 I=me(:,k);
35 M(I,I)=M(I,I)+ElemMassMat3DP1D0(volumes(k));
36 end