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
IClassConfig.m
Go to the documentation of this file.
1 
2 
3 /* (Autoinserted by mtoc++)
4  * This source code has been filtered by the mtoc++ executable,
5  * which generates code that can be processed by the doxygen documentation tool.
6  *
7  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
8  * Except for the comments, the function bodies of your M-file functions are untouched.
9  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
10  * attached source files that are highly readable by humans.
11  *
12  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
13  * the correct locations in the source code browser.
14  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
15  */
16 
18  :public KerMorObject,
19  public ICloneable {
40  public:
41 
53  protected:
54 
65  public: /* ( Sealed ) */
66 
67  function lbl = getAxisLabels(nrs) {
68  if nargin < 2
69  nrs = 1:this.getNumConfigurations;
70  end
71  lbl = arrayfun(@convert,nrs," Unif ",false);
72 
73  function o = convert(e)
74  tmp = this.getConfigurationString(e, true);
75  o = Utils.implode(tmp,sprintf(" / "));
76  end
77  }
78 
79 
80  function doublet = getValueRanges() {
81  t = PrintTable;
82  t.HasHeader= true;
83  t.HasRowHeader= true;
84  t.addRow(" Location "," Min "," Max ");
85  this.collectRanges(t,[this.getClassName]);
86  }
87 
88 
89  public:
90 
91 
92 #if 0 //mtoc++: 'set.Prototype'
93 function Prototype(value) {
94  if ~isa(value, " ICloneable ")
95  error(" The prototype must be a ICloneable descendant. ");
96  elseif ~isempty(this.RequiredPrototypeClass) && ...
97  ~isa(value,this.RequiredPrototypeClass)/* #ok */
98 
99  error(" The prototype must be a %s descendant. ",...
100  this.RequiredPrototypeClass);/* #ok */
101 
102  end
103  this.Prototype= value;
104  }
105 
106 #endif
107 
108 
109  function copy = clone(copy) {
110  if nargin < 2
111  error(" You must call this clone method passing a cloned subclass instance. ");
112  end
113  /* Dont clone the prototype here; it's cloned anyways every time
114  * a new instance is configured. */
115  copy.Prototype= this.Prototype;
116  copy.RequiredPrototypeClass= this.RequiredPrototypeClass;
117  }
118 
119 
120  protected:
121 
122  function ptype = getProtoClass() {
123  if isempty(this.Prototype)
124  error(" No prototype set ");
125  end
126  ptype = this.Prototype.clone();
127  }
128 
129 
130  function idx = getPartIndices(partNr,totalParts) {
131  rs = RangeSplitter(this.getNumConfigurations, " Num ", totalParts);
132  idx = rs.getPart(partNr);
133  }
134 
135 
136  function addRange(ptable,proppath,minval,maxval) {
137  head = Utils.implode(proppath," . ");
138  ptable.addRow(head,minval,maxval);
139  }
140 
141 
142  public: /* ( Abstract ) */
143 
144  virtual function integern = getNumConfigurations() = 0;
153  virtual function ICloneableobject = configureInstance(integer nr) = 0;
164  virtual function integerstr = getConfigurationString(integer nr,logical asCell) = 0;
177  virtual function charstr = getConfiguredPropertiesString() = 0;
186  virtual function IClassConfigconf = getSubPart(integer partNr,integer totalParts) = 0;
202  protected: /* ( Abstract ) */
203 
204  virtual function collectRanges(ptable,proppath) = 0;
205 
206 
207  protected:
208 
209  function obj = loadobj(from) {
210  if nargin < 2 || ~isa(from," IClassConfig ")
211  error(" Must call this loadobj method from subclass with subclass instance ");
212  end
213  obj = loadobj@KerMorObject(obj, from);
214  obj.Prototype= from.Prototype;
215  obj.RequiredPrototypeClass= from.RequiredPrototypeClass;
216  }
217 
218 
219  public: /* ( Static ) */
220 
221  static function test_ClassConfigPlots() {
222 
223  pm = PlotManager(false,2,2);
224  pm.LeaveOpen= true;
225  runTest(kernels.config.RBFConfig(" G ",.4:.01:.6));
226  runTest(kernels.config.GaussConfig(" G ",1:10));
227  runTest(kernels.config.WendlandConfig(" G ",1:5," S ",(1:5)/2," D ",2));
228 
229  pm.done;
230 
231  function runTest(c)
232  fprintf(" %s: %s ",c.getClassName,c.getConfiguredPropertiesString);
233  nc = c.getNumConfigurations;
234  x = 1:nc;
235  fx = ones(size(x));
236  h = pm.nextPlot(c.getClassName,c.getClassName);
237  plot(h,x,fx);
238  set(h," XTick ",1:nc," XTickLabel ",c.getAxisLabels);
239  disp(c.getAxisLabels);
240  end
241  }
242 
243 
249 };
250 
Collection of generally useful functions.
Definition: Utils.m:17
function double t = getValueRanges()
Definition: IClassConfig.m:80
IClassConfig: Abstract interface for a set of configurations that can be applied to a given algorithm...
Definition: IClassConfig.m:17
ICLONEABLE Interface for cloneable handle classes.
Definition: ICloneable.m:17
virtual function integer n = getNumConfigurations()
Returns the number of configurations that can be applied.
virtual function char str = getConfiguredPropertiesString()
Returns a string of the changed properties by this IClassConfig instance.
virtual function IClassConfig conf = getSubPart(integer partNr,integer totalParts)
Returns a sub-part of this configuration as a new instance.
function idx = getPartIndices(partNr, totalParts)
Definition: IClassConfig.m:130
static function test_ClassConfigPlots()
Definition: IClassConfig.m:221
Base class for any KerMor class.
Definition: KerMorObject.m:17
function ptype = getProtoClass()
Definition: IClassConfig.m:122
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
Definition: IClassConfig.m:109
An integer value.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Definition: PlotManager.m:17
virtual function collectRanges(ptable, proppath)
A boolean value.
function addRange(ptable, proppath, minval, maxval)
Definition: IClassConfig.m:136
KerMorObject()
Constructs a new KerMor object.
Definition: KerMorObject.m:55
virtual function integer str = getConfigurationString(integer nr,logical asCell)
Returns the number of configurations that can be applied.
ICloneable Prototype
The prototype class that is to be used as base class before configuring a new instance.
Definition: IClassConfig.m:42
function cn = getClassName()
Returns the simple class name of this object without packages.
Definition: KerMorObject.m:108
function lbl = getAxisLabels(nrs)
Definition: IClassConfig.m:67
virtual function copy = clone(target)
The interface method with returns a copy of the current class instance.
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
RangeSplitter:
Definition: RangeSplitter.m:17
PrintTable: Class that allows table-like output spaced by tabs for multiple rows. ...
Definition: PrintTable.m:17
char RequiredPrototypeClass
Determines the class that is allowed to be configured.
Definition: IClassConfig.m:55
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
Definition: Utils.m:208
virtual function ICloneable object = configureInstance(integer nr)
Creates a new instance with given configuration.
A MatLab character array.
function obj = loadobj(from)
Definition: IClassConfig.m:209