| OptFEM2DP1 Toolbox V1.2b2 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions 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 % Definition of the arrays Ig and Jg, depending on the
4 % parameter Num of global numbering of degrees of freedom.
5 %
6 % Parameters:
7 % Num: Choice of the numbering of degrees of freedom
8 % - 0 local numbering (classical method)
9 % - 1 global numbering
10 % nq: total number of vertices, also denoted by `\nq`.
11 % me: Connectivity array, `3\times\nme` array.<br/>
12 % `\me(\jl,k)` is the storage index of the
13 % `\jl`-th vertex of the `k`-th triangle in the array `\q` of vertices coordinates, `\jl\in\{1,2,3\}` and
14 % `k\in{\ENS{1}{\nme}}`.
15 %
16 % Return values:
17 % Ig : Array of indices, 2ndf-by-nmef array
18 % Jg : Array of indices, 2ndf-by-nmef array
19 % Copyright:
20 % See \ref license
21 switch Num
22 case 0
23 GetI=@(me) [2*me(1,:)-1; 2*me(1,:); 2*me(2,:)-1; 2*me(2,:); 2*me(3,:)-1; 2*me(3,:)];
24 case 1
25 GetI=@(me) [me(1,:); me(1,:)+nq; me(2,:); me(2,:)+nq; me(3,:); me(3,:)+nq];
26 case 2
27 GetI=@(me) [2*me(1,:)-1; 2*me(2,:)-1; 2*me(3,:)-1; 2*me(1,:); 2*me(2,:); 2*me(3,:)];
28 case 3
29 GetI=@(me) [me(1,:); me(2,:); me(3,:); me(1,:)+nq; me(2,:)+nq; me(3,:)+nq];
30 end
31 ii=[1:6]'*ones(1,6);
32 ii=ii(:);
33 jj=ones(6,1)*[1:6];
34 jj=jj(:);
35
36 I=GetI(me);
37
38 Ig=I(ii,:);
39 Ig=Ig(:);
40 Jg=I(jj,:);
41 Jg=Jg(:);