rbmatlab 0.10.01
datafunc/output_functional.m
00001 function s = output_functional(model,model_data,U)
00002 %function s = output_functional(model,model_data,U)
00003 %
00004 % function computing an output functional from the discrete
00005 % function U. Grid is needed to have the space discretization 
00006 % information about U.
00007 % return values are s.value and s.l2norm the induced functional
00008 % l2-norm of the output functional.
00009 
00010 % 'box_mean':  s = mean(U) over box specified by 
00011 %
00012 % required fields of model:
00013 % name_output_functional  : 'box_mean'
00014 % name_discfunc_element_mean : name of function, that computes the
00015 %                  mean values of a discrete function on a given
00016 %                  set of grid elements 
00017 %
00018 % if name_init_values == 'box_mean'
00019 %   sbox_xmin, sbox_xmax sbox_ymin, sbox_ymax: coordinates of the
00020 %   box over which averaging is performed. 
00021 % 
00022 % The implementation is a bit inprecise: The function U is only
00023 % evaluated in the cell-centroids and weighted by the cell
00024 % volume. This is summed for all cells with centroid in the specified box... 
00025 %
00026 % these parameters should not be under parameter variation control,
00027 % but be constant throughout the parameter variation.
00028 
00029 % Bernard Haasdonk 16.5.2008
00030 
00031 disp('deprecated, please use pointer to suitable output_functional_*')
00032 
00033 grid = model_data.grid;
00034 
00035 if isequal(model.name_output_functional,'box_mean')  
00036   % definition of the box
00037   xmin = model.sbox_xmin;
00038   xmax = model.sbox_xmax;
00039   ymin = model.sbox_ymin;
00040   ymax = model.sbox_ymax;
00041   
00042   I = find((grid.CX<=xmax) & (grid.CX>=ymin) & (grid.CY>=ymin) ...
00043            & (grid.CY<=ymax));
00044   
00045   U_means = model.name_discfunc_element_mean(model,model_data,U,I); 
00046   
00047   Apart = sum(grid.A(I));
00048   s.value = sum(U_means.*grid.A(I))/Apart;
00049   
00050   % l2norm of output functional: sup_|u|=1 s(u), i.e.
00051   % the discrete function u that has constant value c in the sensor
00052   % domain => l2norm(u)=sqrt(Apart * c^2) == 1
00053   % hence c = sqrt(1/Apart) and  s(u) = ||s|| = c  
00054   s.l2norm = sqrt(1/Apart);
00055     
00056 else
00057   error('unknown name_output_functional');
00058 end;
00059 
00060 %| \docupdate 
All Classes Namespaces Files Functions Variables