OptFEM3DP1 Toolbox  20130618_070730
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D
 All Files Functions Variables Pages
BuildIgJgP1VF.m
Go to the documentation of this file.
1 function [Ig,Jg]=BuildIgJgP1VF(Num,me,nq)
2 % function [Ig,Jg]=BuildIgJgP1VF(Num,me,nq)
3 % Build Ig and Jg arrays for vectors fields with numerotation <Num>.
4 % See report.
5 %
6 % Parameters:
7 % Num:
8 % - 0 global alternate numbering with local alternate numbering (classical method),
9 % - 1 global block numbering with local alternate numbering,
10 % - 2 global alternate numbering with local block numbering,
11 % - 3 global block numbering with local block numbering.
12 % me: Connectivity array, `4\times\nme` array. <br/>
13 % `\me(\jl,k)` is the storage index of the
14 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
15 % `k\in{\ENS{1}{\nme}}`.
16 % nq: total number of vertices, also denoted by `\nq`.
17 %
18 % Return values:
19 % Ig: `144\times \nme` array
20 % Jg: `144\times \nme` array
21 % Copyright:
22 % See \ref license
23 switch Num
24 case 0
25  GetI=@(me) [3*me(1,:)-2; 3*me(1,:)-1; 3*me(1,:); ...
26  3*me(2,:)-2; 3*me(2,:)-1; 3*me(2,:); ...
27  3*me(3,:)-2; 3*me(3,:)-1; 3*me(3,:); ...
28  3*me(4,:)-2; 3*me(4,:)-1; 3*me(4,:)];
29 case 1
30  GetI=@(me) [me(1,:); me(1,:)+nq; me(1,:)+2*nq; ...
31  me(2,:); me(2,:)+nq; me(2,:)+2*nq; ...
32  me(3,:); me(3,:)+nq; me(3,:)+2*nq; ...
33  me(4,:); me(4,:)+nq; me(4,:)+2*nq];
34 case 2
35  GetI=@(me) [3*me-2;3*me-1;3*me];
36 case 3
37  GetI=@(me) [me;me+nq;me+2*nq];
38 end
39 ii=[1:12]'*ones(1,12);
40 ii=ii(:);
41 jj=ones(12,1)*[1:12];
42 jj=jj(:);
43 
44 I=GetI(me);
45 
46 Ig=I(ii,:);
47 %Ig=Ig(:);
48 Jg=I(jj,:);
49 %Jg=Jg(:);