rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
output_functional.m
1 function s = output_functional(model,model_data,U)
2 %function s = output_functional(model,model_data,U)
3 %
4 % function computing an output functional from the discrete
5 % function U. Grid is needed to have the space discretization
6 % information about U.
7 % return values are s.value and s.l2norm the induced functional
8 % l2-norm of the output functional.
9 
10 % 'box_mean': s = mean(U) over box specified by
11 %
12 % required fields of model:
13 % name_output_functional : 'box_mean'
14 % name_discfunc_element_mean : name of function, that computes the
15 % mean values of a discrete function on a given
16 % set of grid elements
17 %
18 % if name_init_values == 'box_mean'
19 % sbox_xmin, sbox_xmax sbox_ymin, sbox_ymax: coordinates of the
20 % box over which averaging is performed.
21 %
22 % The implementation is a bit inprecise: The function U is only
23 % evaluated in the cell-centroids and weighted by the cell
24 % volume. This is summed for all cells with centroid in the specified box...
25 %
26 % these parameters should not be under parameter variation control,
27 % but be constant throughout the parameter variation.
28 
29 % Bernard Haasdonk 16.5.2008
30 
31 disp('deprecated, please use pointer to suitable output_functional_*')
32 
33 grid = model_data.grid;
34 
35 if isequal(model.name_output_functional,'box_mean')
36  % definition of the box
37  xmin = model.sbox_xmin;
38  xmax = model.sbox_xmax;
39  ymin = model.sbox_ymin;
40  ymax = model.sbox_ymax;
41 
42  I = find((grid.CX<=xmax) & (grid.CX>=ymin) & (grid.CY>=ymin) ...
43  & (grid.CY<=ymax));
44 
45  U_means = model.name_discfunc_element_mean(model,model_data,U,I);
46 
47  Apart = sum(grid.A(I));
48  s.value = sum(U_means.*grid.A(I))/Apart;
49 
50  % l2norm of output functional: sup_|u|=1 s(u), i.e.
51  % the discrete function u that has constant value c in the sensor
52  % domain => l2norm(u)=sqrt(Apart * c^2) == 1
53  % hence c = sqrt(1/Apart) and s(u) = ||s|| = c
54  s.l2norm = sqrt(1/Apart);
55 
56 else
57  error('unknown name_output_functional');
58 end;
59 
60 %| \docupdate