OptFEM2DP1 Toolbox  V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
base/ComputeArea.m
Go to the documentation of this file.
00001 function area=ComputeArea(q,me)
00002 % function area=ComputeArea(q,me)
00003 %   Computation of areas of triangles in the mesh - Basic version
00004 %   
00005 % Parameters:
00006 %  q: Array of vertices coordinates, `2\times\nq` array. <br/>
00007 %  `{\q}(\il,j)` is the
00008 %  `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and
00009 %  `j\in\ENS{1}{\nq}`
00010 %  me: Connectivity array, `3\times\nme` array.<br/>
00011 %  `\me(\jl,k)` is the storage index of the
00012 %  `\jl`-th  vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and
00013 %       `k\in{\ENS{1}{\nme}}`.
00014 % 
00015 % Return values:
00016 %  area: Array of areas, `1\times\nme` array. area(k) is the area of the `k`-th triangle.
00017 
00018 % Copyright:
00019 %   See \ref license
00020 nq=size(q,2);
00021 nme=size(me,2);
00022 area=zeros(1,nme);
00023 for k=1:nme
00024   area(k).5*abs(det([ q(1,me(1,k))  q(2,me(1,k)) 1 ; ...
00025                         q(1,me(2,k))  q(2,me(2,k)) 1 ; ...
00026                         q(1,me(3,k))  q(2,me(3,k)) 1 ]));
00027 end
 All Files Functions