2 % Interface
class for the generation and storage of reduced basis spaces as
3 % described in @ref
basisgen "Module (M2)"
8 %
struct of type
BasisGenDescr describing how the basis shall be generated.
10 % The fields in
this structure usually
override the
default values of the
14 % struct of type
ModelData holding `H`-dimensional model data, which is
15 % needed for an
IDetailedModel.detailed_simulation(), e.g. a grid
object.
23 % constructor generating the reduced basis spaces
25 % It overwrites all properties of the
IDetailedData implementation with
30 ddi.model_data = model_data;
31 ddi.bg_descr = bg_descr;
34 this_fields = properties(ddi);
35 descr_fields = setdiff(fieldnames(bg_descr), ...
36 {
'detailed_data_constructor',
'reduced_data_constructor',
'rmodel_constructor', ...
38 intersect_fields = intersect(descr_fields, this_fields);
40 for i = 1:length(intersect_fields)
41 ddi.(intersect_fields{i}) = bg_descr.(intersect_fields{i});
44 unused_fields = setdiff(descr_fields, this_fields);
45 if ~isempty(unused_fields)
47 ['The fields ', evalc('unused_fields'), ...
52 function ret = subsref(this, S)
53 % function ret = subsref(this, S)
54 % forwarding of fieldnames access to the underlying model_data struct
56 % If the user calls 'detailed_data.parameter' and the field 'parameter' exists
57 % in the underlying 'model_data' structure, the value of
58 % 'model_data.parameter' is returned. This method is implemented for
59 % compatibility reasons, such that a basis generation
object can be used
60 % like an old model. Try to prevent usage of this method in the future.
62 % @note that this method throws a 'RBmatlab:Compatibility' warning if a
63 % description field is accessed.
65 thissubs = [properties(this); methods(this)];
66 fns = setdiff(fieldnames(this.model_data), thissubs);
67 if S(1).type(1) == '.' ...
68 && ~isempty(intersect(fns, S(1).subs))
69 warning('RBmatlab:Compatibility', ...
70 ['Requesting the model_data field ''', S(1).subs, ...
72 'substitute the ''detailed_data'' by a ''detailed_data.model_data''']);
73 ret = this.model_data.(S(1).subs);
75 ret = builtin('subsref', this, S);
81 % function rb_size = get_rb_size(this, rmodel)
82 % returns the dimension of the stored reduced basis space.
85 % rmodel: model of type
IReducedModel specifying which basis space
86 % dimension shall be returned in case different spaces have been
87 % generated different parameters, time intervals or variables. In
88 % most implementations this parameter is unused.
89 rb_size = get_rb_size(this, rmodel);