OptFEM3DP1 Toolbox  V1.0
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D
 All Files Functions Variables Pages
MassVFAssembling3DP1OptV0.m
Go to the documentation of this file.
1 function M=MassVFAssembling3DP1OptV0(nq,nme,me,volumes,Num)
2 % function M=MassVFAssembling3DP1OptV0(nq,nme,me,volumes,Num)
3 % Assembly of the Mass vectors fields Matrix by `P_1`-Lagrange finite elements in 3D
4 % using OptV0 version (see report).
5 %
6 % The Mass vectors fields is given by
7 % ``\MassVF_{i,j}=\int_\DOMH \DOT{\BasisFuncTwoD_m(\q)}{ \BasisFuncTwoD_l(\q)}d(\q), \ \forall (m,l)\in\ENS{1}{3\,\nq}^2,``
8 % where `\BasisFuncTwoD_m` are `P_1`-Lagrange vector basis functions.
9 %
10 % Parameters:
11 % nq: total number of vertices, also denoted by `\nq`.
12 % nme: total number of elements, also denoted by `\nme`.
13 % me: Connectivity array, `4\times\nme` array. <br/>
14 % `\me(\jl,k)` is the storage index of the
15 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
16 % `k\in{\ENS{1}{\nme}}`.
17 % volumes: Array of volumes, `1\times\nme array`. volumes(k) is the volume
18 % of the k-th tetrahedron.
19 % Num:
20 % - 0 global alternate numbering with local alternate numbering (classical method),
21 % - 1 global block numbering with local alternate numbering,
22 % - 2 global alternate numbering with local block numbering,
23 % - 3 global block numbering with local block numbering.
24 %
25 % Return values:
26 % M: `3\nq\times 3\nq` Global Mass vectors fields sparse matrix
27 %
28 % Example:
29 % @verbatim
30 % Th=CubeMesh(10);
31 % Mvf=MassVFAssembling3DP1OptV0(Th.nq,Th.nme,Th.me,Th.areas,0);@endverbatim
32 %
33 % See also:
34 % #BuildIkFunc, #BuildElemMassVFMatFunc
35 % Copyright:
36 % See \ref license
37 M=sparse(3*nq,3*nq);
38 GetI=BuildIkFunc(Num,nq);
39 ElemMassVFMat=BuildElemMassVFMatFunc(Num);
40 E=ElemMassVFMat(1);
41 %ES=sparse(E);
42 for k=1:nme
43  %E=ElemStiffElasMat(q(:,me(:,k)),volumes(k),H);
44  I=GetI(me,k);
45  M(I,I)=M(I,I)+volumes(k)*E;
46 end