rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_operators_output.m
Go to the documentation of this file.
1 function [v, l2norm] = fv_operators_output(model,model_data)
2 %function v = fv_operators_output(model,model_data)
3 % function returning components, coefficients, and complete
4 % operator for a linear output functional on fv discrete functions
5 %
6 % 'v * U' for a dof vector 'U' gives the desired output of the simulation
7 % assuming, that the output functional is given by
8 %
9 % ``int_{\Omega} f(u)dx``
10 %
11 % as an integral of a given analytical function multiplied with the
12 % discrete function.
13 %
14 % Function supports affine decomposition, i.e. different operation modes
15 % guided by optional field decomp_mode in model. See also the
16 % contents.txt for general explanation
17 
18 % Bernard Haasdonk 13.7.2006
19 
20 % determine affine_decomposition_mode as integer
21 decomp_mode = model.decomp_mode;
22 
23 grid = [];
24 if ~isempty(model_data)
25  grid = model_data.grid;
26 end
27 
28 l2norm = [];
29 switch decomp_mode
30  case 2
31  % simply forward coefficients of output_function
32  v = model.output_function_ptr([],model);
33  case 1
34  % simple quadrature quadrature of evaluation of fv function in the midpoints
35  f = model.output_function_ptr([grid.CX(:),grid.CY(:)],model);
36  Q_v = length(f);
37  v = cell(Q_v,1);
38  for q = 1:length(v)
39  v{q} = grid.A(:).*(f{q}(:));
40  end;
41  case 0
42  % simple quadrature quadrature of evaluation of fv function in the midpoints
43  f = model.output_function_ptr([grid.CX(:),grid.CY(:)],model);
44  % vector that realizes integral over domain of f times U
45  % s = \int_Omega f u = sum_e |e| f(c(e)) u(c(e)) = v * U
46  % hence v = (|e| f(c(e)))_e;
47  v = grid.A(:).*f(:);
48  l2norm = sqrt(fv_inner_product(model, model_data, f,f));
49 end;
50 
function [ v , l2norm ] = fv_operators_output(model, model_data)
function returning components, coefficients, and complete operator for a linear output functional on ...