In file io.h:

template class Parameter : public ParameterBase

Parameter input

Inheritance:


Inherited from ParameterBase:


Documentation

Parameter input. The following allows declaration of named parameters that can then be read from a file containing the name of the parameter followed by a semi-colon, spaces and a value e.g. velocity: 2.4 3.2 9.5 // velocity in 3D pressure: 3.4 In the code you would write: ParameterSet myset; // this is now the default set of parameters Parameter velocity("velocity"); Parameter pressure("pressure"); The above line declare ``pressure'' to be a parameter of type double. "pressure" can then be used simply as a double, although it is primarily intended to be passed to other functions for initialization, etc... The above are only declarations. There are two ways to initialize the parameters (i.e. to get the values associated with each parameter from the file): 1) when the parameter is declared. This goes as follows: ParameterSet myset; myset.DefaultInputFile(my_input_file); myset.LoadWhenDeclared(); Parameter velocity("velocity"); Parameter pressure("pressure"); In this case velocity and pressure are initialized right away. 2) delayed initialization. suppress myset.LoadWhenDeclared(); from the above example and add after the last parameter declaration the call LoadParameter(); Delayed and instant initialization can be changed with the calls myset.LoadWhenDeclared(); myset.DelayedLoad(); Sometimes one already has the variable declared, but would want it initialized from a file. This is done like: double pressure; NamedParameter(pressure,"pressure"); After call to LoadParameters, pressure will have been initialized to 3.4 (in the above example). One can have more than one set of parameters: ParameterSet set1; ParameterSet set2; Parameter velocity("velocity",set1) .... ... Parameter n_of_pies("n_of_pies",set2); followed by calls to LoadParameters (Unless LoadWhenDeclared() was used): LoadParameters(file1,set1); LoadParameters(file2,set2); Note: 1)The LoadParameters() function can be called several times for the same set, but any given parameter gets initialized only once. 2)If a serie of parameter was declared using delayed initialization, a call to LoadWhenDeclared() and a subsequent declaration of another parameter (in the same set) will initialize all parameters in the set, not just the last one. TO DO: 1) The destructors need to be written properly. I didn't bother to do it so far because the parameters a currently destroyed only when the prog. terminates. 2) It is currently not possible to delete a parameter from a parameter set. Not needed so far, but you never know. 3) Implement

This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de