dune-fem  2.4.1-rc
Classes | Public Member Functions | Protected Attributes | List of all members
Dune::Fem::ParameterContainer Class Reference

#include </local/tomalk/somewhere/tmp/dune-fem/dune/fem/io/parameter/container.hh>

Inheritance diagram for Dune::Fem::ParameterContainer:
Inheritance graph

Classes

struct  DGFBlock
 

Public Member Functions

 operator ParameterReader () const
 cast into ParameterReader More...
 
int setVerboseRank (int verboseRank)
 set the rank for verbose output More...
 
void append (int &argc, char **argv)
 add parameters from the command line More...
 
void append (const std::string &filename)
 add parameters from a file More...
 
void append (const std::string &key, const std::string &value)
 add a single parameter to the container More...
 
void appendDGF (const std::string &filename)
 add parameters from a DGF file More...
 
void clear ()
 clear all parameters More...
 
bool verbose () const
 obtain the cached value for fem.verbose More...
 
std::string commonInputPath () const
 
std::string commonOutputPath () const
 
void write (std::ostream &out, bool writeAll=true) const
 write the parameter database to a stream More...
 
bool exists (const std::string &key) const
 check, whether a parameter is defined More...
 
void get (const std::string &key, T &value) const
 get mandatory parameter More...
 
void get (const std::string &key, const T &defaultValue, T &value) const
 get optional parameter More...
 
void get (const std::string &key, const char *defaultValue, std::string &value) const
 get optional parameter (special case for string) More...
 
void getValid (const std::string &key, const Validator &validator, T &value) const
 get mandatory parameter More...
 
void getValid (const std::string &key, const T &defaultValue, const Validator &validator, T &value) const
 get optional parameter More...
 
getValue (const std::string &key) const
 get mandatory parameter More...
 
getValue (const std::string &key, const T &defaultValue) const
 get optional parameter More...
 
getValidValue (const std::string &key, const Validator &validator) const
 get optional parameter More...
 
getValidValue (const std::string &key, const T &defaultValue, const Validator &validator) const
 get optional parameter More...
 
int getEnum (const std::string &key, const std::string(&values)[n]) const
 
int getEnum (const std::string &key, const std::string(&values)[n], int defaultValue) const
 

Protected Attributes

ParameterContainerData parameter_
 

Member Function Documentation

void Dune::Fem::ParameterContainer::append ( int &  argc,
char **  argv 
)
inline

add parameters from the command line

This mehtod adds all parameters (strings containing a colon) in the command line to the container. The parameters are then removed from the command line.

Parameters
[in]argcnumber of arguments (as given to main)
[in]argvvector of arguments (as given to main)

Referenced by Dune::Fem::Parameter::append().

void Dune::Fem::ParameterContainer::append ( const std::string &  filename)
inline

add parameters from a file

Parameters
[in]filenamename of the file containing the parameters
void Dune::Fem::ParameterContainer::append ( const std::string &  key,
const std::string &  value 
)
inline

add a single parameter to the container

Parameters
[in]keykey of the parameter to add
[in]valuevalue of the parameter to add
void Dune::Fem::ParameterContainer::appendDGF ( const std::string &  filename)
inline

add parameters from a DGF file

Parameters can also be read from a DGF file containing a 'FemParameter' block.

Parameters
[in]filenamename of the DGF file containing the parameters

References Dune::Fem::ParameterContainer::DGFBlock::advance(), Dune::Fem::ParameterContainer::DGFBlock::getLine(), and Dune::Fem::ParameterContainerData::verbose().

Referenced by Dune::Fem::Parameter::appendDGF().

void Dune::Fem::ParameterContainer::clear ( )
inline

clear all parameters

Referenced by Dune::Fem::PersistenceManager::restoreValue().

std::string Dune::Fem::ParameterContainer::commonInputPath ( ) const
inline
std::string Dune::Fem::ParameterContainer::commonOutputPath ( ) const
inline
bool Dune::Fem::BasicParameterReader< ParameterContainerData >::exists ( const std::string &  key) const
inlineinherited

check, whether a parameter is defined

Parameters
[in]keyname of the parameter to check
Returns
true, if the parameter is found, false otherwise
void Dune::Fem::BasicParameterReader< ParameterContainerData >::get ( const std::string &  key,
T &  value 
) const
inlineinherited

get mandatory parameter

Note
This method throws an exception, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[out]valuevalue of the parameter
void Dune::Fem::BasicParameterReader< ParameterContainerData >::get ( const std::string &  key,
const T &  defaultValue,
T &  value 
) const
inlineinherited

get optional parameter

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]defaultValuedefault value for this parameter
[out]valuevalue of the parameter
void Dune::Fem::BasicParameterReader< ParameterContainerData >::get ( const std::string &  key,
const char *  defaultValue,
std::string &  value 
) const
inlineinherited

get optional parameter (special case for string)

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]defaultValuedefault value for this parameter
[out]valuevalue of the parameter
int Dune::Fem::BasicParameterReader< ParameterContainerData >::getEnum ( const std::string &  key,
const std::string(&)  values[n] 
) const
inlineinherited
int Dune::Fem::BasicParameterReader< ParameterContainerData >::getEnum ( const std::string &  key,
const std::string(&)  values[n],
int  defaultValue 
) const
inlineinherited
void Dune::Fem::BasicParameterReader< ParameterContainerData >::getValid ( const std::string &  key,
const Validator &  validator,
T &  value 
) const
inlineinherited

get mandatory parameter

Note
This method throws an exception, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]validatorvalidator for the parameter value
[out]valuevalue of the parameter
void Dune::Fem::BasicParameterReader< ParameterContainerData >::getValid ( const std::string &  key,
const T &  defaultValue,
const Validator &  validator,
T &  value 
) const
inlineinherited

get optional parameter

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]defaultValuedefault value for this parameter
[in]validatorvalidator for the parameter value
[out]valuevalue of the parameter
T Dune::Fem::BasicParameterReader< ParameterContainerData >::getValidValue ( const std::string &  key,
const Validator &  validator 
) const
inlineinherited

get optional parameter

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]validatorvalidator for the parameter value
Returns
value of the parameter
T Dune::Fem::BasicParameterReader< ParameterContainerData >::getValidValue ( const std::string &  key,
const T &  defaultValue,
const Validator &  validator 
) const
inlineinherited

get optional parameter

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]defaultValuedefault value for this parameter
[in]validatorvalidator for the parameter value
Returns
value of the parameter
T Dune::Fem::BasicParameterReader< ParameterContainerData >::getValue ( const std::string &  key) const
inlineinherited

get mandatory parameter

Note
This method throws an exception, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
Returns
value of the parameter
T Dune::Fem::BasicParameterReader< ParameterContainerData >::getValue ( const std::string &  key,
const T &  defaultValue 
) const
inlineinherited

get optional parameter

Note
This method returns a default value, if the parameter cannot be found.
Parameters
[in]keyname of the parameter to get
[in]defaultValuedefault value for this parameter
Returns
value of the parameter
Dune::Fem::ParameterContainer::operator ParameterReader ( ) const
inline

cast into ParameterReader

References Dune::Fem::ParameterContainerData::verboseRank.

int Dune::Fem::ParameterContainer::setVerboseRank ( int  verboseRank)
inline

set the rank for verbose output

This mehtod allows to set the fem verbosity within the code.

Parameters
[in]verboseRankthe rank of the processor to have * verbose output (-1: no verbose output)
[out]thevalue used before the change

References Dune::Fem::ParameterContainerData::Value::value, Dune::Fem::ParameterContainerData::verbose(), and Dune::Fem::ParameterContainerData::verboseRank.

Referenced by Dune::Fem::Parameter::setVerboseRank().

bool Dune::Fem::ParameterContainer::verbose ( ) const
inline

obtain the cached value for fem.verbose

Referenced by Dune::Fem::Parameter::verbose().

void Dune::Fem::ParameterContainer::write ( std::ostream &  out,
bool  writeAll = true 
) const
inline

write the parameter database to a stream

This method writes paramters to the given stream. If the second parameter is true all parameters are written; otherwise only used parameters which do not coincide with the default value are written.

Note
This method is not safe for parallel jobs. Parameters are written on all ranks.
Parameters
[in]outstream for the parameters.
[in]writeAlldefault is true

References Dune::Fem::ParameterContainerData::Value::defaultValue, Dune::Fem::ParameterContainerData::Value::fileName, Dune::Fem::ParameterContainerData::Value::hasDefault, Dune::Fem::ParameterContainerData::Value::used, and Dune::Fem::ParameterContainerData::Value::value.

Referenced by Dune::Fem::Parameter::write().

Member Data Documentation


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