rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_interpol_local.m
1 function df = fem_interpol_local(f, df, params)
2 %function df = fem_interpol_local(f, df, params)
3 %
4 % function interpolating the given analytical function with
5 % local evaluation f(grid,elids,lcoord,params) into the allocated discrete
6 % function df
7 % by this, also discrete functions on the same grid with possibly
8 % other polynomial degree or other discrete function type can
9 % be interpolated.
10 
11 % B. Haasdonk 12.1.2011
12 
13 % for all lagrange nodes evaluate f and set as dof
14 
15 if nargin<3
16  params = [];
17 end;
18 
19 lagrange_nodes = lagrange_nodes_lcoord(df.pdeg);
20 
21 % possibly multiple evaluation in edge nodes, accept for now.
22 for i = 1:size(lagrange_nodes,1);
23  gids = df.df_info.global_dof_index(1:df.grid.nelements, i);
24 % glob = local2global(df.grid, 1:df.grid.nelements, lagrange_nodes(i,:));
25  fs = f(df.grid,1:df.grid.nelements,lagrange_nodes(i,:),params);
26  df.dofs(gids) = fs;
27 end;
28