| OptFEM2DP1 Toolbox V1.2b2 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Pages
ComputeArea.m
Go to the documentation of this file.
1 function area=ComputeArea(q,me)
2 % function area=ComputeArea(q,me)
3 % Computation of areas of triangles in the mesh - Basic version
4 %
5 % Parameters:
6 % q: Array of vertices coordinates, `2\times\nq` array. <br/>
7 % `{\q}(\il,j)` is the
8 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and
9 % `j\in\ENS{1}{\nq}`
10 % me: Connectivity array, `3\times\nme` array.<br/>
11 % `\me(\jl,k)` is the storage index of the
12 % `\jl`-th vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and
13 % `k\in{\ENS{1}{\nme}}`.
14 %
15 % Return values:
16 % area: Array of areas, `1\times\nme` array. area(k) is the area of the `k`-th triangle.
17
18 % Copyright:
19 % See \ref license
20 nq=size(q,2);
21 nme=size(me,2);
22 area=zeros(1,nme);
23 for k=1:nme
24 area(k).5*abs(det([ q(1,me(1,k)) q(2,me(1,k)) 1 ; ...
25 q(1,me(2,k)) q(2,me(2,k)) 1 ; ...
26 q(1,me(3,k)) q(2,me(3,k)) 1 ]));
27 end