Reference documentation for deal.II version 9.1.0-pre
Public Member Functions | List of all members
ParameterAcceptorProxy< SourceClass > Class Template Reference

#include <deal.II/base/parameter_acceptor.h>

Inheritance diagram for ParameterAcceptorProxy< SourceClass >:
[legend]

Public Member Functions

template<typename... Args>
 ParameterAcceptorProxy (const std::string section_name, Args...args)
 
virtual void declare_parameters (ParameterHandler &prm) override
 
virtual void parse_parameters (ParameterHandler &prm) override
 
- Public Member Functions inherited from ParameterAcceptor
 ParameterAcceptor (const std::string &section_name="")
 
virtual ~ParameterAcceptor () override
 
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 &parameter, 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 ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (const char *identifier=nullptr) const
 
void unsubscribe (const char *identifier=nullptr) const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) 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
 

Detailed Description

template<class SourceClass>
class ParameterAcceptorProxy< SourceClass >

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):

# Parameter file generated with
# DEAL_II_PACKAGE_VERSION = 9.0.0-pre
subsection Some function
set Function constants =
set Function expression = 0
set Variable names = x,y,t
end

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.

Author
Luca Heltai, 2018

Definition at line 597 of file parameter_acceptor.h.

Constructor & Destructor Documentation

template<class SourceClass >
template<typename... Args>
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 643 of file parameter_acceptor.h.

Member Function Documentation

template<class SourceClass >
void ParameterAcceptorProxy< SourceClass >::declare_parameters ( ParameterHandler prm)
overridevirtual

Overloads the ParameterAcceptor::declare_parameters function, by calling SourceClass::declare_parameters with prm as an argument.

Reimplemented from ParameterAcceptor.

Definition at line 654 of file parameter_acceptor.h.

template<class SourceClass >
void ParameterAcceptorProxy< SourceClass >::parse_parameters ( ParameterHandler prm)
overridevirtual

Overloads the ParameterAcceptor::parse_parameters function, by calling SourceClass::parse_parameters with prm as an argument.

Reimplemented from ParameterAcceptor.

Definition at line 663 of file parameter_acceptor.h.


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