Holds parameters in hashes. More...
#include <inputOutput.hh>


Public Member Functions | |
| void | addArrayBool (const char *array, const bool newArray=false) |
| Creates an emtpy array for bools if necessary. | |
| void | addArrayBool (const char *array, const int number, const int value) |
| Adds a bool to an array. | |
| void | addArrayComplex (const char *array, const bool newArray=false) |
| Creates an empty array for complex doubles if necessary. | |
| void | addArrayComplex (const char *array, const int number, const std::complex< double > value) |
| Adds a complex double to an array. | |
| void | addArrayDouble (const char *array, const int number, const double value) |
| Adds a double to an array. | |
| void | addArrayDouble (const char *array, const bool newArray=false) |
| Creates an empty array for doubles if necessary. | |
| void | addArrayInt (const char *array, const bool newArray=false) |
| Creates an empty array for ints if necessary. | |
| void | addArrayInt (const char *array, const int number, const int value) |
| Adds an int to an array. | |
| void | addArrayString (const char *array, const bool newArray=false) |
| Creates an empty array for strings if necessary. | |
| void | addArrayString (const char *array, const int number, const char *value) |
| Adds a string to an array. | |
| void | addBool (const char *name, const int value) |
| Adds a bool to the hash of bools. | |
| void | addComplex (const char *name, const std::complex< double > value) |
| Adds a complex double to the hash of doubles. | |
| void | addDouble (const char *name, const double value) |
| Adds a double to the hash of doubles. | |
| void | addInt (const char *name, const int value) |
| Adds an int to the hash of ints. | |
| void | addMatrixDouble (const char *array, const bool newMatrix=false) |
| Creates an empty matrix for doubles if necessary. | |
| void | addMatrixDouble (const char *matrix, const int i, const int j, const double value) |
| Adds a double to an matrix. | |
| void | addMatrixInt (const char *matrix, const int i, const int j, const int value) |
| Adds a integer to an matrix. | |
| void | addMatrixInt (const char *array, const bool newMatrix=false) |
| Creates an empty matrix for integer if necessary. | |
| void | addString (const char *name, const char *value) |
| Adds a string to the hash of strings. | |
| void | append (const InOutParameters &inout, bool arrayAppend=true) |
Appends inout. | |
| void | clear () |
| clears the object | |
| bool | getArrayBool (const char *array, const int number) const |
| Returns a bool from an array. | |
| std::complex< double > | getArrayComplex (const char *array, const int number) const |
| Returns a complex double from an array. | |
| double | getArrayDouble (const char *array, const int number) const |
| Returns a double from an array. | |
| int | getArrayInt (const char *array, const int number) const |
| Returns a int from an array. | |
| std::string | getArrayString (const char *array, const int number) const |
| Returns a string from an array. | |
| bool | getBool (const char *name) const |
| Returns a bool from the hash of bools. | |
| bool | getBool (const char *name, const bool value) const |
| Returns a bool from the hash of bools. | |
| std::complex< double > | getComplex (const char *name) const |
| Returns a complex double from the hash of doubles. | |
| double | getDouble (const char *name) const |
| Returns a double from the hash of doubles. | |
| int | getInt (const char *name, const int value=INT_MAX) const |
| Returns an int from the hash of ints. | |
| const std::map< int, bool > & | getMapBool (const char *array) const |
| Returns a reference to the requested map. | |
| const std::map< int, std::complex< double > > & | getMapComplex (const char *array) const |
| Returns a reference to the requested map. | |
| const std::map< int, double > & | getMapDouble (const char *array) const |
| Returns a reference to the requested map. | |
| const std::map< int, int > & | getMapInt (const char *array) const |
| Returns a reference to the requested map. | |
| const std::map< int, std::string > & | getMapString (const char *array) const |
| Returns a reference to the requested map. | |
| double | getMatrixDouble (const char *array, const int i, const int j) const |
| Returns a double from an matrix. | |
| int | getMatrixInt (const char *array, const int i, const int j) const |
| Returns a integer from an matrix. | |
| std::string | getString (const char *name, const char *value=0) const |
| Returns a string from the hash of strings. | |
| InOutParameters () | |
| Constructor. | |
| InOutParameters (const InOutParameters &i) | |
| Copy constructor. | |
| std::ostream & | storeMatlab (std::ostream &os, const char *name, const std::string description="") const |
| Output as matlab function, which gives a object back. | |
| void | storeMatlab (const char *filename, const std::string description="") const |
| Output as matlab function, which gives a object back. | |
| virtual | ~InOutParameters () |
Protected Member Functions | |
| virtual std::ostream & | info (std::ostream &os) const |
| Returns information in an output stream. | |
Private Member Functions | |
| template<class F > | |
| void | add_ (std::map< const char *, F, ltstr > &map, const char *name, const F value) |
Adds a entrance value of type F to field name. | |
| template<class F , class G , class H > | |
| void | addArray_ (std::map< const char *, std::map< F, G, H > *, ltstr > &map, const char *array, const bool newArray=false) |
| template<class F , class G , class H > | |
| void | addArray_ (std::map< const char *, std::map< F, G, H > *, ltstr > &map, const char *array, const F number, const G value) |
| template<class F > | |
| void | clear_ (std::map< const char *, F, ltstr > &map) |
| clears one mapping | |
| template<class F , class G > | |
| void | clear_ (std::map< const char *, std::map< G, F > *, ltstr > &map) |
| template<class F > | |
| F | get_ (const std::map< const char *, F, ltstr > &map, const char *name) const |
| template<class F , class G , class H > | |
| G | getArray_ (const std::map< const char *, std::map< F, G, H > *, ltstr > &map, const char *array, const F number) const |
| template<class F > | |
| const std::map< int, F > & | getMap_ (const std::map< const char *, std::map< int, F > *, ltstr > &map, const char *array) const |
| template<class F > | |
| void | mapArrayOutputMatlab_ (std::ostream &os, const std::map< const char *, std::map< int, F > *, ltstr > &map, const std::string brackets="[]") const |
| Matlab output of one mapping of an array. | |
| template<class F > | |
| void | mapMatrixOutputMatlab_ (std::ostream &os, const std::map< const char *, std::map< MultiIndex< 2 >, F, ltidx > *, ltstr > &map, const std::string brackets="[]") const |
| Matlab output of one mapping of an matrix. | |
| template<class F > | |
| void | mapOutputMatlab_ (std::ostream &os, const std::map< const char *, F, ltstr > &map) const |
| Matlab output of one mapping. | |
Private Attributes | |
| std::map< const char *, bool, ltstr > | bool_ |
| Hash of bools. | |
| std::map< const char *, std::map< int, bool > *, ltstr > | boolArrays_ |
| Hash of arrays of bools. | |
| std::map< const char *, std::complex< double > , ltstr > | complex_ |
| Hash of complex doubles. | |
| std::map< const char *, std::map< int, std::complex < double > > *, ltstr > | complexArrays_ |
| Hash of arrays of complex. | |
| std::map< const char *, double, ltstr > | double_ |
| Hash of doubles. | |
| std::map< const char *, std::map< int, double > *, ltstr > | doubleArrays_ |
| Hash of arrays of doubles. | |
| std::map< const char *, std::map< MultiIndex < 2 >, double, ltidx > *, ltstr > | doubleMatrices_ |
| Hash of matrices of doubles. | |
| std::map< const char *, int, ltstr > | int_ |
| Hash of ints. | |
| std::map< const char *, std::map< int, int > *, ltstr > | intArrays_ |
| Hash of arrays of ints. | |
| std::map< const char *, std::map< MultiIndex < 2 >, int, ltidx > *, ltstr > | intMatrices_ |
| Hash of matrices of integer. | |
| std::map< const char *, std::string, ltstr > | string_ |
| Hash of strings. | |
| std::map< const char *, std::map< int, std::string > *, ltstr > | stringArrays_ |
| Hash of arrays of strings. | |
Holds parameters in hashes.
This class has four hashes to hold integer, double, bool and string parameters and four hashes to hold arrays of integers, doubles, bools and strings. It does therefore store (name, value) pairs in the hashes and (name, number, value) triples in the arrays.
The main usage of this class is by inputParser which reads an input file and enters the parameters into such an object.
If a parameter already exists and is added a second time, the value is simply overwritten. The same is true for the entries in the arrays. If an array is created a second time, nothing happens.
The output operator writes the contents of the whole class to the output stream in the format of the input file. The output is not in the order of the input file.
hpFEM2d.cc, hpFEM3d-EV.cc, inputoutput.cc, linearDG1d.cc, and linearFEM1d.cc.
Definition at line 73 of file inputOutput.hh.
| concepts::InOutParameters::InOutParameters | ( | ) | [inline] |
Constructor.
Definition at line 76 of file inputOutput.hh.
| concepts::InOutParameters::InOutParameters | ( | const InOutParameters & | i | ) |
Copy constructor.
| virtual concepts::InOutParameters::~InOutParameters | ( | ) | [virtual] |
| void concepts::InOutParameters::add_ | ( | std::map< const char *, F, ltstr > & | map, |
| const char * | name, | ||
| const F | value | ||
| ) | [private] |
Adds a entrance value of type F to field name.
| void concepts::InOutParameters::addArray_ | ( | std::map< const char *, std::map< F, G, H > *, ltstr > & | map, |
| const char * | array, | ||
| const bool | newArray = false |
||
| ) | [private] |
| void concepts::InOutParameters::addArray_ | ( | std::map< const char *, std::map< F, G, H > *, ltstr > & | map, |
| const char * | array, | ||
| const F | number, | ||
| const G | value | ||
| ) | [private] |
| void concepts::InOutParameters::addArrayBool | ( | const char * | array, |
| const bool | newArray = false |
||
| ) |
Creates an emtpy array for bools if necessary.
If newArray is true, the array entries will be deleted
| void concepts::InOutParameters::addArrayBool | ( | const char * | array, |
| const int | number, | ||
| const int | value | ||
| ) |
Adds a bool to an array.
| array | Name of the array |
| number | Number of the entry |
| value | Value of the entry |
| void concepts::InOutParameters::addArrayComplex | ( | const char * | array, |
| const int | number, | ||
| const std::complex< double > | value | ||
| ) |
Adds a complex double to an array.
| array | Name of the array |
| number | Number of the entry |
| value | Value of the entry |
| void concepts::InOutParameters::addArrayComplex | ( | const char * | array, |
| const bool | newArray = false |
||
| ) |
Creates an empty array for complex doubles if necessary.
If newArray is true, the array entries will be deleted
| void concepts::InOutParameters::addArrayDouble | ( | const char * | array, |
| const int | number, | ||
| const double | value | ||
| ) |
Adds a double to an array.
| array | Name of the array |
| number | Number of the entry |
| value | Value of the entry |
| void concepts::InOutParameters::addArrayDouble | ( | const char * | array, |
| const bool | newArray = false |
||
| ) |
Creates an empty array for doubles if necessary.
If newArray is true, the array entries will be deleted
| void concepts::InOutParameters::addArrayInt | ( | const char * | array, |
| const bool | newArray = false |
||
| ) |
Creates an empty array for ints if necessary.
If newArray is true, the array entries will be deleted
| void concepts::InOutParameters::addArrayInt | ( | const char * | array, |
| const int | number, | ||
| const int | value | ||
| ) |
Adds an int to an array.
| array | Name of the array |
| number | Number of the entry |
| value | Value of the entry |
| void concepts::InOutParameters::addArrayString | ( | const char * | array, |
| const int | number, | ||
| const char * | value | ||
| ) |
Adds a string to an array.
| array | Name of the array |
| number | Number of the entry |
| value | Value of the entry |
| void concepts::InOutParameters::addArrayString | ( | const char * | array, |
| const bool | newArray = false |
||
| ) |
Creates an empty array for strings if necessary.
If newArray is true, the array entries will be deleted
| void concepts::InOutParameters::addBool | ( | const char * | name, |
| const int | value | ||
| ) |
Adds a bool to the hash of bools.
| void concepts::InOutParameters::addComplex | ( | const char * | name, |
| const std::complex< double > | value | ||
| ) |
Adds a complex double to the hash of doubles.
| void concepts::InOutParameters::addDouble | ( | const char * | name, |
| const double | value | ||
| ) |
Adds a double to the hash of doubles.
| void concepts::InOutParameters::addInt | ( | const char * | name, |
| const int | value | ||
| ) |
Adds an int to the hash of ints.
| void concepts::InOutParameters::addMatrixDouble | ( | const char * | array, |
| const bool | newMatrix = false |
||
| ) |
Creates an empty matrix for doubles if necessary.
If newMatrix is true, the array entries will be deleted
| void concepts::InOutParameters::addMatrixDouble | ( | const char * | matrix, |
| const int | i, | ||
| const int | j, | ||
| const double | value | ||
| ) |
Adds a double to an matrix.
| array | Name of the matrix |
| i | Row index of the entry in the matrix |
| j | Column index of the entry in the matrix |
| value | Value of the entry |
| void concepts::InOutParameters::addMatrixInt | ( | const char * | array, |
| const bool | newMatrix = false |
||
| ) |
Creates an empty matrix for integer if necessary.
If newMatrix is true, the array entries will be deleted
| void concepts::InOutParameters::addMatrixInt | ( | const char * | matrix, |
| const int | i, | ||
| const int | j, | ||
| const int | value | ||
| ) |
Adds a integer to an matrix.
| array | Name of the matrix |
| i | Row index of the entry in the matrix |
| j | Column index of the entry in the matrix |
| value | Value of the entry |
| void concepts::InOutParameters::addString | ( | const char * | name, |
| const char * | value | ||
| ) |
Adds a string to the hash of strings.
| void concepts::InOutParameters::append | ( | const InOutParameters & | inout, |
| bool | arrayAppend = true |
||
| ) |
Appends inout.
| arrayAppend | true: append array values, false: overwrite arrays |
| void concepts::InOutParameters::clear | ( | ) |
clears the object
| void concepts::InOutParameters::clear_ | ( | std::map< const char *, std::map< G, F > *, ltstr > & | map | ) | [private] |
| void concepts::InOutParameters::clear_ | ( | std::map< const char *, F, ltstr > & | map | ) | [private] |
clears one mapping
| F concepts::InOutParameters::get_ | ( | const std::map< const char *, F, ltstr > & | map, |
| const char * | name | ||
| ) | const [private] |
| G concepts::InOutParameters::getArray_ | ( | const std::map< const char *, std::map< F, G, H > *, ltstr > & | map, |
| const char * | array, | ||
| const F | number | ||
| ) | const [private] |
| bool concepts::InOutParameters::getArrayBool | ( | const char * | array, |
| const int | number | ||
| ) | const |
Returns a bool from an array.
| array | Name of the array |
| number | Number of the entry in the array |
| std::complex<double> concepts::InOutParameters::getArrayComplex | ( | const char * | array, |
| const int | number | ||
| ) | const |
Returns a complex double from an array.
| array | Name of the array |
| number | Number of the entry in the array |
| double concepts::InOutParameters::getArrayDouble | ( | const char * | array, |
| const int | number | ||
| ) | const |
Returns a double from an array.
| array | Name of the array |
| number | Number of the entry in the array |
| int concepts::InOutParameters::getArrayInt | ( | const char * | array, |
| const int | number | ||
| ) | const |
Returns a int from an array.
| array | Name of the array |
| number | Number of the entry in the array |
| std::string concepts::InOutParameters::getArrayString | ( | const char * | array, |
| const int | number | ||
| ) | const |
Returns a string from an array.
| array | Name of the array |
| number | Number of the entry in the array |
| bool concepts::InOutParameters::getBool | ( | const char * | name, |
| const bool | value | ||
| ) | const |
Returns a bool from the hash of bools.
If int name does not exist take value.
| bool concepts::InOutParameters::getBool | ( | const char * | name | ) | const |
Returns a bool from the hash of bools.
| std::complex<double> concepts::InOutParameters::getComplex | ( | const char * | name | ) | const |
Returns a complex double from the hash of doubles.
| double concepts::InOutParameters::getDouble | ( | const char * | name | ) | const |
Returns a double from the hash of doubles.
| int concepts::InOutParameters::getInt | ( | const char * | name, |
| const int | value = INT_MAX |
||
| ) | const |
Returns an int from the hash of ints.
If int name does not exist take value.
| const std::map<int, F>& concepts::InOutParameters::getMap_ | ( | const std::map< const char *, std::map< int, F > *, ltstr > & | map, |
| const char * | array | ||
| ) | const [private] |
| const std::map<int, bool>& concepts::InOutParameters::getMapBool | ( | const char * | array | ) | const |
Returns a reference to the requested map.
| MissingParameter |
| const std::map<int, std::complex<double> >& concepts::InOutParameters::getMapComplex | ( | const char * | array | ) | const |
Returns a reference to the requested map.
| MissingParameter |
| const std::map<int, double>& concepts::InOutParameters::getMapDouble | ( | const char * | array | ) | const |
Returns a reference to the requested map.
| MissingParameter |
| const std::map<int, int>& concepts::InOutParameters::getMapInt | ( | const char * | array | ) | const |
Returns a reference to the requested map.
| MissingParameter |
| const std::map<int, std::string>& concepts::InOutParameters::getMapString | ( | const char * | array | ) | const |
Returns a reference to the requested map.
| MissingParameter |
| double concepts::InOutParameters::getMatrixDouble | ( | const char * | array, |
| const int | i, | ||
| const int | j | ||
| ) | const |
Returns a double from an matrix.
| array | Name of the matrix |
| i | Row index of the entry in the matrix |
| j | Column index of the entry in the matrix |
| int concepts::InOutParameters::getMatrixInt | ( | const char * | array, |
| const int | i, | ||
| const int | j | ||
| ) | const |
Returns a integer from an matrix.
| array | Name of the matrix |
| i | Row index of the entry in the matrix |
| j | Column index of the entry in the matrix |
| std::string concepts::InOutParameters::getString | ( | const char * | name, |
| const char * | value = 0 |
||
| ) | const |
Returns a string from the hash of strings.
If string name does not exist take value.
| virtual std::ostream& concepts::InOutParameters::info | ( | std::ostream & | os | ) | const [protected, virtual] |
Returns information in an output stream.
Reimplemented from concepts::OutputOperator.
| void concepts::InOutParameters::mapArrayOutputMatlab_ | ( | std::ostream & | os, |
| const std::map< const char *, std::map< int, F > *, ltstr > & | map, | ||
| const std::string | brackets = "[]" |
||
| ) | const [private] |
Matlab output of one mapping of an array.
| void concepts::InOutParameters::mapMatrixOutputMatlab_ | ( | std::ostream & | os, |
| const std::map< const char *, std::map< MultiIndex< 2 >, F, ltidx > *, ltstr > & | map, | ||
| const std::string | brackets = "[]" |
||
| ) | const [private] |
Matlab output of one mapping of an matrix.
| void concepts::InOutParameters::mapOutputMatlab_ | ( | std::ostream & | os, |
| const std::map< const char *, F, ltstr > & | map | ||
| ) | const [private] |
Matlab output of one mapping.
| void concepts::InOutParameters::storeMatlab | ( | const char * | filename, |
| const std::string | description = "" |
||
| ) | const |
Output as matlab function, which gives a object back.
| filename | name of the output file, ending .m is added |
| std::ostream& concepts::InOutParameters::storeMatlab | ( | std::ostream & | os, |
| const char * | name, | ||
| const std::string | description = "" |
||
| ) | const |
Output as matlab function, which gives a object back.
| os | output stream |
| name | name of the function |
std::map<const char*, bool, ltstr> concepts::InOutParameters::bool_ [private] |
Hash of bools.
Definition at line 326 of file inputOutput.hh.
std::map<const char*, std::map<int, bool>*, ltstr> concepts::InOutParameters::boolArrays_ [private] |
Hash of arrays of bools.
Definition at line 338 of file inputOutput.hh.
std::map<const char*, std::complex<double>, ltstr> concepts::InOutParameters::complex_ [private] |
Hash of complex doubles.
Definition at line 320 of file inputOutput.hh.
std::map<const char*, std::map<int, std::complex<double> >*, ltstr> concepts::InOutParameters::complexArrays_ [private] |
Hash of arrays of complex.
Definition at line 332 of file inputOutput.hh.
std::map<const char*, double, ltstr> concepts::InOutParameters::double_ [private] |
Hash of doubles.
Definition at line 318 of file inputOutput.hh.
std::map<const char*, std::map<int, double>*, ltstr> concepts::InOutParameters::doubleArrays_ [private] |
Hash of arrays of doubles.
Definition at line 329 of file inputOutput.hh.
std::map<const char*, std::map<MultiIndex<2>, double, ltidx>*, ltstr> concepts::InOutParameters::doubleMatrices_ [private] |
Hash of matrices of doubles.
Definition at line 342 of file inputOutput.hh.
std::map<const char*, int, ltstr> concepts::InOutParameters::int_ [private] |
Hash of ints.
Definition at line 324 of file inputOutput.hh.
std::map<const char*, std::map<int, int>*, ltstr> concepts::InOutParameters::intArrays_ [private] |
Hash of arrays of ints.
Definition at line 336 of file inputOutput.hh.
std::map<const char*, std::map<MultiIndex<2>, int, ltidx>*, ltstr> concepts::InOutParameters::intMatrices_ [private] |
Hash of matrices of integer.
Definition at line 345 of file inputOutput.hh.
std::map<const char*, std::string, ltstr> concepts::InOutParameters::string_ [private] |
Hash of strings.
Definition at line 322 of file inputOutput.hh.
std::map<const char*, std::map<int, std::string>*, ltstr> concepts::InOutParameters::stringArrays_ [private] |
Hash of arrays of strings.
Definition at line 334 of file inputOutput.hh.