1 classdef Model < handle & matlab.mixin.Copyable
2 % MODEL Abstract model
class
4 % This
class represents abstract RB problems that define common
7 % Andreas Schmidt, 2016
17 % The function DETAILED_SIMULATION returns an instance of
19 dsim = detailed_simulation(model, model_data);
22 % This function should return a reduced simulation of type
24 rsim = rb_simulation(model, reduced_data);
28 % Note: All of the following methods can be redefined by the
29 % subclasses and completely customized to fit the needs of your
33 % Use this function in order to create a class of type
34 %
ModelData which contains all the large-scale model data such
35 % as the discretized operators
36 function model_data = gen_model_data(this)
37 model_data = eval([this.problem_type(), '.
ModelData(this)']);
41 % Call the basis generation algorithm.
42 function detailed_data = gen_detailed_data(this, model_data)
43 detailed_data = eval([this.problem_type(), '.
DetailedData(this, model_data)']);
47 % Get the reduced data structures
48 function reduced_data = gen_reduced_data(this, detailed_data)
49 reduced_data = eval([this.problem_type(), '.
ReducedData(this, detailed_data)']);
53 % Use this function to determine the problem type. So consider
54 % overwriting it if necessary!
55 function pt = problem_type(this)
56 % TODO: implement a smart interface that automatically
57 % generates the correct
59 if isempty(find(c=='.'))
60 warning('Consider reimplementing problem_type method in class %s as the return value might be incorrect', c);
63 pt = c(1:max(find(c=='.')-1));
68 % =====================================================================
72 function mu = get_mu(this)
73 % Get the parameter values
77 function this = set_mu(this, mu)
78 % Set the parameter values
79 if length(mu) ~= length(this.mu_names)
80 error('Mu length wrong. This model expects %d parameters: %s', length(this.mu_names), strjoin(this.mu_names,', '));
83 % Validate the parameter ranges
85 if mu(i) < this.mu_ranges{i}(1) || mu(i) > this.mu_ranges{i}(2)
86 error(
'The value for the parameter %s is wrong. The valid range is [%f, %f].\n', ...
87 this.mu_names{i}, this.mu_ranges{i}(1), this.mu_ranges{i}(2))