rbmatlab 0.10.01
|
00001 function U = l2project(func,qdeg,grid,params) 00002 %function U = l2project(func,qdeg,grid,params) 00003 % 00004 % function performing an l2 projection of an analytical function 00005 % func to the discrete function space space. A quadrature of degree 00006 % qdeg is used. params.pdeg specify the degree of the discrete fv function. 00007 % the params.evaluate_basis must be set to the correct basis 00008 % evaluation algorithm. params.element_quadrature is assumed to 00009 % point to the correct element quadrature rule, i.e. triagrid, etc. 00010 % 00011 % result is U the column vector of dofs 00012 00013 % Bernard Haasdonk 3.9.2009 00014 00015 % result is a grid.nelements x params.ndofs_per_element matrix 00016 00017 params.grid = grid; 00018 U = params.element_quadrature(qdeg,@func_phi_product,func, ... 00019 params); 00020 00021 % multiply locally with inverse reference mass matrix 00022 %Utmp = reshape(U,params.ndofs_per_element,grid.nelements); 00023 M = params.local_mass_matrix(qdeg,params); 00024 U = U * inv(M)'; 00025 U = U(:); 00026 %| \docupdate