Reference documentation for deal.II version 9.0.0
|
#include <deal.II/base/parameter_acceptor.h>
Public Member Functions | |
template<typename... Args> | |
ParameterAcceptorProxy (const std::string section_name, Args... args) | |
virtual void | declare_parameters (ParameterHandler &prm) |
virtual void | parse_parameters (ParameterHandler &prm) |
Public Member Functions inherited from ParameterAcceptor | |
ParameterAcceptor (const std::string §ion_name="") | |
virtual | ~ParameterAcceptor () |
std::string | get_section_name () const |
std::vector< std::string > | get_section_path () const |
template<class ParameterType > | |
void | add_parameter (const std::string &entry, ParameterType ¶meter, const std::string &documentation=std::string(), ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern()) |
void | enter_my_subsection (ParameterHandler &prm) |
void | leave_my_subsection (ParameterHandler &prm) |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | subscribe (const char *identifier=nullptr) const |
void | unsubscribe (const char *identifier=nullptr) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Additional Inherited Members | |
Static Public Member Functions inherited from ParameterAcceptor | |
static void | initialize (const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_prm_format=ParameterHandler::ShortText, ParameterHandler &prm=ParameterAcceptor::prm) |
static void | initialize (std::istream &input_stream, ParameterHandler &prm=ParameterAcceptor::prm) |
static void | clear () |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
Static Public Member Functions inherited from Subscriptor | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Public Attributes inherited from ParameterAcceptor | |
boost::signals2::signal< void()> | declare_parameters_call_back |
boost::signals2::signal< void()> | parse_parameters_call_back |
Static Public Attributes inherited from ParameterAcceptor | |
static ParameterHandler | prm |
Protected Attributes inherited from ParameterAcceptor | |
const std::string | section_name |
A proxy ParameterAcceptor wrapper for classes that have a static member function declare_parameters
, and a non virtual parse_parameters
method.
If you cannot or do not want to derive your "parameter accepting" class from ParameterAcceptor, for example if by design you are required to have a static member function declare_parameters
and a member parse_parameters
, or if someone has already implemented such a class for you, and only provides you with an API that you cannot modify, then you may be able to use ParameterAcceptor facilities nonetheless, by wrapping your class into ParameterAcceptorProxy.
This class implements the public interface of ParameterAcceptor, and at the same time it derives from the template class SourceClass
, allowing you to register your existing SourceClass
as a ParameterAcceptor class, without requiring you to explicitly derive your SourceClass
from ParameterAcceptor.
An example usage is given by the following snippet of code, using Functions::ParsedFunction as an example source class:
The above snippet of code will initialize ParameterAcceptor::prm with a section "Some function", and will correctly parse and assign to the object fun
the expression parsed from the file test.prm
. If non-existent, the program will exit, and generate it for you (here you can see the resulting short text version of the parameter file generated with the above snippet):
The resulting fun
object, is both a ParsedFunction object and a ParameterAcceptor one, allowing you to use it as a replacement of the ParsedFunction class, with automatic declaration and parsing of parameter files.
See the tutorial program step-60 for an example on how to use this class.
Definition at line 578 of file parameter_acceptor.h.
ParameterAcceptorProxy< SourceClass >::ParameterAcceptorProxy | ( | const std::string | section_name, |
Args... | args | ||
) |
Default constructor. The argument section_name
is forwarded to the constructor of the ParameterAcceptor class, while all other arguments are passed to the SourceClass constructor.
Definition at line 622 of file parameter_acceptor.h.
|
virtual |
Overloads the ParameterAcceptor::declare_parameters function, by calling SourceClass::declare_parameters
with prm
as an argument.
Reimplemented from ParameterAcceptor.
Definition at line 631 of file parameter_acceptor.h.
|
virtual |
Overloads the ParameterAcceptor::parse_parameters function, by calling SourceClass::parse_parameters
with prm
as an argument.
Reimplemented from ParameterAcceptor.
Definition at line 639 of file parameter_acceptor.h.