1 function res = df_func_difference_sqr(lcoord,df,func)
2 %
function res = df_func_difference_sqr(lcoord,df,func)
4 % auxiliary
function computing the difference, which is used in l2
5 % error computation between a
function allowing local element
6 % evaluation and a ldg
function multiplied with integration_element
7 % ( = * triangle volume) due to transformation formula
9 % lcoord is a 2-vector of local coordinates, dofs a dof vector of
10 % the discrete
function, func the analytical
11 %
function with calling syntax func(einds,locs,grid,params)
12 % res is a vector of projected values on all elements. This
13 %
function can be used
for integration and results in the l2error
15 % Bernard Haasdonk 5.2.2009
17 nel = df.grid.nelements;
18 % F and DF will be a nelements x dimrange matrix
19 if isa(func,
'ldgdiscfunc')
21 F = func(1:nel,lcoord);
23 F = func(1:nel,lcoord, df.grid);
25 DF = df(1:nel,lcoord);
30 res = sum((DF-F).^2,2);
32 res = res(:).*df.grid.A * 2;