OptFEM3DP1 Toolbox  V1.0
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D
 All Files Functions Variables Pages
GetMaxLengthEdges.m
Go to the documentation of this file.
1 function h=GetMaxLengthEdges(q,me)
2 % function h=GetMaxLengthEdges(q,me)
3 % Computation of the maximal value of edge lengths
4 %
5 % Parameters:
6 % q: Array of vertices coordinates, `2\times\nq` array (double). <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 ('int32'). <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 % h: maximal length of an edge in the mesh
17 %
18 % Copyright:
19 % See \ref license
20 L{1}=q(:,me(1,:))-q(:,me(2,:));
21 L{2}=q(:,me(1,:))-q(:,me(3,:));
22 L{3}=q(:,me(1,:))-q(:,me(4,:));
23 L{4}=q(:,me(2,:))-q(:,me(3,:));
24 L{5}=q(:,me(2,:))-q(:,me(4,:));
25 L{6}=q(:,me(3,:))-q(:,me(4,:));
26 
27 h=max(sum(L{1}.^2,1));
28 for i=2:6
29  h=max(h,max(sum(L{i}.^2,1)));
30 end
31 
32 h=sqrt(h);
33