3 % Compute,
for each tetraedra, the gradients of the 4 local `P_1`-Lagrange basis functions
7 % q: Array of vertices coordinates, 3-by-nq array.
8 % q(il,j) is the il-th coordinate of the j-th vertex, il in {1,3}
10 % me: Connectivity array, `4\times\nme` array. <br/>
11 % `\me(\jl,
k)` is the storage index of the
12 % `\jl`-th vertex of the `
k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
13 % `k\in{\ENS{1}{\nme}}`.
16 % G: array of 4 cells. each cell is an 3-by-nme array.
17 % G{il}(:,
k) is `6|T_k|` times the gradient of the local `P_1`-Lagrange basis
function
18 % associated to point `{\q}^{\me(\il,
k)}` on the the tetrahedron `T_k`.
21 D12=q(:,me(1,:))-q(:,me(2,:));
22 D13=q(:,me(1,:))-q(:,me(3,:));
23 D14=q(:,me(1,:))-q(:,me(4,:));
24 D23=q(:,me(2,:))-q(:,me(3,:));
25 D24=q(:,me(2,:))-q(:,me(4,:));
26 D34=q(:,me(3,:))-q(:,me(4,:));
28 G{1}=[-D23(2,:).*D24(3,:) + D23(3,:).*D24(2,:); ...
29 D23(1,:).*D24(3,:) - D23(3,:).*D24(1,:); ...
30 -D23(1,:).*D24(2,:) + D23(2,:).*D24(1,:)];
31 G{2}=[ D13(2,:).*D14(3,:) - D13(3,:).*D14(2,:); ...
32 -D13(1,:).*D14(3,:) + D13(3,:).*D14(1,:); ...
33 D13(1,:).*D14(2,:) - D13(2,:).*D14(1,:)];
35 G{3}=[-D12(2,:).*D14(3,:) + D12(3,:).*D14(2,:); ...
36 D12(1,:).*D14(3,:) - D12(3,:).*D14(1,:); ...
37 -D12(1,:).*D14(2,:) + D12(2,:).*D14(1,:)];
38 G{4}=[ D12(2,:).*D13(3,:) - D12(3,:).*D13(2,:); ...
39 -D12(1,:).*D13(3,:) + D12(3,:).*D13(1,:); ...
40 D12(1,:).*D13(2,:) - D12(2,:).*D13(1,:)];