2 % Reduced data implementation
for linear stationary problems of the form `L_I u = f`.
4 % See @ref HO08a
for details on the implementation of the reduced matrices
9 Q_A; % number of components in matrix `L_I`
10 Q_f; % number of components in vector `f`
11 Q_l; % number of components in vector `l`
12 AN_comp; % reduced components `L_I^q`
13 fN_comp; % reduced components `f^q`
14 lN_comp; % reduced components `l^q`
15 KII; % error estimator matrices `L_I^q,L_I^q
'`
16 mI; % error estimator vectors `L_I^q,f^q'`
17 m; % error estimator scalars `f^q,f^q
'`
20 properties (SetAccess = private, Dependent)
21 % number of reduced basis vectors stored in this data node.
25 properties (SetAccess = private)
26 % number of collateral reduced basis vectors stored in this data node.
28 % number of collateral reduced basis vectors used for error estimation
34 function rd = ReducedData(rmodel, detailed_data)
35 % Constructor for the generation of the reduced matrices and vectors.
38 % rmodel: of type LinStatDune.ReducedModel
39 % detailed_data: of type IDetailedData
43 error('LinStatDune.ReducedData constructor needs an argument
');
45 && isa(detailed_data, 'LinStatDune.ReducedData
')
47 copy_extract(rd, copy, rmodel);
49 fill_fields(rd, rmodel, detailed_data);
50 elseif nargin == 1 && isa(rmodel, 'LinStatDune.ReducedData
')
51 fns = properties(rmodel);
52 fns = setdiff(fns,'N
');
54 rd.(fns{i}) = rmodel.(fns{i});
57 error('Did not find constructor
for your arguments
');
61 function N = get.N(this)
62 if ~isempty(this.fN_comp)
63 N = length(this.fN_comp{1});
69 function reduced_data_subset = extract_reduced_data_subset(this, rmodel)
70 % function reduced_data_subset = extract_reduced_data_subset(this, rmodel)
71 % @copybrief IReducedModel.extract_reduced_data_subset()
74 % rmodel: reduced model of type LinStat.ReducedModel indicating the
75 % number of reduced basis vectors to be used in the
76 % 'reduced_data_subset
'
79 % reduced_data_subset: object of type LinStat.ReducedData which is a
80 % deep copy of this data node but with a number of
81 % reduced basis vectors indicated by 'rmodel.N
'. If
82 % the number did not change, only a handle copy is
86 % extract correct N-sized submatrices and subvectors from reduced_data
88 error('N too large
for current size of reduced basis!
');
92 reduced_data_subset = LinStatDune.ReducedData(this);
96 reduced_data_subset.AN_comp = ...
97 subblock_sequence(this.AN_comp,1:N,1:N);
98 reduced_data_subset.fN_comp = subblock_sequence(this.fN_comp,1:N);
101 %%%% TODO: Implement the output functinal matrix
102 % reduced_data_subset.lN_comp = subblock_sequence(this.lN_comp,1:N);
104 reduced_data_subset.KII = subblock_sequence(this.KII, 1:N,1:N);
105 reduced_data_subset.mI = subblock_sequence(this.KII, 1:N);
107 reduced_data_subset = this;
111 function conds = get_conds(this)
113 disp('get_conds needs to be implemented
for LinStat.ReducedData
');
118 methods(Access=private)
120 function fill_fields(reduced_data, dmodel, detailed_data)
121 % function fill_fields(reduced_data, dmodel, detailed_data)
122 % actually fills the reduced data fields
124 model = dmodel.descr;
126 model.decomp_mode = 1; % == components
128 A_str = '<Laplace[phi],phi>_L2
';
129 f_str = '<RHS,phi>_L2
';
130 ret = model.mexptr('rb_operators
', 1, {A_str, f_str}, {});
131 reduced_data.AN_comp = ret.(A_str);
132 reduced_data.fN_comp = cellfun(@(X)X', ret.(f_str),
'UniformOutput',
false);
134 reduced_data.Q_A = length(reduced_data.AN_comp);
135 reduced_data.Q_f = length(reduced_data.fN_comp);
137 KII_str =
'<Laplace[phi],Laplace[phi]>_L2';
138 mI_str =
'<Laplace[phi],RHS>_L2';
139 m_str =
'<RHS,RHS>_L2';
140 ret = model.mexptr(
'rb_operators', 1, {KII_str, mI_str, m_str}, {});
141 reduced_data.KII = ret.(KII_str);
142 reduced_data.mI = ret.(mI_str);
143 reduced_data.m = ret.(m_str);
145 if model.compute_output_functional
146 % assumption: nonparametic output functional, then simple RB
147 % evaluation possible
149 %%%%%%%%% TODO: Implement output functional %%%%%%%%%%
150 l_str =
'<Output,phi>_L2';
151 ret = model.mexptr(
'rb_operators', 1, {l_str}, {});
152 l_comp = ret.(l_str);
153 reduced_data.Q_l = length(l_comp);