rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
IDetailedData.m
1 classdef IDetailedData < handle
2  % Interface class for the generation and storage of reduced basis spaces as
3  % described in @ref basisgen "Module (M2)"
4  %
5 
6  properties
7 
8  % struct of type BasisGenDescr describing how the basis shall be generated.
9  %
10  % The fields in this structure usually override the default values of the
11  % used IDetailedData object. See gen_reduced_model() for more details.
12  bg_descr;
13 
14  % struct of type ModelData holding `H`-dimensional model data, which is
15  % needed for an IDetailedModel.detailed_simulation(), e.g. a grid object.
16  model_data;
17 
18  end
19 
20  methods
21  function ddi = IDetailedData(bg_descr, model_data)
22  % function ddi = IDetailedData(bg_descr, model_data)
23  % constructor generating the reduced basis spaces
24  %
25  % It overwrites all properties of the IDetailedData implementation with
26  % values given in the BasisGenDescr structure.
27  %
28  % Parameters:
29  % bg_descr: struct of type BasisGenDescr
30  ddi.model_data = model_data;
31  ddi.bg_descr = bg_descr;
32 
33  % consistency check:
34  this_fields = properties(ddi);
35  descr_fields = setdiff(fieldnames(bg_descr), ...
36  {'detailed_data_constructor', 'reduced_data_constructor', 'rmodel_constructor', ...
37  'rb_problem_type'});
38  intersect_fields = intersect(descr_fields, this_fields);
39 
40  for i = 1:length(intersect_fields)
41  ddi.(intersect_fields{i}) = bg_descr.(intersect_fields{i});
42  end
43 
44  unused_fields = setdiff(descr_fields, this_fields);
45  if ~isempty(unused_fields) && 1 == 0
46  warning('RBmatlab:IDetailedData:Consistency', ...
47  ['The fields ', evalc('unused_fields'), ...
48  ' are unused by IDetailedData implementation']);
49  end
50  end
51 
52  function ret = subsref(this, S)
53  % function ret = subsref(this, S)
54  % forwarding of fieldnames access to the underlying model_data struct
55  %
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.
61  %
62  % @note that this method throws a 'RBmatlab:Compatibility' warning if a
63  % description field is accessed.
64 
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, ...
71  '''\nfrom a IDetailedData object! Maybe you should\n',...
72  'substitute the ''detailed_data'' by a ''detailed_data.model_data''']);
73  ret = this.model_data.(S(1).subs);
74  else
75  ret = builtin('subsref', this, S);
76  end
77  end
78  end
79 
80  methods(Abstract)
81  % function rb_size = get_rb_size(this, rmodel)
82  % returns the dimension of the stored reduced basis space.
83  %
84  % Parameters:
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);
90  end
91 
92 end
Struct with control fields for the reduced basis generation.
Definition: dummyclasses.c:56
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Definition: IReducedModel.m:17
function rmodel = gen_reduced_model(dmodel,BasisGenDescr bg_descr)
generates an IReducedModel instance from a description structure.
This is the interface for a detailed model providing methods to compute high dimensional simulation s...
Struct with high dimensional data needed for a high dimensional simulation.
Definition: dummyclasses.c:1
Interface class for the generation and storage of reduced basis spaces as described in Module (M2)...
Definition: IDetailedData.m:17