1 classdef ReducedModel < LinEvol.ReducedModel
2 % reduced model
for linear evolution problems as given by a
3 % LinEvol.DetailedModel.
5 % This is compatible with Greedy.User.IReducedModel and can therefore make
6 % use of @ref Greedy.User.IDetailedData
"detailed data objects" created by
14 function rm = ReducedModel(dmodel, bg_descr)
15 %
function rm = ReducedModel(detailed_model, basis_generator)
16 % Constructor
for the reduced model.
19 % dmodel: of type LinEvol.DetailedModel
21 if nargin == 1 || isempty(bg_descr)
24 % this implements a copy constructor if necessary...
28 function this = set_mu(this, mu)
29 % function this = set_mu(this, mu, propagate)
30 % sets the active parameter vector `\mu \in {\cal M}`
32 % The parameter
set here, is used by the detailed_simulation() function.
34 % The default implementation sets all fieldnames 'descr.mu_names' in the
38 % mu: The parameter vector `\boldsymbol\mu`.
43 assert(length(mu) == length(this.descr.mu_names));
46 % this.descr.mexptr(
'set_mu', mu);
49 function mu = get_mu(
this)
50 %
function mu = get_mu(
this)
51 % returns the active parameter vector `\boldsymbol\mu \in {\cal M}`
53 % The
default implementation returns a vector of the values of the fields
54 % of the #descr structure with names
'descr.mu_names'.
57 % mu: The parameter vector `\boldsymbol\mu`
61 this.mu = get_mu(this.detailed_model);
65 % mu = this.descr.mexptr('get_mu');
67 function a0 = rb_init_values(this, detailed_data, decomp_mode)
68 % function a0 = rb_init_values(this, detailed_data, decomp_mode)
74 % detailed_data: detailed data tree
leaf object of type Greedy.DataTree.Detailed.RBLeafNode.
77 % a0: coefficient vector of size 'N x 1' for the initial values.
79 descr = this.detailed_model.descr;
81 a0 = descr.coeff_ops.u0_ptr(this.mu);
84 this.detailed_model.set_mu(this.mu);
86 a0 = descr.mexptr('rb_init_values', decomp_mode);
90 function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
91 % function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
97 % detailed_data: of type LinEvol.DetailedData
98 % rb_sim_data: struct holding reduced simulation data returned by
102 % rb_sim_data: struct holding the reduced simulation results and their
105 dd_leaf = get_leaf(detailed_data, this);
107 dd_leaf = detailed_data;
109 dune_sim_data = this.descr.mexptr('rb_reconstruction', dd_leaf.model_data, rb_sim_data);
110 rb_sim_data =
structcpy(rb_sim_data, dune_sim_data);
113 function c = copy(this)
114 % function c = copy(this)
118 % c: an
object of type LinEvol.
ReducedModel which is a deep copy of this
object.
124 function Delta = get_estimators_from_sim_data(rb_sim_data)
125 % function Delta = get_estimators_from_sim_data(sim_data)
129 Delta = rb_sim_data.Delta;
132 function Delta = get_estimator_from_sim_data(rb_sim_data)
133 % function Delta = get_estimator_from_sim_data(sim_data)
137 Delta = rb_sim_data.Delta(end);