FEI Package Browser (Single Doxygen Collection)
Version of the Day
|
#include <fei_ParameterSet.hpp>
Classes | |
class | const_iterator |
Public Member Functions | |
ParameterSet () | |
virtual | ~ParameterSet () |
void | add (const Param ¶m, bool maintain_unique_keys=true) |
const Param * | get (const char *name) const |
int | size () const |
const_iterator | begin () const |
const_iterator | end () const |
int | getIntParamValue (const char *name, int ¶mValue) const |
int | getDoubleParamValue (const char *name, double ¶mValue) const |
int | getStringParamValue (const char *name, std::string ¶mValue) const |
int | getBoolParamValue (const char *name, bool ¶mValue) const |
int | getVoidParamValue (const char *name, const void *¶mValue) const |
Private Member Functions | |
int | findOffset (const fei::Param *param) const |
int | findOffset (const char *name) const |
Private Attributes | |
std::vector< const Param * > * | params_ |
Container that functions as a database of named parameters,
intended to store control parameters such as solver tolerances and other named options.
Individual parameters are instances of fei::Param. This is a simplistic way of simulating a std::map that can store values of varying type.
Example creation and initialization:
fei::ParameterSet paramset;
paramset.add(fei::Param("tolerance", 1.e-8)); paramset.add(fei::Param("FEI_OUTPUT_PATH", "/home/me/tmp")); paramset.add(fei::Param("BLOCK_MATRIX", true));
Note that various fei interfaces used to accept parameters in the form of a length and a list of pointers-to-char-pointer (i.e., const char*const* paramStrings). A couple of utility functions exist for converting to and from fei::ParameterSet. See the following functions which are declared in fei_utils.hpp:
fei::utils::wrap_strings()
fei::utils::parse_strings()
fei::utils::convert_ParameterSet_to_strings()
fei::utils::strings_to_char_ptrs()
Definition at line 46 of file fei_ParameterSet.hpp.
fei::ParameterSet::ParameterSet | ( | ) |
|
virtual |
Destructor
Definition at line 18 of file fei_ParameterSet.cpp.
|
inline |
Add a new named parameter object to this parameter-set. If a parameter with the same name is already present, it is replaced by this new one if the 'maintain_unique_keys' argument is true. Otherwise, the duplicate parameter is simply appended to the internal list of parameters.
param | Named parameter to be added. A copy of this parameter object is stored internally. The caller is free to destroy the input argument as soon as this method returns. |
maintain_unique_keys | Optional argument, defaults to true. If this argument is false, then multiple parameters with the same name may be stored. |
Definition at line 235 of file fei_ParameterSet.hpp.
Referenced by Trilinos_Helpers::copy_parameterlist(), fei::create_fei_Factory(), test_MatrixGraph::create_MatrixGraph(), test_VectorSpace::create_VectorSpace(), main(), fei::utils::parse_strings(), test_Utils::serialtest3(), test_VectorSpace::test2(), test_VectorSpace::test3(), test_Matrix_unit4(), and snl_fei_tester::testInitialization().
|
inline |
Query for pointer to named parameter. The internal list of named parameters is searched using a linear search. If multiple parameters have the same name (i.e., the add() method has been used with the optional 'maintain_unique_keys' argument specified as false), then the parameter returned is an arbitrary one of the duplicates. In other words, parameters are not stored in any particular order.
Definition at line 260 of file fei_ParameterSet.hpp.
Referenced by fei::Factory::parameters(), snl_fei::Factory::parameters(), fei::Matrix_core::parameters(), test_Utils::serialtest3(), fei::MatrixGraph_Impl2::setParameters(), and fei::VectorSpace::setParameters().
|
inline |
Query for the number of named parameters currently stored.
Definition at line 254 of file fei_ParameterSet.hpp.
Referenced by fei::ParameterSet::const_iterator::operator++(), and test_Utils::serialtest3().
|
inline |
Return an iterator pointing to the beginning of the list of parameters
Definition at line 223 of file fei_ParameterSet.hpp.
Referenced by fei::utils::convert_ParameterSet_to_strings(), Trilinos_Helpers::copy_parameterset(), execute_fullsystem_tests(), and test_Utils::serialtest3().
|
inline |
Return an iterator pointing just past the end of the list of parameters
Definition at line 229 of file fei_ParameterSet.hpp.
Referenced by fei::utils::convert_ParameterSet_to_strings(), Trilinos_Helpers::copy_parameterset(), execute_fullsystem_tests(), and test_Utils::serialtest3().
int fei::ParameterSet::getIntParamValue | ( | const char * | name, |
int & | paramValue | ||
) | const |
Check whether a fei::Param with 'name' is present and has type fei::Param::INT. If so, set paramValue and return 0. Otherwise return -1.
Definition at line 28 of file fei_ParameterSet.cpp.
References fei::Param::getIntValue(), fei::Param::getType(), and fei::Param::INT.
Referenced by beam_main(), beam_oldfei_main(), main(), snl_fei::Factory::parameters(), Factory_Aztec::parameters(), poisson3_main(), poisson_main(), test_Utils::serialtest3(), and test_FEI::test1().
int fei::ParameterSet::getDoubleParamValue | ( | const char * | name, |
double & | paramValue | ||
) | const |
Check whether a fei::Param with 'name' is present and has type fei::Param::INT or fei::Param::DOUBLE. If so, set paramValue and return 0. Otherwise return -1.
Definition at line 40 of file fei_ParameterSet.cpp.
References fei::Param::DOUBLE, fei::Param::getDoubleValue(), fei::Param::getIntValue(), fei::Param::getType(), and fei::Param::INT.
Referenced by test_Utils::serialtest3().
int fei::ParameterSet::getStringParamValue | ( | const char * | name, |
std::string & | paramValue | ||
) | const |
Check whether a fei::Param with 'name' is present and has type fei::Param::STRING. If so, set paramValue and return 0. Otherwise return -1.
Definition at line 57 of file fei_ParameterSet.cpp.
References fei::Param::getStringValue(), fei::Param::getType(), and fei::Param::STRING.
Referenced by beam_main(), beam_oldfei_main(), feiDriver_main(), main(), poisson3_main(), poisson_main(), test_Utils::serialtest3(), and test_FEI::test1().
int fei::ParameterSet::getBoolParamValue | ( | const char * | name, |
bool & | paramValue | ||
) | const |
Check whether a fei::Param with 'name' is present and has type fei::Param::BOOL. If so, set paramValue and return 0. Otherwise return -1.
Definition at line 69 of file fei_ParameterSet.cpp.
References fei::Param::BOOL, fei::Param::getBoolValue(), and fei::Param::getType().
Referenced by Factory_Aztec::parameters().
int fei::ParameterSet::getVoidParamValue | ( | const char * | name, |
const void *& | paramValue | ||
) | const |
Check whether a fei::Param with 'name' is present and has type fei::Param::VOID. If so, set paramValue and return 0. Otherwise return -1.
Definition at line 81 of file fei_ParameterSet.cpp.
References fei::Param::getType(), fei::Param::getVoidValue(), and fei::Param::VOID.
|
inlineprivate |
Definition at line 215 of file fei_ParameterSet.hpp.
References fei::Param::getName().
|
inlineprivate |
Definition at line 196 of file fei_ParameterSet.hpp.
References fei::Param::getName(), and params_.
|
private |
Definition at line 190 of file fei_ParameterSet.hpp.
Referenced by findOffset(), and ParameterSet().