rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
SeparableFunctionNode.m
1 classdef SeparableFunctionNode < Greedy.User.IReducedDataNode
2 
3  properties
4  bb;
5 
6  sfhandle;
7  end
8 
9  properties (SetAccess = private, Dependent)
10  id;
11  N;
12  end
13 
14  methods
15  function sfn = SeparableFunctionNode(rmodel, detailed_data, sfhandle)
16  if nargin == 0
17  error('Greedy.DataTree.Reduced.SeparableFunctionNode needs three constructor arguments');
18  elseif nargin == 2 && isa(rmodel, 'IReducedModel') ...
19  && isa(detailed_data, 'Greedy.DataTree.Reduced.SeparableFunctionNode')
20  copy = detailed_data;
21  copy_extract(sfn, copy, rmodel);
22  elseif nargin == 3
23  sfn.sfhandle = sfhandle;
24  fill_fields(sfn, rmodel, detailed_data);
25  else
26  error('Wrong constructor arguments');
27  end
28  end
29 
30  function yesno = needs_subset_copy(this, rmodel)
31  % function yesno = needs_subset_copy(this, rmodel)
32  % @copybrief ::GreedyUser.IReducedDataNode.needs_subset_copy()
33  %
34  % @copydetails ::GreedyUser.IReducedDataNode.needs_subset_copy()
35  %
36  % Parameters:
37  % rmodel: of type TwoPhaseFlow.ReducedModel
38  rn = get_by_description(rmodel.N, this.id);
39  yesno = this.N ~= rn;
40 
41  end
42 
43  function N = get.N(this)
44  N = size(this.bb,1);
45  end
46 
47  function id = get.id(this)
48  id = this.sfhandle.id;
49  end
50 
51  function conds = get_conds(this)
52  conds = [];
53  end
54 
55  function lc = lincomb_sequence(this, descr)
56 
57  coeffs = this.sfhandle.coefficients(descr);
58  lc = this.bb * coeffs;
59  end
60  end
61 
62  methods(Access=private)
63 
64  function fill_fields(this, rmodel, detailed_data)
65  this.bb = this.sfhandle.project_components(rmodel, detailed_data);
66  end
67 
68  function copy_extract(this, reduced_data, rmodel)
69  this.sfhandle = reduced_data.sfhandle;
70  rn = get_by_description(rmodel.N, this.id);
71 
72  if rn > this.N
73  error('N too large for current size of reduced data!');
74  end
75 
76  this.bb = reduced_data.bb(1:rn);
77  end
78  end
79 end
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
Interface classes to be implemented by the Greedy.Algorithm user.
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Definition: IReducedModel.m:17
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1