rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
PressureMean.m
1 classdef PressureMean < ISeparableOperator
2 
3  properties (Constant)
4  id = 'L_pressure_mean';
5 
6  ret_vars = {};
7  arg_vars = {'pressure'};
8  arg_vars_short = {'P'};
9  end
10 
11  methods
12  function [INC, INCoff, J] = apply(this, model, model_data, sim_data, NU_ind)
13  %function INC = apply(this, model, model_data, sim_data, NU_ind)
14 
15  grid = model_data.grid;
16 
17  P = sim_data.P;
18 
19  if ~isfield(sim_data, 'm')
20  sim_data.m = length(P);
21  end
22 
23  INC = sum(grid.A.* P);
24 
25  INCoff = [];
26 
27  if nargout > 2
28 
29  n = 1;
30  m = sim_data.m;
31  Plength = grid.nelements;
32  if ~isfield(sim_data, 'Poff')
33  sim_data.Poff = 0;
34  end
35  J = sparse(ones(1,Plength), (1:Plength) + sim_data.Poff, grid.A, n, sim_data.m);
36 
37  end
38 
39  end
40 
41  function [LL, bb] = full_matrix(this, descr, model_data)
42  grid = model_data.grid;
43  n = 1;
44  m = grid.nelements;
45  LL = sparse(ones(1,m),1:m, grid.A, n, m);
46  bb = [];
47  end
48 
49  function ipm = inner_product_matrix(this, model_data)
50  ipm = 1;
51  end
52 
53  function [LL_comps, bb_comps] = components(this, descr, model_data)
54  [LL, bb] = full_matrix(this, descr, model_data);
55  LL_comps = {LL};
56  bb_comps = {bb};
57  end
58 
59  function [LL_coeffs, bb_coeffs] = coefficients(this, descr);
60  LL_coeffs = 1;
61  bb_coeffs = [];
62  end
63  end
64 end