rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Interface.m
1 classdef Interface < handle
2  % %Interface class for all kind of reduced basis generation algorithms
3  %
4  %
5 
6  properties (Abstract, SetAccess=private, Dependent)
7 
8  % string specifying the detailed data produced by this basis generation
9  % algorithm object.
10  %
11  % This should be one of
12  % - 'ei' : for empirical interpolation basis
13  % - 'rb' : for reduced basis
14  % - 'eirb' : for combination fo empirical interpolation and reduced basis
15  generated_basis_type;
16 
17  % This is an id string inherited by the underlying extension algorithm
18  % object implementing a Greedy.Plugin.Interface.
19  %
20  % At the moment this id is not used.
21  id;
22  end
23 
24 
25  properties (SetAccess = protected)
26  % control variable of type boolean variable controlling whether check
27  % points shall be created after every reduced basis extension step.
28  enable_checkpointing = true;
29  end
30 
31  methods
32 
33  function summ = horzcat(varargin)
34  % function summ = horzcat(varargin)
35  % combines an arbitrary number of basis generation algorithms
36  %
37  % This constructs a Greedy.Combined object from a horizontal
38  % concatenation of basis generation objects.
39  %
40  % Example usage:
41  % @code
42  % sum = [ [ ei_greedy1, ei_greedy2, ei_greedy3 ], rb_greedy ];
43  % @endcode
44  %
45  % Return values:
46  % summ: the constructed object of type Greedy.Combined
47  summ = Greedy.Combined(varargin{:});
48  end
49 
50  %function this = set.Mstrich(this, value)
51  % this.model.Mstrich = value;
52  % if this.model.Mstrich == 0
53  % this.model.enable_error_estimator = false;
54  % else
55  % this.model.enable_error_estimator = true;
56  % end
57  %end
58 
59 
60  function detailed_data = gen_detailed_data(this, rmodel, detailed_data, checkpoint)
61  % function detailed_data = gen_detailed_data(this, rmodel, detailed_data, [checkpoint])
62  % main entry function construction the detailed data tree storing the
63  % reduced basis functions.
64  %
65  % This method starts the reduced basis generation process, by calling the
66  % abstract interface methods init_basis() and basis_extension()
67  % subsequently. If enable_checkpointing is set to 'true', checkpoint
68  % shall be created periodically storing all data necessary to resume from
69  % this point in the algorithm, when the checkpoint is given as the
70  % optional third argument.
71  %
72  % Parameters:
73  % rmodel: object of type IReducedModel providing descriptions of
74  % the entire model needed for basis generation.
75  % detailed_data: either a struct containing high dimensional model data
76  % needed to execute detailed simulations or an object of
77  % type Greedy.DataTree.Detailed.INode in case of resume from a
78  % checkpoint.
79  % checkpoint: object of type Greedy.Checkpoint specifying a given point in the
80  % algorithm where it basis generation can be resumed.
81  %
82  % Return values:
83  % detailed_data: object of type Greedy.DataTree.Detailed.INode storing the reduced
84  % basis information in the leaf nodes and information on
85  % the reduced basis generation in every node.
86  if nargin == 3 || isempty(checkpoint)
87  checkpoint = Greedy.Checkpoint;
88  end
89  % is the initially generated reduced basis not yet stored in detailed_data?
90  if ~get(checkpoint, 'init_basis_computed', false)
91  prepare(this, rmodel, detailed_data);
92  detailed_data = init_basis(this, rmodel, detailed_data);
93  end
94  checkpoint = checkpoint.store(rmodel, detailed_data, 'gen_detailed_data', struct('init_basis_computed', true));
95  detailed_data = basis_extension(this, rmodel, detailed_data, checkpoint.child([]));
96  rmodel.N = get_rb_size(detailed_data);
97  %rmodel.M = get_ei_size(detailed_data) - rmodel.Mstrich;
98  end
99 
100 
101  end
102 
103  methods (Abstract)
104 
105  % initialization routine for basis extension
106  %
107  % This method is run by the gen_detailed_data() method before the execution
108  % of the init_basis() methods and should be used for preparation purposes,
109  % like
110  % - initialization of the training and validation parameter space and
111  % - caching detailed simulations if necessary.
112  prepare(this, rmodel, model_data);
113 
114  % construction of an initial reduced basis
115  %
116  % This method is called at the beginning of the gen_detailed_data() method
117  % right after a call to prepare(). It should be used to construct an
118  % initial reduced basis, e.g. approximating the initial value functions in
119  % case of evolution problems.
120  %
121  % Return values:
122  % detailed_data: object of type Greedy.DataTree.Detailed.INode storing the reduced
123  % basis information in the leaf nodes and information on
124  % the reduced basis generation in every node.
125  detailed_data = init_basis(this, rmodel, model_data);
126 
127  % basis extension routine
128  %
129  % This method is run by the gen_detailed_data() method at the very end, and
130  % shall actually construct the reduced basis.
131  %
132  % Parameter values:
133  % checkpoint: an object of type GreedyCheckpoint used for
134  % checkpointing.
135  %
136  % Return values:
137  % detailed_data: object of type Greedy.DataTree.Detailed.INode storing the reduced
138  % basis information in the leaf nodes and information on
139  % the reduced basis generation in every node.
140  detailed_data = basis_extension(this, rmodel, detailed_data, checkpoint);
141 
142  % error indication routine
143  % [max_errs, max_err_sequence, max_mu_index] = error_indicators(this, detailed_data, parameter_set, reuse_reduced_data);
144 
145 
146  end
147 
148  methods (Hidden = true)
149  function value = get_generated_basis_type(this)
150  % function value = get_generated_basis_type(this)
151  % returns the #generated_basis_type property. Why???
152  value = this.generated_basis_type;
153  end
154  end
155 
156 end
Interface class for extension algorithms which define the basis extension routines used by the abstra...
Definition: Interface.m:19
DataTree implementation for generated detailed and reduced data
Definition: DuneRBLeafNode.m:2
combines two or more instances of a Greedy.Interface class by executing them subsequently.
Definition: Combined.m:18
Helper class used to store and restore data tree objects at specified checkpoints.
Definition: Checkpoint.m:18
DataTree specialization for detailed data generated by a Greedy algorithm instance.
Definition: DuneRBLeafNode.m:3
Definition: leaf.m:17
Specialization plugins for the greedy algorithm.
Definition: Default.m:2
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Definition: IReducedModel.m:17
Interface class for general data tree nodes storing detailed data returned by Greedy.Interface.gen_detailed_data()
Definition: INode.m:20
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1