rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
output_function_box_mean.m
1 function f = output_function_box_mean(glob,params)
2 %function f = output_function_box_mean(glob,params)
3 %
4 % function computing the integral kernel of a linear output
5 % functional given as integral:
6 %
7 % output(u) = int_Omega f u dx
8 %
9 % the function f is represented by this function, the integration
10 % performed in suitable discretization routines later, e.g.
11 % fv_operators_output. glob is assumed to be a matrix of columnwise
12 % global coordinate vectors. Res is a matrix with columnwise
13 % results of application of f on all columns of glob.
14 %
15 % box_mean: for computation of mean(U) over box specified by
16 % params, i.e. f indicator function of the box scaled with the
17 % inverse volume of the box.
18 %
19 % note, that this functional is only exact, if the boundary of the
20 % box is exaclty corresponding ot element boundarys of the
21 % numerical grid.
22 %
23 % required fields of params:
24 % sbox_xmin, sbox_xmax sbox_ymin, sbox_ymax: coordinates of the
25 % box over which averaging is performed.
26 %
27 % These parameters should not be under parameter variation control,
28 % but be constant throughout the parameter variation.
29 % glob column check
30 if params.debug
31  if ~isempty(glob) && size(glob,1) < size(glob,2)
32  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
33  if params.debug > 2
34  keyboard;
35  end
36  end
37 end
38 
39 % Bernard Haasdonk 16.5.2008
40 
41 decomp_mode = params.decomp_mode;
42 
43 if decomp_mode == 2
44  f = 1; % one component weight 1, i.e. no parametrization
45 else
46 
47  boxvolinv = 1/((params.sbox_xmax-params.sbox_xmin)*...
48  (params.sbox_ymax-params.sbox_ymin));
49 
50  I = (glob(:,1)<=params.sbox_xmax) & (glob(:,1)>=params.sbox_xmin) ...
51  & (glob(:,2)>=params.sbox_ymin) & (glob(:,2)<=params.sbox_ymax);
52 
53 % I2 = (glob(:,1)>=params.sbox_xmin) & (glob(:,1)<=params.sbox_xmax) & ...
54 % (glob(:,2)<=params.sbox_ymax) & (glob(:,2)>=params.sbox_ymin);
55 
56 % I3 = (glob(:,1)<=params.sbox_xmax) & (glob(:,1)>=params.sbox_xmin) ...
57 % & (glob(:,2)<=params.sbox_ymax) & (glob(:,2)>=params.sbox_ymin);
58 
59 % keyboard;
60 
61  % function simply is 0 if glob is not in the box,
62  % 1/vol(box) if glob is in the box.
63  f = I.*boxvolinv;
64 
65  if decomp_mode == 1 % single component in cell array
66  f = {f};
67  else % decomp_mode == 0
68  %f = f;
69  end;
70 end;
71 
72 
73 
74 %| \docupdate
75 
76 
function [ v , l2norm ] = fv_operators_output(model, model_data)
function returning components, coefficients, and complete operator for a linear output functional on ...