rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_evaluate_scalar_basis_function_derivative.m
1 function res = fem_evaluate_scalar_basis_function_derivative(df,lcoord,i)
2 %function res = fem_evaluate_scalar_basis_derivative(df,lcoord,i)
3 %
4 % evaluation of `i`-th scalar fem reference basis
5 % derivatives `\nabla(\hat \phi_i)` in point
6 % `\hat x` = 'lcoord'. The argument 'df' can either be a ldg discfunc or
7 % a structure with fields pdeg and dimrange.
8 % Res is a 1 x dimworld array, 'Res(1,:)' = `\nabla \hat \phi_i`
9 % 'lcoord' is a 2-vector with the barycentric coordinates in the
10 % triangle
11 %
12 % with V being the fem_weight_matrix we have
13 %
14 % ``(\hat \phi_1, \ldots, \hat \phi_{\mbox{nbasefct}}) =
15 %
16 % (c_1(x),c_2(x),c_k(x)) ``
17 %
18 % and `c_i(x)= v_i p(x) `
19 %
20 % with `v_i` = i-th row of V and p(x) the powervector
21 %
22 % with k = number of scalar base functions = dim(powervector2)
23 %
24 % Hence the derivatives also have similar structure.
25 %
26 % `\nabla \hat \phi_1 = [w_1 * D p(x)]' `
27 % etc.
28 %
29 % perhaps the general vectorial case (tensor-product basis) can be
30 % generalized from this version later...
31 %
32 % for a simultaneuous computation of all gradients, see
33 % fem_evaluate_scalar_basis_gradient
34 
35 % Bernard Haasdonk 12.1.2011
36 
37 if (df.dimrange~=1)
38  warning('caution: scalar basis evaluated, but df is vectorial!');
39 end;
40 
41 %switch df.pdeg
42 %case
43  V = fem_basis_weight_matrix(df.pdeg);
44 % v = V(ceil(i/df.dimrange),:);
45  v = V(i,:);
46 % nrep=(df.pdeg+1)*(df.pdeg+2)/2; %[3,6,10,15];
47 % nbasefct = nrep;
48  %res = zeros(2,nbasefct);
49  Dp = power_vector2_derivative(lcoord,df.pdeg);
50  res = v * Dp;
51 %end;
52 %| \docupdate