rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
ldg_l2project.m
1 function dofs = ldg_l2project(func,qdeg,df_info)
2 %function dofs = ldg_l2project(func,qdeg,df_info)
3 %
4 % function performing an l2 projection of an analytic function func to
5 % the ldg space. A quadrature of degree qdeg is used.
6 % 'params.dimrange' and 'params.pdeg' specify the discrete function space.
7 %
8 % func is a function to be called with local coordinates
9 % 'res = func(einds, locs ,grid,params)'
10 % 'res' is a matrix of 'size(locs,2) x dimrange'
11 %
12 % using the notation as explained in ldgdiscfunc.m, the projection computes
13 % df such that <df - func, `\phi_j`> = 0 for all global basis
14 % functions `\phi_j`
15 %
16 % This yields (using simple domain transformations, determinant
17 % cancles out by division)
18 %
19 % ``\mbox{dof}(j) = \frac{<\mbox{func}, \phi_j>}{|det(F_T(j)x)|} =
20 % \int_{\hat T} \mbox{func}(F(\hat x)) \hat \phi_i(j) (\hat x)``
21 
22 % Bernard Haasdonk 2.2.2009
23 
24 % simply pass func_phi_product and its parameters to quadrature routine.
25 
26 % fast implementation:
27 %params.evaluate_basis = @ldg_evaluate_basis;
28 dofs = triaquadrature(qdeg,@func_phi_product,func,df_info);
29 %dofs = dofs(:);
30 
31 % generic implementation:
32 %params.element_quadrature = @triaquadrature;
33 %params.local_mass_matrix = @ldg_local_mass_matrix;
34 %dofs = l2project(func,qdeg,grid,params);
35 
36 %| \docupdate