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