rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_evaluate_basis.m
1 function res = fem_evaluate_basis(df,lcoord)
2 %function res = fem_evaluate_basis(df,lcoord)
3 %
4 % evaluation of fem reference basis `\hat \phi_i, i=1,\ldots,m` in point
5 % `\hat x` = 'lcoord'. The argument df is a fem
6 % discretefunction
7 % Res is a ndofs_per_element x dimrange (=m) array, each row being
8 % evaluation of one basis vector
9 % lcoord is a 2-vector with the barycentric coordinates in the
10 % triangle.
11 %
12 % the basis is a lagrange basis with respect to the lagrange-points
13 % counted from v1 to v2 then row-wise upward to v3
14 %
15 % the basis function is characterizes as linear combination of the
16 % standard monomial basis:
17 % `1,x,y,x^2, xy, y^2`, etc.
18 % i.e. the power_vector2.
19 %
20 % with V being the fem_weight_matrix we have
21 %
22 % @code
23 % (\hat phi_1, ... \hat phi_nbasefct)^T =
24 %
25 % (c_1(x),0 ,0 ,c_2(x),0 ,0 ,... c_k(x), 0, 0)
26 % (0 ,c_1(x),0 ,0 ,c_2(x),0 ,... 0 ,c_k(x), 0 )
27 % (0 ,0 ,c_1(x),0 , 0,c_2(x),... 0 , 0 , c_k(x))^T
28 %
29 % and c_i(x)= v_i * p(x)
30 % @endcode
31 %
32 % with `v_i` = i-th row of V and p(x) the powervector
33 %
34 % with k = number of scalar base functions = dim(powervector2)
35 
36 % Bernard Haasdonk 12.1.2011
37 
38 switch df.pdeg
39  case 0
40  error('fem basis not reasonable for pdeg 0')
41  otherwise
42  V = fem_basis_weight_matrix(df.pdeg);
43  c = V * power_vector2(lcoord,df.pdeg);
44  e = eye(df.dimrange);
45  %nrep=[3,6,10,15,21,28];
46  nrep = (df.pdeg+1) * (df.pdeg+2)/2;
47  res = zeros(df.dimrange,nrep * df.dimrange);
48  for i=1:nrep
49  ra = (1+(i-1)*df.dimrange):i*df.dimrange;
50  res(:,ra)=c(i)*e;
51  end;
52  % transposition in order to have one row per basis function
53  res = res';
54 end;
55 
56 %| \docupdate