KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AExperimentModelConfig.m
Go to the documentation of this file.
1 namespace models{
2 namespace muscle{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
27  public:
28 
29  OutputDir = "[]";
30 
32 
33 
34  public: /* ( Dependent ) */
35 
37 
38 
39  public:
40 
42 
44 
45 
58  private:
59 
60  fCurConfNr = 1;
61 
62 
63  public:
64 
66  this = this@models.muscle.AMuscleConfig(varargin[:]);
67  }
77 #if 0 //mtoc++: 'set.CurrentConfigNr'
78 function CurrentConfigNr(nr) {
79  if nr < 1 || nr > this.NumConfigurations
80  error(" Please choose one of the %d possible configurations. ",this.NumConfigurations);
81  end
82  this.fCurConfNr= nr;
83  if ~isempty(this.Model)
84  this.Model.setConfig(this);
85  end
86  }
87 
88 #endif
89 
99 #if 0 //mtoc++: 'get.CurrentConfigNr'
100 function value = CurrentConfigNr() {
101  value = this.fCurConfNr;
102  }
103 
104 #endif
105 
106 
107  protected:
108 
109  function init() {
110  init@models.muscle.AMuscleConfig(this);
111 
112  /* Also init directories to reasonable defaults */
113  if isempty(this.OutputDir)
114  mc = metaclass(this);
115  [~,n] = fileparts(which(mc.Name));
116  /* Put relative to models.muscle.Model class - that wont change
117  * location! */
118  p = fullfile(fileparts(which(" models.muscle.Model "))," .. "," .. "," data ");
119  outdir = fullfile(p,n);
120  this.OutputDir= outdir;
121  end
122  }
123 
124 
125  public:
126 
127 
128 #if 0 //mtoc++: 'set.OutputDir'
129 function OutputDir(value) {
130  if ~isempty(value)
131  Utils.ensureDir(value);
132  this.OutputDir= value;
133  this.ImgDir= fullfile(value," img ");/* #ok */
134 
135  end
136  }
137 
138 #endif
139 
140 
141  public: /* ( Abstract ) */
142 
143  virtual function o = getOutputOfInterest(double t,matrix<double> y) = 0;
144 
145 
146  /* % IC comp stuff */
147  public: /* ( Abstract ) */
148 
150 
151 
152  public: /* ( Abstract ) */
153 
155 
156 
157  public:
158 
159  function x0 = getX0(x0) {
160  if ~this.ICCompMode
161  optstr = this.getOptionStr;
162  s = load(fullfile(this.OutputDir,sprintf(" IC_%s.mat ",optstr)));
163  /* We assume to have an IC for each configuration (possibly) */
164  x0 = s.x0(:,this.CurrentConfigNr);
165  end
166  }
167 
168 
170  if this.RequiresComputedInitialConditions
171  this.ICCompMode= true;
172  m = this.Model;
173  file = fullfile(this.OutputDir,sprintf(" IC_%s.mat ",optstr));
174  value = ~this.HasICComputation || exist(file," file ") == 2;
175  end
176  }
177 
178 
188 };
189 }
190 }
191 
192 
193 
AExperimentModelConfig(varargin)
Override in subclasses and set NumConfigurations to the number of possible experiment runs with diffe...
Collection of generally useful functions.
Definition: Utils.m:17
virtual function o = getOutputOfInterest(double t,matrix< double > y)
function str = getOptionStr(withtag)
Definition: AFEMConfig.m:145
A variable number of input arguments.
TargetOutputValues
The experimentally determined output values. Must be a NumConfigurations x NumOutputs vector...
CurrentConfigNr
Sets the configuration number.
Model: Model for a FEM-discretized muscle model.
Definition: Model.m:19