Class documentation of Concepts

Loading...
Searching...
No Matches
concepts::InOutParameters Class Reference

#include <inputOutput.hh>

Inheritance diagram for concepts::InOutParameters:
concepts::OutputOperator

Public Member Functions

 InOutParameters ()
 Constructor.
 
 InOutParameters (const InOutParameters &i)
 Copy constructor.
 
void append (const InOutParameters &inout, bool arrayAppend=true)
 
void addDouble (const char *name, const double value)
 Adds a double to the hash of doubles.
 
void addComplex (const char *name, const std::complex< double > value)
 Adds a complex double to the hash of doubles.
 
void addString (const char *name, const char *value)
 Adds a string to the hash of strings.
 
void addInt (const char *name, const int value)
 Adds an int to the hash of ints.
 
void addBool (const char *name, const int value)
 Adds a bool to the hash of bools.
 
double getDouble (const char *name) const
 Returns a double from the hash of doubles.
 
double getDouble (const char *name, const double value) const
 
std::complex< doublegetComplex (const char *name) const
 Returns a complex double from the hash of doubles.
 
std::string getString (const char *name, const char *value=0) const
 
int getInt (const char *name, const int value=INT_MAX) const
 
bool getBool (const char *name) const
 Returns a bool from the hash of bools.
 
bool getBool (const char *name, const bool value) const
 
void addArrayDouble (const char *array, const bool newArray=false)
 
void addArrayComplex (const char *array, const bool newArray=false)
 
void addArrayString (const char *array, const bool newArray=false)
 
void addArrayInt (const char *array, const bool newArray=false)
 
void addArrayBool (const char *array, const bool newArray=false)
 
void addArrayDouble (const char *array, const int number, const double value)
 
void addArrayComplex (const char *array, const int number, const std::complex< double > value)
 
void addArrayString (const char *array, const int number, const char *value)
 
void addArrayInt (const char *array, const int number, const int value)
 
void addArrayBool (const char *array, const int number, const int value)
 
double getArrayDouble (const char *array, const int number) const
 
std::complex< doublegetArrayComplex (const char *array, const int number) const
 
std::string getArrayString (const char *array, const int number) const
 
int getArrayInt (const char *array, const int number) const
 
bool getArrayBool (const char *array, const int number) const
 
const std::map< int, double > & getMapDouble (const char *array) const
 
const std::map< int, std::complex< double > > & getMapComplex (const char *array) const
 
const std::map< int, std::string > & getMapString (const char *array) const
 
const std::map< int, int > & getMapInt (const char *array) const
 
const std::map< int, bool > & getMapBool (const char *array) const
 
void addMatrixDouble (const char *array, const bool newMatrix=false)
 
void addMatrixInt (const char *array, const bool newMatrix=false)
 
void addMatrixDouble (const char *matrix, const int i, const int j, const double value)
 
void addMatrixInt (const char *matrix, const int i, const int j, const int value)
 
double getMatrixDouble (const char *array, const int i, const int j) const
 
int getMatrixInt (const char *array, const int i, const int j) const
 
void clear ()
 clears the object
 
void storeMatlab (const char *filename, const std::string description="") const
 
std::ostream & storeMatlab (std::ostream &os, const char *name, const std::string description="") const
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.
 

Detailed Description

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.

See also
inputParser
Author
Philipp Frauenfelder, 2000
Adrien Semin, 2016
Examples
cig_load_input_data.cc, elasticity2D_tutorial.cc, hpFEM2d.cc, hpFEM3d-EV.cc, inputoutput.cc, linearDG1d.cc, and linearFEM1d.cc.

Definition at line 75 of file inputOutput.hh.

Constructor & Destructor Documentation

◆ InOutParameters()

concepts::InOutParameters::InOutParameters ( )
inline

Constructor.

Definition at line 78 of file inputOutput.hh.

Member Function Documentation

◆ addArrayBool() [1/2]

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

◆ addArrayBool() [2/2]

void concepts::InOutParameters::addArrayBool ( const char array,
const int  number,
const int  value 
)

Adds a bool to an array.

Parameters
arrayName of the array
numberNumber of the entry
valueValue of the entry
Precondition
The array must exist

◆ addArrayComplex() [1/2]

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

◆ addArrayComplex() [2/2]

void concepts::InOutParameters::addArrayComplex ( const char array,
const int  number,
const std::complex< double value 
)

Adds a complex double to an array.

Parameters
arrayName of the array
numberNumber of the entry
valueValue of the entry
Precondition
The array must exist

◆ addArrayDouble() [1/2]

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

Examples
hpFEM2d.cc, hpFEM3d-EV.cc, inputoutput.cc, linearDG1d.cc, and linearFEM1d.cc.

◆ addArrayDouble() [2/2]

void concepts::InOutParameters::addArrayDouble ( const char array,
const int  number,
const double  value 
)

Adds a double to an array.

Parameters
arrayName of the array
numberNumber of the entry
valueValue of the entry
Precondition
The array must exist

◆ addArrayInt() [1/2]

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

Examples
hpFEM2d.cc, and hpFEM3d-EV.cc.

◆ addArrayInt() [2/2]

void concepts::InOutParameters::addArrayInt ( const char array,
const int  number,
const int  value 
)

Adds an int to an array.

Parameters
arrayName of the array
numberNumber of the entry
valueValue of the entry
Precondition
The array must exist

◆ addArrayString() [1/2]

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

◆ addArrayString() [2/2]

void concepts::InOutParameters::addArrayString ( const char array,
const int  number,
const char value 
)

Adds a string to an array.

Parameters
arrayName of the array
numberNumber of the entry
valueValue of the entry
Precondition
The array must exist

◆ addMatrixDouble() [1/2]

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

◆ addMatrixDouble() [2/2]

void concepts::InOutParameters::addMatrixDouble ( const char matrix,
const int  i,
const int  j,
const double  value 
)

Adds a double to an matrix.

Parameters
arrayName of the matrix
iRow index of the entry in the matrix
jColumn index of the entry in the matrix
valueValue of the entry
Precondition
The matrix must exist

◆ addMatrixInt() [1/2]

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

◆ addMatrixInt() [2/2]

void concepts::InOutParameters::addMatrixInt ( const char matrix,
const int  i,
const int  j,
const int  value 
)

Adds a integer to an matrix.

Parameters
arrayName of the matrix
iRow index of the entry in the matrix
jColumn index of the entry in the matrix
valueValue of the entry
Precondition
The matrix must exist

◆ append()

void concepts::InOutParameters::append ( const InOutParameters inout,
bool  arrayAppend = true 
)

Appends inout

Parameters
arrayAppendtrue: append array values, false: overwrite arrays

◆ getArrayBool()

bool concepts::InOutParameters::getArrayBool ( const char array,
const int  number 
) const

Returns a bool from an array.

Parameters
arrayName of the array
numberNumber of the entry in the array

◆ getArrayComplex()

std::complex< double > concepts::InOutParameters::getArrayComplex ( const char array,
const int  number 
) const

Returns a complex double from an array.

Parameters
arrayName of the array
numberNumber of the entry in the array

◆ getArrayDouble()

double concepts::InOutParameters::getArrayDouble ( const char array,
const int  number 
) const

Returns a double from an array.

Parameters
arrayName of the array
numberNumber of the entry in the array
Examples
hpFEM2d.cc, and hpFEM3d-EV.cc.

◆ getArrayInt()

int concepts::InOutParameters::getArrayInt ( const char array,
const int  number 
) const

Returns a int from an array.

Parameters
arrayName of the array
numberNumber of the entry in the array
Examples
hpFEM2d.cc.

◆ getArrayString()

std::string concepts::InOutParameters::getArrayString ( const char array,
const int  number 
) const

Returns a string from an array.

Parameters
arrayName of the array
numberNumber of the entry in the array
Examples
hpFEM2d.cc.

◆ getBool()

bool concepts::InOutParameters::getBool ( const char name,
const bool  value 
) const

Returns a bool from the hash of bools

If name does not exist take value.

◆ getDouble()

double concepts::InOutParameters::getDouble ( const char name,
const double  value 
) const

Returns a double from the hash of doubles

If name does not exist take value.

◆ getInt()

int concepts::InOutParameters::getInt ( const char name,
const int  value = INT_MAX 
) const

Returns an int from the hash of ints

If name does not exist take value.

Examples
cig_load_input_data.cc, elasticity2D_tutorial.cc, hpFEM2d.cc, hpFEM3d-EV.cc, inputoutput.cc, linearDG1d.cc, and linearFEM1d.cc.

◆ getMapBool()

const std::map< int, bool > & concepts::InOutParameters::getMapBool ( const char array) const

Returns a reference to the requested map.

Exceptions
MissingParameter

◆ getMapComplex()

const std::map< int, std::complex< double > > & concepts::InOutParameters::getMapComplex ( const char array) const

Returns a reference to the requested map.

Exceptions
MissingParameter

◆ getMapDouble()

const std::map< int, double > & concepts::InOutParameters::getMapDouble ( const char array) const

Returns a reference to the requested map.

Exceptions
MissingParameter

◆ getMapInt()

const std::map< int, int > & concepts::InOutParameters::getMapInt ( const char array) const

Returns a reference to the requested map.

Exceptions
MissingParameter

◆ getMapString()

const std::map< int, std::string > & concepts::InOutParameters::getMapString ( const char array) const

Returns a reference to the requested map.

Exceptions
MissingParameter

◆ getMatrixDouble()

double concepts::InOutParameters::getMatrixDouble ( const char array,
const int  i,
const int  j 
) const

Returns a double from an matrix.

Parameters
arrayName of the matrix
iRow index of the entry in the matrix
jColumn index of the entry in the matrix

◆ getMatrixInt()

int concepts::InOutParameters::getMatrixInt ( const char array,
const int  i,
const int  j 
) const

Returns a integer from an matrix.

Parameters
arrayName of the matrix
iRow index of the entry in the matrix
jColumn index of the entry in the matrix

◆ getString()

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.

Examples
cig_load_input_data.cc, elasticity2D_tutorial.cc, hpFEM2d.cc, hpFEM3d-EV.cc, and inputoutput.cc.

◆ info()

virtual std::ostream & concepts::InOutParameters::info ( std::ostream &  os) const
protectedvirtual

Returns information in an output stream.

Reimplemented from concepts::OutputOperator.

◆ storeMatlab() [1/2]

void concepts::InOutParameters::storeMatlab ( const char filename,
const std::string  description = "" 
) const

Output as matlab function, which gives a object back

Parameters
filenamename of the output file, ending .m is added

◆ storeMatlab() [2/2]

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

Parameters
osoutput stream
namename of the function

The documentation for this class was generated from the following file: