1 classdef ReducedModel < Greedy.User.IReducedModel
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
10 enable_error_estimator =
true;
14 % This constant is used
for a consistency check of the model descr with
16 ddescr_checks = struct(...
17 'operators_ptr', {{@(x) isequal(
class(x),
'function_handle')}},...
18 'init_values_algorithm', {{@(x) isequal(
class(x),
'function_handle')}},...
19 'error_norm', {{@ischar,
'values', {
'l2',
'energy'} }}...
25 %
function rm =
ReducedModel(detailed_model, basis_generator)
26 % Constructor
for the reduced model.
29 % dmodel: of type LinEvol.DetailedModel
31 if nargin == 1 || isempty(bg_descr)
34 %
this implements a copy constructor
if necessary...
36 % are we NOT a copy constructor?
37 if ~(isempty(bg_descr) || isa(dmodel,
'LinEvol.ReducedModel'))
39 LinEvol.ReducedModel.ddescr_checks);
40 error(
'Consistency check for LinEvol.ReducedModel failed.');
45 function a0 = rb_init_values(
this, detailed_data,
decomp_mode)
46 %
function a0 = rb_init_values(
this, detailed_data,
decomp_mode)
52 % detailed_data: detailed data tree
leaf object of type Greedy.DataTree.Detailed.RBLeafNode.
55 % a0: coefficient vector of size
'N x 1' for the initial values.
62 % reduced_data: of type LinEvol.ReducedData
63 rb_sim_data = rb_simulation_impl(
this, reduced_data);
65 function rb_sim_data = rb_reconstruction(
this, detailed_data, rb_sim_data)
66 %
function rb_sim_data = rb_reconstruction(
this, detailed_data, rb_sim_data)
72 % detailed_data: of type LinEvol.DetailedData
73 % rb_sim_data:
struct holding reduced simulation data returned by
77 % rb_sim_data:
struct holding the reduced simulation results and their
79 if isa(detailed_data,
'Greedy.User.IDetailedData')
80 dd_leaf = get_leaf(detailed_data, this);
82 dd_leaf = detailed_data;
87 function c = copy(this)
88 % function c = copy(this)
92 % c: an
object of type LinEvol.
ReducedModel which is a deep copy of this
object.
98 function Delta = get_estimators_from_sim_data(rb_sim_data)
99 % function Delta = get_estimators_from_sim_data(sim_data)
103 Delta = rb_sim_data.Delta;
106 function Delta = get_estimator_from_sim_data(rb_sim_data)
107 % function Delta = get_estimator_from_sim_data(sim_data)
111 Delta = rb_sim_data.Delta(end);