2 % %Interface
class for general data tree nodes storing detailed data returned
5 % Usually every
Greedy.
Interface instance creates a
new node in the detailed
6 % data tree with
new reduced basis functions or a logging information about
12 % storage of history entries (c.f. snapshot() and format_snapshot() )
17 properties (Access = private)
19 history_ids = struct('
id', {},
'id_descr', {},
'map', []);
25 function set_rb(
this, RB)
26 %
function set_rb(
this, RB)
27 % sets the reduced basis space
29 % @todo is
this correct or should it be in a specialization?
33 function RB = get_rb(
this)
34 %
function set_rb(
this, RB)
35 % returns the reduced basis space
37 % @todo is
this correct or should it be in a specialization?
42 %
function data = get_by_description(
this,
id, dmodel)
43 % %
function data = get_by_description(
this,
id, model)
44 % % returns a
leaf in the
DataTree for a specific ID, parameter and time instant.
48 % %
id: a
string specifying an optional ID restriction. (
default = empty)
59 % mu = get_mu(dmodel);
60 % nt = dmodel.descr.nt;
65 function snapshot(
this,
id, id_text, snapshot_description)
66 %
function snapshot(
this,
id, id_text, snapshot_description)
67 % creates a copy of the
Greedy.
Info element of the subtree rooted by
this
68 % node and stores it in a history.
70 % The history is organized by
short ID strings to whom a longer
71 % description text should be attached. Furthermore every history entry
72 % can be decribed by a Matlab
struct. A Date tag is added automatically.
75 % which refines the training parameter space several times. At all these
76 % time instants it creates a
new history entry.
79 %
id: the
id string under which the history entry shall be stored.
80 % id_text: a descriptive text
for the
id. This is only used at the
81 % first time a history entry
for the
'id' is created.
82 % snapshot_description: a description of the history entry with
84 [dummy, index] = intersect({this.history_ids.id}, id);
85 hist_index = length(this.history) + 1;
87 index = length(this.history_ids) + 1;
88 this.history_ids(index).
id =
id;
89 this.history_ids(index).map = hist_index;
91 this.history_ids(index).map = [this.history_ids(index).map, hist_index];
95 this.history_ids(index).id_descr = id_text;
98 dates = datestr(clock, 'dd.mm.yyyy HH:MM');
100 if ~isempty(this.fields) || ~isempty(this.stop_flags)
101 this.history{hist_index}.description = snapshot_description;
102 this.history{hist_index}.date = dates;
103 if ~isempty(this.fields)
104 this.history{hist_index}.fields = this.fields;
106 if ~isempty(this.stop_flags)
107 this.history{hist_index}.stop_flags = this.stop_flags;
111 snapshot_children(
this,
id, id_text, snapshot_description);
114 function sl = get_snapshot_length(
this,
id)
115 %
function sl = get_snapshot_length(
this,
id)
116 % returns the number of history entries stored
for a specific
id.
122 % sl: number of history entries
123 [dummy, index] = intersect(this.history_ids.id,
id);
127 sl = length(this.history_ids.
id{index});
131 function fs = format_snapshot(
this,
id, indices)
132 %
function fs = format_snapshot(
this,
id, indices)
133 % retuns a formatted structure of a history item
for several indices
136 [dummy, index] = intersect({this.history_ids.id}, id);
141 if nargin == 2 || isempty(indices)
142 indices = 1:length(this.history_ids(index).map);
146 fs.descr = this.history_ids(index).id_descr;
147 fs.history = this.history{this.history_ids(index).map(indices)};
149 children = gather_children_format_snapshot(
this,
id, indices);
150 if ~isempty(children)
151 fs.children = children;
157 methods(Access = protected)
159 function snapshot_children(this,
id, id_text, snapshot_description)
160 % function snapshot_children(this,
id, id_text, snapshot_description)
161 % forward the snapshot generation to the children
162 for i = 1:length(this)
163 snapshot_children(get(this, i),
id, id_text, snapshot_description);
167 function children = gather_children_format_snapshot(this,
id, indices)
168 % function children = gather_children_format_snapshot(this,
id, indices)
169 % helper function called by format_snapshot()
170 children = cell(1, length(this));
171 for i = 1:length(this)
172 children{i} = gather_children_format_snapshot(
get(
this, i),
id, indices);
179 %
function siz = get_rb_size(
this);
180 % returns the size of the reduced basis stored in
this tree.
183 % siz: dimension of stored reduced basis space `{\cal W}_{\text{red}}`
184 siz = get_rb_size(
this);
186 %
function siz = get_ei_size(
this);
187 % returns the size of the collateral reduced basis stored in
this tree.
191 % of stored collateral reduced basis spaces `{\cal W}^{{\cal
192 % L}_h}_{\text{red}}`
for operators `{\cal L}_h`
193 siz = get_ei_size(
this);
195 %
function [ot1, ot2, ot3] = offtime(
this, rmodel)
196 % returns up to three different offline time measurements
197 [ot1, ot2, ot3] = offtime(
this, rmodel);
interface specialization for a leaf element in a DataTree returned by the Greedy basis generation alg...
Interface class for all kind of reduced basis generation algorithms
function detailed_data = gen_detailed_data(IReducedModel rmodel, detailed_data,Greedy.Checkpoint checkpoint)
main entry function construction the detailed data tree storing the reduced basis functions...
DataTree implementation for generated detailed and reduced data
Data Tree element which can be filtered by ids
This is and IDetailedModel interface specialization for detailed models that shall be suitable for Gr...
Interface for a node in a DataTree.
DataTree specialization for detailed data generated by a Greedy algorithm instance.
greedy basis generation extension which adaptively refines the trainings parameter set...
Information objects generated throught Greedy execution.
Customizable implementation of an abstract greedy algorithm.
function INode data = get_by_description(id, mu, nt)
A combination of get_index() and get()
a DataTree.INode extension for data nodes that can store information on their generation process...