3 % Assembling Mass Matrix by `P_1`-Lagrange finite elements
4 % using "OptV1" version (see report).
6 % The Mass Matrix 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
10 % nq: total number of nodes of the mesh, also noted `\nq`,
11 % nme: number of triangles, also noted `\nme`,
12 % me: `3\times\nme` 'int32' array,`\me(\jl,k)` index of storage, in the array `q`, of the `\jl`-th
13 % vertex of the triangle of index `k`, `\jl\in\{1,2,3\}` and `k\in\{1,\hdots,\nme\}.`
15 % areas: `1\times\nme` array, areas(k) is the area of triangle k.
18 % M: `\nq\times\nq` sparse matrix
29 % @author Francois Cuvelier @date 2012-05-31
31 % @new{1,1,fc,2012-11-22} Added doxygen documentation
using mtoc++ tool
35 % @change{1,1,fc,2012-11-22}
38 % Copyright (c) 2012, Francois Cuvelier, Gilles Scarella
39 % All rights reserved.
41 % Redistribution and use in source and binary forms, with or without
42 % modification, are permitted only in compliance with the BSD license, see
44 Ig=zeros(9*nme,1);Jg=zeros(9*nme,1);Kg=zeros(9*nme,1);
46 ii=[1 2 3 1 2 3 1 2 3];
47 jj=[1 1 1 2 2 2 3 3 3];
56 M=sparse(Ig,Jg,Kg,nq,nq);