![]() |
OptFEM2DP1 Toolbox
V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
|
00001 function area=ComputeAreaOpt(q,me) 00002 % function area=ComputeAreaOpt(q,me) 00003 % Computation of areas of triangles in the mesh 00004 % - Optimized version 00005 % 00006 % Parameters: 00007 % q: Array of vertices coordinates, `2\times\nq` array. <br/> 00008 % `{\q}(\il,j)` is the 00009 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and 00010 % `j\in\ENS{1}{\nq}` 00011 % me: Connectivity array, `3\times\nme` array.<br/> 00012 % `\me(\jl,k)` is the storage index of the 00013 % `\jl`-th vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and 00014 % `k\in{\ENS{1}{\nme}}`. 00015 % 00016 % Return values: 00017 % area: Array of areas, `1\times\nme` array. area(k) is the area of the `k`-th triangle. 00018 % Copyright: 00019 % See \ref license 00020 c1 = q(:,me(1,:)); 00021 d21 = q(:,me(2,:))-c1; 00022 d31 = q(:,me(3,:))-c1; 00023 area = 0.5*(d21(1,:).*d31(2,:)-d21(2,:).*d31(1,:));