rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
RbReducedDataNode.m
1 classdef RbReducedDataNode < Greedy.User.IReducedDataNode
2  % Implementation of a Greedy.User.IReducedDataNode storing reduced data
3  % depending on reduced basis space information only. (e.g. reduced matrices
4  % of operators)
5 
6  properties
7 
8  id;
9 
10  % reduced basis mass matrix.
11  %
12  % The matrix entries are:
13  % ``({ \bf N })_{ij} = \int \varphi_i \varphi_j``
14  Nmass;
15 
16  end
17 
18  properties (SetAccess = private, Dependent)
20  %
22  N;
23  end
24 
25  methods
26  function rd = RbReducedDataNode(rmodel, detailed_data)
27  % function rd = RbReducedDataNode(rmodel, detailed_data)
28  % constructor for the generation of the reduced data.
29  %
30  % Parameters:
31  % rmodel: of type TwoPhaseFlow.ReducedModel
32  % detailed_data: of type IDetailedData
33  %
34  % Alternative synopsis:
35  % @code RbReducedDataNode(rmodel, ei_reduced_data_node) @endcode copying
36  % a reduced data node and (optionally) extracting smaller matrices.
37  if nargin == 0
38  error('TwoPhaseFlow.RbReducedDataNode constructor needs an argument');
39  elseif nargin == 2 && isa(rmodel, 'IReducedModel') ...
40  && isa(detailed_data, 'TwoPhaseFlow.RbReducedDataNode')
41  copy = detailed_data;
42  copy_extract(rd, copy, rmodel);
43  elseif nargin == 2
44  fill_fields(rd, rmodel, detailed_data);
45  else
46  error('Did not find constructor for your arguments');
47  end
48  end
49 
50  function conds = get_conds(this)
51  if ~isempty(this.Nmass)
52  conds.Nmass = condest(this.Nmass);
53  end
54  if ~isempty(this.LL_I)
55  conds.LL_I = condest(this.LL_I);
56  end
57  end
58 
59  function N = get.N(this)
60  N = size(this.Nmass,1);
61  end
62 
63  function yesno = needs_subset_copy(this, rmodel)
64  % function yesno = needs_subset_copy(this, rmodel)
65  % @copybrief ::GreedyUser.IReducedDataNode.needs_subset_copy()
66  %
67  % @copydetails ::GreedyUser.IReducedDataNode.needs_subset_copy()
68  %
69  % Parameters:
70  % rmodel: of type TwoPhaseFlow.ReducedModel
71  rn = get_by_description(rmodel.N, this.id);
72  yesno = this.N ~= rn;
73  end
74 
75  end
76  methods(Access=private)
77 
78  function fill_fields(this, rmodel, detailed_data)
79 
80  this.id = detailed_data.id;
81  model_data = detailed_data.model_data;
82 
83  N = get_by_description(rmodel.N, this.id);
84 
85  if size(detailed_data.RB, 1) == size(model_data.W,2)
86  A = model_data.W;
87  else
88  A = model_data.diamondW;
89  end
90 
91  this.Nmass = detailed_data.RB(:,1:N)' * A * detailed_data.RB(:,1:N);
92 
93  end
94 
95  function copy_extract(this, reduced_data, rmodel)
96 
97  % extract correct N-sized submatrices and subvectors from reduced_data
98  rn = get_by_description(rmodel.N, reduced_data.id);
99  this.id = reduced_data.id;
100  if rn > reduced_data.N
101  error('N too large for current size of reduced basis!');
102  end
103 
104  N = rn;
105 
106  if ~isempty(reduced_data.Nmass)
107  this.Nmass = reduced_data.Nmass(1:N,1:N);
108  end
109 
110  end
111  end
112 
113 end
reduced model for non-linear evolution problems as given by a TwoPhaseFlow.DetailedModel.
Definition: ReducedModel.m:18
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on reduced basis sp...
N
number of reduced basis vectors stored in this data node.
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
Interface class for the generation and storage of reduced basis spaces as described in Module (M2)...
Definition: IDetailedData.m:17