1 classdef EiReducedDataNode < Greedy.User.IReducedDataNode
3 % depending on collateral reduced basis space information only (e.g.
4 % interpolation DOFs and a local grid).
38 % interpolation basis was generated.
53 TM_reduction_args = {};
56 properties (SetAccess =
private, Dependent)
71 % constructor
for the generation of the reduced data.
74 % rmodel: of type TwoPhaseFlow.ReducedModel
77 % Alternative synopsis:
79 % a reduced data node and (optionally) extracting smaller matrices.
85 copy_extract(rd, copy, rmodel);
87 fill_fields(rd, rmodel, detailed_data);
89 error('Did not find constructor for your arguments');
93 function conds = get_conds(this)
94 if ~isempty(this.Mmass)
95 conds.Mmass = condest(this.Mmass);
98 conds.BM = condest(this.BM);
101 function grid = get.grid(this)
102 grid = this.grid_local_ext;
105 function M = get.M(this)
106 M = size(this.BM, 2) - this.Mstrich;
109 function yesno = needs_subset_copy(this, rmodel)
110 % function yesno = needs_subset_copy(this, rmodel)
111 % @copybrief .Greedy.User.IReducedDataNode.needs_subset_copy()
113 % @copydetails .Greedy.User.IReducedDataNode.needs_subset_copy()
118 MM = get_by_description(rmodel.M, this.ophandle.
id);
119 yesno = isempty(MM) || (this.M ~= MM);
123 methods(Access=private)
125 function fill_fields(this, rmodel, detailed_data)
126 model_data = detailed_data.model_data;
127 if size(model_data.W, 1) == size(detailed_data.QM, 1)
130 A = model_data.diamondW;
133 this.ophandle = detailed_data.ophandle;
134 MM = get_by_description(rmodel.M, this.ophandle.
id);
135 this.BM = detailed_data.BM(1:MM,1:MM);
137 [nmd, eind, eind_local] = this.ophandle.compute_TM_global(model_data, detailed_data.TM(1:MM));
139 this.grid_local_ext = nmd.grid_local_ext;
140 this.TM_global_args = nmd.TM_global_args;
142 this.gn_edges = nmd.gn_edges;
143 this.gn_inner_edges = nmd.gn_inner_edges;
144 this.gn_boundary_edges = nmd.gn_boundary_edges;
145 this.TM_global = eind;
146 this.TM_local = eind_local;
148 this.Mmass = detailed_data.QM(:,1:MM)' * A * detailed_data.QM(:,1:MM);
151 function copy_extract(this, reduced_data, rmodel)
152 this.ophandle = reduced_data.ophandle;
153 this.
id = reduced_data.
id;
155 MM = get_by_description(rmodel.M, this.ophandle.
id);
157 grid = reduced_data.grid_local_ext;
159 % new version with external routine index_ext:
160 [nmd, eind, eind_local] = this.ophandle.compute_TM_global(reduced_data, reduced_data.TM_local(1:MM));
162 reduced_data_subset.TM_global = reduced_data.TM_global(1:MM);
163 reduced_data_subset.grid_local_ext = nmd.grid_local_ext;
164 [this.gEI, this.gn_inner_edges, this.gn_boundary_edges] ...
166 this.gn_edges = this.gn_inner_edges + this.gn_boundary_edges;
168 glob2loc = zeros(grid.nelements,1);
169 glob2loc(eind) = 1:length(eind);
170 this.TM_global_args = cell(1, length(nmd.TM_global_args));
171 for i = 1:length(nmd.TM_global_args)
172 oldTM_global = reduced_data.TM_global_args{i};
173 this.TM_global_args{i} = oldTM_global(nmd.TM_global_args{i});
174 this.TM_reduction_args{i} = nmd.TM_global_args{i};
176 this.TM_local = glob2loc(reduced_data.TM_local(1:MM));
177 this.BM = reduced_data.BM(1:MM,1:MM);
178 this.Mmass = reduced_data.Mmass(1:MM,1:MM);
180 %
get Q^t W Q
for M to M+M'
181 if rmodel.Mstrich > 0
182 QWQ = this.Mmass(rmodel.M+1:end,MM);
183 % this.factor = norm(QWQ);