| 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
ComputeAreaOpt.m
Go to the documentation of this file.
1 function area=ComputeAreaOpt(q,me)
2 % function area=ComputeAreaOpt(q,me)
3 % Computation of areas of triangles in the mesh
4 % - Optimized version
5 %
6 % Parameters:
7 % q: Array of vertices coordinates, `2\times\nq` array. <br/>
8 % `{\q}(\il,j)` is the
9 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and
10 % `j\in\ENS{1}{\nq}`
11 % me: Connectivity array, `3\times\nme` array.<br/>
12 % `\me(\jl,k)` is the storage index of the
13 % `\jl`-th vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and
14 % `k\in{\ENS{1}{\nme}}`.
15 %
16 % Return values:
17 % area: Array of areas, `1\times\nme` array. area(k) is the area of the `k`-th triangle.
18 % Copyright:
19 % See \ref license
20 c1 = q(:,me(1,:));
21 d21 = q(:,me(2,:))-c1;
22 d31 = q(:,me(3,:))-c1;
23 area = 0.5*(d21(1,:).*d31(2,:)-d21(2,:).*d31(1,:));