2 % a
default reduced data implementation which stores a
3 % @ref .DataTree.INode
"data tree" object copying the structure of a
7 % This is also a .DataTree.CreatorDefault
object which copies the tree
8 % structure of detailed data tree. The user only needs to define how the
leaf
9 % elements of
this reduced data tree storing the actual reduced matrices and
10 % vectors shall be constructed. Such
leaf elements should be derived from
16 properties(Dependent, SetAccess=
private)
17 % number of reduced basis vectors stored in
this data node.
20 % number of collateral reduced basis vectors stored in
this data node.
23 % number of collateral reduced basis vectors used
for error estimation.
28 % the actual data tree of type .DataTree.INode
30 % The
leaf elements have are objects of the
class type
35 properties(Transient, Hidden=
true)
36 %
struct with transient options for the create_leaf_node() method.
43 % constructor either constructing a reduced data
object from a
46 % smaller reduced vectors and matrices.
48 % The two possible synopsis
for this functions:
49 % -#
'reduced_data = Greeedy.User.ReducedData(rmodel, detailed_data)' and
50 % -#
'rd_subset = Greeedy.User.ReducedData(rmodel, reduced_data)'
54 % reduced numerical scheme.
55 % - For synopsis (1) it defines via the option
56 % @ref
IReducedModelbg_descr "bg_descr.reduced_data_constructor"
57 % the type of the
leaf elements in the reduced data tree and
58 % - for synopsis (2) it defines the size of the reduced
59 % matrices and vectors in the copied
object by the member
61 % @ref
IReducedModel.crb_enabled "enabled empirical interpolation"
65 % detailed_data: By default, this is a detailed data
object of type ::
GreedyUser::
IDetailedData
66 % @b or in case of synposis (2) a
73 fns = properties(copy);
74 fns = setdiff(fns, {
'datatree',
'create_tree_opts',
'N',
'M',
'Mstrich'});
77 rd.(fns{i}) = copy.(fns{i});
80 rd.create_tree_opts.mode =
'copy_extract';
81 rd.datatree = create_tree(copy.datatree, rd);
84 fill_data(rd, rmodel, detailed_data);
86 error(
'Did not find constructor for your arguments.');
90 function subset_reduced_data = extract_reduced_data_subset(
this, rmodel)
91 %
function subset_reduced_data = extract_reduced_data_subset(
this, rmodel)
92 % @copybrief .IReducedData.extract_reduced_data_subset()
94 % @copydetails .IReducedData.extract_reduced_data_subset()
97 % rmodel: of type .Greedy.User.ReducedData
101 %
this object with (possibly) smaller reduced matrices and
102 % vectors. If the reduced magnitudes are unchanged, the
103 %
leaf elements are not copied but are references to the
109 function conds = get_conds(this)
110 warning('RBmatlab:
Greedy:general', 'You should call get_conds on a
leaf of the reduced data tree');
114 function reduced_data_leaf = get_leaf(this, rmodel)
115 % function reduced_data_leaf = get_leaf(this, rmodel)
117 % for a specific combination of parameters and time indices given by the
125 % actually stores the reduced vectors and matrices
126 % needed for online simulations.
128 dmodel = rmodel.detailed_model;
130 if isfield(dmodel.descr, 'nt')
131 nt = dmodel.descr.nt;
136 reduced_data_leaf = get_by_description(this.datatree, [], get_mu(rmodel), nt);
143 function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
144 % function create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
145 % This creates the actual reduced data leafs implementing the
148 % @copydetails ::
DataTreeICreator.create_leaf_node()
153 % @note The 'arg_node' argument can be either a
157 % for more information on these two variants)
159 rmodel = this.create_tree_opts.rmodel;
160 % NOTE: detailed_data can also be a reduced data node... In this case,
161 % the mode should be 'copy_extract'
162 if isequal(this.create_tree_opts.mode, 'copy_extract') ...
163 && ~needs_subset_copy(arg_node, rmodel)
166 node = rmodel.bg_descr.reduced_data_constructor(rmodel, arg_node);
170 function N = get.N(this)
175 function M = get.M(this)
180 function Mstrich = get.Mstrich(this)
182 Mstrich = this.datatree.Mstrich;
188 methods (Access = protected)
189 function fill_data(this, rmodel, detailed_data)
190 % function fill_data(this, rmodel, detailed_data)
191 % defines how the
#datatree member is being filled with data.
193 % If not overwritten,
this method copies the tree structure of the given
194 % detailed data
object and computes the reduced matrices and vectors in
197 % @note The second arguments does not need to wrap a detailed data tree,
198 % as the .Greedy.User.IDetailedData objects
do. If no tree is given, a
199 % reduced data tree with only a root element is created.
202 % rmodel: of type .Greedy.User.IReducedModel
204 % Optional fields of detailed_data:
205 % datatree: @copybrief .Greedy.User.IDetailedData.datatree
207 this.create_tree_opts.rmodel = rmodel;
208 this.create_tree_opts.mode =
'normal';
210 if isa(detailed_data,
'Greedy.User.IDetailedData')
211 dd = detailed_data.datatree;
213 dd = get_by_description(dd, 'rb');
215 this.datatree = create_tree(dd, this);
217 this.datatree = create_leaf_node(this, detailed_data);
Interface class for all kind of reduced basis generation algorithms
Greedy.DataTree.Detailed.INode datatree
the actual generated data tree
create_tree_opts
struct with transient options for the create_leaf_node() method.
a default reduced data implementation which stores a data tree object copying the structure of a Gree...
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
default implementation of the DataTree.ICreator interface
an interface specialization for detailed data objects used with the Greedy algorithm.
Interface classes to be implemented by the Greedy.Algorithm user.
Interface class for general data tree nodes storing detailed data returned by Greedy.Interface.gen_detailed_data()
Customizable implementation of an abstract greedy algorithm.
interface specialization for a reduced model that can be used with the Greedy algorithm for basis gen...
Interface class for the generation and storage of offline matrices and vectors as described in Module...