rbmatlab 0.10.01
discfunc/ldg/ldg_l2project.m
00001 function dofs = ldg_l2project(func,qdeg,df_info)
00002 %function dofs = ldg_l2project(func,qdeg,df_info)
00003 %
00004 % function performing an l2 projection of an analytic function func to
00005 % the ldg space. A quadrature of degree qdeg is used.
00006 % 'params.dimrange' and 'params.pdeg' specify the discrete function space.
00007 %
00008 % func is a function to be called with local coordinates 
00009 % 'res = func(einds, locs ,grid,params)'
00010 % 'res' is a matrix of 'size(locs,2) x dimrange'
00011 %
00012 % using the notation as explained in ldgdiscfunc.m, the projection computes
00013 % df such that <df - func, `\phi_j`> = 0 for all global basis
00014 % functions `\phi_j`
00015 %
00016 % This yields (using simple domain transformations, determinant
00017 % cancles out by division)
00018 %
00019 % ``\mbox{dof}(j) = \frac{<\mbox{func}, \phi_j>}{|det(F_T(j)x)|} =
00020 %                   \int_{\hat T} \mbox{func}(F(\hat x)) \hat \phi_i(j) (\hat x)``
00021 
00022 % Bernard Haasdonk 2.2.2009
00023 
00024 % simply pass func_phi_product and its parameters to quadrature routine.
00025 
00026 % fast implementation:
00027 %params.evaluate_basis = @ldg_evaluate_basis;
00028 dofs = triaquadrature(qdeg,@func_phi_product,func,df_info);
00029 %dofs = dofs(:);
00030 
00031 % generic implementation:
00032 %params.element_quadrature = @triaquadrature;
00033 %params.local_mass_matrix = @ldg_local_mass_matrix;
00034 %dofs = l2project(func,qdeg,grid,params);
00035 
00036 %| \docupdate 
All Classes Namespaces Files Functions Variables