rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lagrange_nodes_lcoord.m
1 function lcoords = lagrange_nodes_lcoord(pdeg);
2 %function lcoords = lagrange_nodes_lcoors(pdeg);
3 %
4 % function returning the local coordinates of the Lagrange nodes of
5 % the reference triangle. Result is a numlagrangepoints x 3 matrix
6 
7 % Bernard Haasdonk 12.1.2011
8 
9 if pdeg <= 0
10  error('pdeg not supported!');
11 end;
12 
13 switch pdeg
14  case 1
15  lcoords = [0,0; 1,0; 0,1];
16  case 2
17  lcoords = [0,0; 0.5,0; 1,0; 0,0.5; 0.5,0.5; 0,1];
18  case 3
19  lcoords = [0,0; 1,0; 2,0; 3,0; 0,1; 1,1; 2,1; ...
20  0,2; 1,2; 0,3]/3;
21  otherwise
22 % lcoords = zeros((pdeg+1)*(pdeg+2)/2,3);
23  c1 = (0:pdeg)'*ones(1,pdeg+1);
24  c2 = c1';
25  c3 = pdeg - c1 - c2;
26  i = find(c3>=-eps);
27  lcoords = [c1(i),c2(i)]/pdeg;
28 end;