2 % This is the
interface for a detailed model providing methods to compute
3 % high dimensional simulation snapshots.
5 % An
IDetailedModel implementation can be combined used as a basis
for
6 % reduced basis generation routines and a reduced model as described in the
7 % section on the @ref rbm_interface
"main interfaces".
9 % Some basis generation algorithms, however, depend on models with a
10 % specialized interface. For example the
Greedy.
Algorithm class comes with a
13 properties (GetAccess =
public, SetAccess =
protected)
14 % The description structure holding information about the analytical
15 % parametrized problem and its discretization
20 properties (Dependent)
25 % this structure holds variable names that need to be defined by the
27 base_checks = struct('mu_names', {{@iscell}}, ...
28 'mu_ranges', {{@iscell}}, ...
29 'debug', {{@isscalar}},...
30 'verbose', {{@isscalar}} );
33 properties (SetAccess =
private, Dependent)
34 % cell array of strings describing the parameters of the model
37 % cell array of vectors of size two defining the allowed interval range
for
38 % the parameter components
41 % an integer defining the verbosity level of information output during
45 % an integer defining the debugging level controlling error output and
46 % extra tests during basis generation
56 % descr: The underlying description of the analytical problem and
62 error(
'Consistency check for IDetailedModel failed');
64 if ~isfield(descr,
'decomp_mode')
65 dmbif.descr.decomp_mode = 0;
69 function mu_ranges = get.mu_ranges(this)
70 mu_ranges = this.descr.mu_ranges;
73 function mu_names = get.mu_names(this)
74 mu_names = this.descr.mu_names;
77 function decomp_mode = get.decomp_mode(this)
78 decomp_mode = this.descr.decomp_mode;
81 function set.decomp_mode(this, decomp_mode)
82 this.descr.decomp_mode = decomp_mode;
85 function debug = get.debug(this)
86 debug = this.descr.debug;
93 function isequal = eq(this, other)
94 % function eq(this, other)
95 % overloaded equality ('==') operator, by default comparing the
#descr variables
97 % This can be used as
' this == other ' and returns whether the two
98 % DetailedModels are identical.
104 % isequal:
boolean value indiciating whether
' this == other '
105 ignorelist = {
'filecache_ignore_fields_in_model',
'decomp_mode',
't', ...
107 ignorelist = [ ignorelist, this.descr.mu_names ];
108 if isfield(this.descr,
'filecache_ignore_fields_in_model')
109 ignorelist = [ ignorelist, this.descr.filecache_ignore_fields_in_model ];
111 [isequal, a, b, c] = structcmp(this.descr, other.descr, ignorelist);
113 disp('fields of model and stored model differs:')
114 disp('differing fields:');
116 disp('additional fields in model:');
118 disp('additional fields in stored model:');
123 function this = set_mu(this, mu)
124 % function this = set_mu(this, mu, propagate)
125 % sets the active parameter vector `\mu \in {\cal M}`
127 % The parameter set here, is used by the detailed_simulation() function.
129 % The default implementation sets all fieldnames 'descr.mu_names' in the
133 % mu: The parameter vector `\boldsymbol\mu`.
136 %
this: handle of type
IDetailedModel to the changed DetailedModel
138 assert(length(mu) == length(this.descr.mu_names));
140 for i = 1:length(this.descr.mu_names)
141 this.descr.(this.descr.mu_names{i}) = mu(i);
145 function mu = get_mu(
this)
146 %
function mu = get_mu(
this)
147 % returns the active parameter vector `\boldsymbol\mu \in {\cal M}`
149 % The
default implementation returns a vector of the values of the fields
150 % of the #descr structure with names
'descr.mu_names'.
153 % mu: The parameter vector `\boldsymbol\mu`
157 mu = cellfun(@(x) this.descr.(x), this.descr.mu_names,
'UniformOutput',
true);
163 %
function model_data = gen_model_data(
this)
164 % generates large model data.
166 % This
function generates e.g. a grid, which is not to be stored in the
167 % model, but required
for numerics.
170 % model_data: Matlab structure of type
ModelData storing high dimensional
171 % data needed by detailed_simulation().
172 model_data = gen_model_data(
this);
174 %
function sim_data = detailed_simulation(
this, model_data)
175 % executes a detailed simulation
for a given parameter
177 % This
function computes a numerical scheme defined by the #descr
for the
178 % parameter set via the set_mu() method.
181 % sim_data: structure holding the `H`-dimensional simulation data.
182 sim_data = detailed_simulation(this, model_data);
185 % function p =
plot_sim_data(dmodel, model_data, sim_data, plot_params)
186 % plots the simulation data as returned by detailed_simulation()
189 % sim_data: simulation data structure as returned by detailed_simulation()
190 % plot_params: structure which controls the plot output
193 % p: GUI handle to the created MATLAB figure
194 p =
plot_sim_data(dmodel, model_data, sim_data, plot_params);
197 methods (Static, Abstract)
199 % function U = get_dofs_from_sim_data(sim_data)
200 % extracts the `H` dimensional Dof vector from the 'sim_data' structure
203 % U: `H` dimensional Dof vector
204 U = get_dofs_from_sim_data(sim_data);
static const base_checks
this structure holds variable names that need to be defined by the descr structure.
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
default greedy basis generation class
This is the common interface for all models, detailed and reduced ones.
static function ok = struct_check(descr, checks)
executes checks on the fields of a structure object
descr
The description structure holding information about the analytical parametrized problem and its discr...
This is the interface for a detailed model providing methods to compute high dimensional simulation s...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Customizable implementation of an abstract greedy algorithm.
Struct with high dimensional data needed for a high dimensional simulation.