$extrastylesheet
#include <parameters.h>
Classes | |
| class | Parameter |
| class | Value |
Public Types | |
| typedef std::map< std::string, Value * >::iterator | iterator |
| typedef std::map< std::string, Value * >::const_iterator | const_iterator |
Public Member Functions | |
| Parameters () | |
| Parameters (const Parameters &) | |
| virtual | ~Parameters () |
| virtual Parameters & | operator= (const Parameters &source) |
| virtual Parameters & | operator+= (const Parameters &source) |
| template<typename T > | |
| bool | have_parameter (const std::string &) const |
| template<typename T > | |
| const T & | get (const std::string &) const |
| template<typename T > | |
| void | insert (const std::string &) |
| template<typename T > | |
| T & | set (const std::string &) |
| virtual void | set_attributes (const std::string &, bool) |
| void | remove (const std::string &) |
| std::size_t | n_parameters () const |
| template<typename T > | |
| unsigned int | n_parameters () const |
| virtual void | clear () |
| void | print (std::ostream &os=libMesh::out) const |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
Protected Attributes | |
| std::map< std::string, Value * > | _values |
This class provides the ability to map between arbitrary, user-defined strings and several data types. This can be used to provide arbitrary user-specified options.
Definition at line 63 of file parameters.h.
| typedef std::map<std::string, Value*>::const_iterator libMesh::Parameters::const_iterator |
Constant parameter map iterator.
Definition at line 251 of file parameters.h.
| typedef std::map<std::string, Value*>::iterator libMesh::Parameters::iterator |
Parameter map iterator.
Definition at line 246 of file parameters.h.
| libMesh::Parameters::Parameters | ( | ) | [inline] |
| libMesh::Parameters::Parameters | ( | const Parameters & | p | ) | [inline] |
| libMesh::Parameters::~Parameters | ( | ) | [inline, virtual] |
Destructor. Clears any allocated memory.
Definition at line 372 of file parameters.h.
References clear().
{
this->clear ();
}
| Parameters::iterator libMesh::Parameters::begin | ( | ) | [inline] |
Iterator pointing to the beginning of the set of parameters.
Definition at line 517 of file parameters.h.
References _values.
{
return _values.begin();
}
| Parameters::const_iterator libMesh::Parameters::begin | ( | ) | const [inline] |
Iterator pointing to the beginning of the set of parameters.
Definition at line 523 of file parameters.h.
References _values.
{
return _values.begin();
}
| void libMesh::Parameters::clear | ( | ) | [inline, virtual] |
Clears internal data structures & frees any allocated memory.
Definition at line 325 of file parameters.h.
References _values.
Referenced by libMesh::EquationSystems::clear(), operator=(), and ~Parameters().
{ // before its first use (for some compilers)
while (!_values.empty())
{
Parameters::iterator it = _values.begin();
delete it->second;
it->second = NULL;
_values.erase(it);
}
}
| Parameters::iterator libMesh::Parameters::end | ( | ) | [inline] |
Iterator pointing to the end of the set of parameters
Definition at line 529 of file parameters.h.
References _values.
{
return _values.end();
}
| Parameters::const_iterator libMesh::Parameters::end | ( | ) | const [inline] |
Iterator pointing to the end of the set of parameters
Definition at line 535 of file parameters.h.
References _values.
{
return _values.end();
}
| const T & libMesh::Parameters::get | ( | const std::string & | name | ) | const [inline] |
Definition at line 434 of file parameters.h.
References _values, libMesh::demangle(), libMesh::libmesh_assert(), and libMesh::Quality::name().
Referenced by libMesh::FrequencySystem::clear_all(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::FEComputeData::init(), libMesh::FrequencySystem::init_data(), libMesh::FrequencySystem::n_frequencies(), libMesh::FrequencySystem::set_current_frequency(), libMesh::NonlinearImplicitSystem::set_solver_parameters(), libMesh::CondensedEigenSystem::solve(), libMesh::EigenSystem::solve(), libMesh::LinearImplicitSystem::solve(), and libMesh::FrequencySystem::solve().
{
if (!this->have_parameter<T>(name))
{
std::ostringstream oss;
oss << "ERROR: no";
#ifdef LIBMESH_HAVE_RTTI
oss << ' ' << demangle(typeid(T).name());
#endif
oss << " parameter named \""
<< name << "\":\n"
<< *this;
libmesh_error_msg(oss.str());
}
Parameters::const_iterator it = _values.find(name);
libmesh_assert(it != _values.end());
libmesh_assert(it->second);
return cast_ptr<Parameter<T>*>(it->second)->get();
}
| bool libMesh::Parameters::have_parameter | ( | const std::string & | name | ) | const [inline] |
true if a parameter of type T with a specified name exists, false otherwise.If RTTI has been disabled then we return true if a parameter of specified name exists regardless of its type.
Definition at line 415 of file parameters.h.
References _values, and libMesh::cast_ptr().
Referenced by libMesh::FrequencySystem::clear_all(), libMesh::FEComputeData::init(), libMesh::FrequencySystem::init_data(), libMesh::CondensedEigenSystem::solve(), and libMesh::EigenSystem::solve().
{
Parameters::const_iterator it = _values.find(name);
if (it != _values.end())
#ifdef LIBMESH_HAVE_RTTI
if (dynamic_cast<const Parameter<T>*>(it->second) != NULL)
#else // LIBMESH_HAVE_RTTI
if (cast_ptr<const Parameter<T>*>(it->second) != NULL)
#endif // LIBMESH_HAVE_RTTI
return true;
return false;
}
| void libMesh::Parameters::insert | ( | const std::string & | name | ) | [inline] |
Inserts a new Parameter into the object but does not return a writable reference. The value of the newly inserted parameter may not be valid.
Definition at line 461 of file parameters.h.
References _values, libMesh::Quality::name(), and set_attributes().
{
if (!this->have_parameter<T>(name))
_values[name] = new Parameter<T>;
set_attributes(name, true);
}
| unsigned int libMesh::Parameters::n_parameters | ( | ) | const [inline] |
Definition at line 143 of file parameters.h.
References _values.
{ return _values.size(); }
| unsigned int libMesh::Parameters::n_parameters | ( | ) | const |
| Parameters & libMesh::Parameters::operator+= | ( | const Parameters & | source | ) | [inline, virtual] |
Addition/Assignment operator. Inserts copies of all parameters from source. Any parameters of the same name already in this are replaced.
Definition at line 350 of file parameters.h.
References _values.
{
for (Parameters::const_iterator it = source._values.begin();
it != source._values.end(); ++it)
{
if (_values.find(it->first) != _values.end())
delete _values[it->first];
_values[it->first] = it->second->clone();
}
return *this;
}
| Parameters & libMesh::Parameters::operator= | ( | const Parameters & | source | ) | [inline, virtual] |
Assignment operator. Removes all parameters in this and inserts copies of all parameters from source
Definition at line 341 of file parameters.h.
References clear().
{
this->clear();
*this += source;
return *this;
}
| void libMesh::Parameters::print | ( | std::ostream & | os = libMesh::out | ) | const [inline] |
Prints the contents, by default to libMesh::out.
Definition at line 380 of file parameters.h.
References _values.
Referenced by libMesh::operator<<().
{
Parameters::const_iterator it = _values.begin();
os << "Name\t Type\t Value\n"
<< "---------------------\n";
while (it != _values.end())
{
os << " " << it->first
#ifdef LIBMESH_HAVE_RTTI
<< "\t " << it->second->type()
#endif // LIBMESH_HAVE_RTTI
<< "\t "; it->second->print(os);
os << '\n';
++it;
}
}
| void libMesh::Parameters::remove | ( | const std::string & | name | ) | [inline] |
Removes the specified parameter from the list, if it exists.
Definition at line 483 of file parameters.h.
References _values.
Referenced by libMesh::FrequencySystem::clear_all().
{
Parameters::iterator it = _values.find(name);
if (it != _values.end())
{
delete it->second;
it->second = NULL;
_values.erase(it);
}
}
| T & libMesh::Parameters::set | ( | const std::string & | name | ) | [inline] |
get() member. Definition at line 472 of file parameters.h.
References _values, libMesh::Quality::name(), and set_attributes().
Referenced by libMesh::NewmarkSystem::clear(), libMesh::EquationSystems::EquationSystems(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::NonlinearImplicitSystem::NonlinearImplicitSystem(), libMesh::FrequencySystem::set_current_frequency(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), libMesh::FrequencySystem::set_frequencies_by_steps(), and libMesh::NewmarkSystem::set_newmark_parameters().
| virtual void libMesh::Parameters::set_attributes | ( | const std::string & | , |
| bool | |||
| ) | [inline, virtual] |
Overridable function to set any extended attributes for classes inheriting from this class.
Definition at line 133 of file parameters.h.
Referenced by insert(), and set().
{}
std::map<std::string, Value*> libMesh::Parameters::_values [protected] |
Data structure to map names with values.
Definition at line 278 of file parameters.h.
Referenced by begin(), clear(), end(), get(), have_parameter(), insert(), n_parameters(), operator+=(), print(), remove(), and set().