1 function dofs = ldg_l2project(func,qdeg,df_info)
2 %
function dofs = ldg_l2project(func,qdeg,df_info)
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.
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'
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
16 % This yields (using simple domain transformations, determinant
17 % cancles out by division)
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)``
22 % Bernard Haasdonk 2.2.2009
24 % simply pass func_phi_product and its parameters to quadrature routine.
26 % fast implementation:
27 %params.evaluate_basis = @ldg_evaluate_basis;
28 dofs = triaquadrature(qdeg,@func_phi_product,func,df_info);
31 %
generic implementation:
32 %params.element_quadrature = @triaquadrature;
33 %params.local_mass_matrix = @ldg_local_mass_matrix;
34 %dofs = l2project(func,qdeg,grid,params);