Reference documentation for deal.II version 9.4.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
parameter_acceptor.h
Go to the documentation of this file.
1//-----------------------------------------------------------
2//
3// Copyright (C) 2017 - 2022 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14//-----------------------------------------------------------
15
16#ifndef dealii_base_parameter_acceptor_h
17#define dealii_base_parameter_acceptor_h
18
19#include <deal.II/base/config.h>
20
25
26#include <boost/signals2/signal.hpp>
27
28#include <typeinfo>
29
31
349{
350public:
357 ParameterAcceptor(const std::string &section_name = "");
358
362 virtual ~ParameterAcceptor() override;
363
400 static void
401 initialize(const std::string &filename = "",
402 const std::string &output_filename = "",
404 output_style_for_output_filename = ParameterHandler::Short,
406 const ParameterHandler::OutputStyle output_style_for_filename =
408
418 static void
419 initialize(std::istream & input_stream,
421
422
426 static void
427 clear();
428
434 virtual void
436
443 boost::signals2::signal<void()> declare_parameters_call_back;
444
450 virtual void
452
462 boost::signals2::signal<void()> parse_parameters_call_back;
463
469 static void
471
478 static void
480
486 std::string
487 get_section_name() const;
488
493 std::vector<std::string>
494 get_section_path() const;
495
505 template <class ParameterType>
506 void
507 add_parameter(const std::string & entry,
508 ParameterType & parameter,
509 const std::string & documentation = "",
510 ParameterHandler & prm_ = prm,
511 const Patterns::PatternBase &pattern =
513
518
570 void
571 enter_subsection(const std::string &subsection);
572
577 void
579
583 void
585
590 void
592
593private:
598 static std::vector<SmartPointer<ParameterAcceptor>> class_list;
599
601 const unsigned int acceptor_id;
602
606 static const char sep = '/';
607
608protected:
610 const std::string section_name;
611
613 std::vector<std::string> subsections;
614};
615
616
617
667template <class SourceClass>
669{
670public:
676 template <typename... Args>
677 ParameterAcceptorProxy(const std::string &section_name, Args... args);
678
683 virtual void
685
690 virtual void
692};
693
694
695
696// Inline and template functions
697template <class ParameterType>
698void
699ParameterAcceptor::add_parameter(const std::string & entry,
700 ParameterType & parameter,
701 const std::string & documentation,
702 ParameterHandler & prm,
703 const Patterns::PatternBase &pattern)
704{
706 prm.add_parameter(entry, parameter, documentation, pattern);
708}
709
710
711
712template <class SourceClass>
713template <typename... Args>
715 const std::string &section_name,
716 Args... args)
717 : SourceClass(args...)
718 , ParameterAcceptor(section_name)
719{}
720
721
722
723template <class SourceClass>
724void
726{
727 SourceClass::declare_parameters(prm);
728}
729
730
731
732template <class SourceClass>
733void
735{
736 SourceClass::parse_parameters(prm);
737}
738
740
741#endif
virtual void declare_parameters(ParameterHandler &prm) override
virtual void parse_parameters(ParameterHandler &prm) override
ParameterAcceptorProxy(const std::string &section_name, Args... args)
virtual ~ParameterAcceptor() override
std::string get_section_name() const
boost::signals2::signal< void()> declare_parameters_call_back
static const char sep
static void declare_all_parameters(ParameterHandler &prm=ParameterAcceptor::prm)
const unsigned int acceptor_id
const std::string section_name
std::vector< std::string > subsections
static void initialize(const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle)
static ParameterHandler prm
static std::vector< SmartPointer< ParameterAcceptor > > class_list
void leave_my_subsection(ParameterHandler &prm)
void enter_subsection(const std::string &subsection)
virtual void parse_parameters(ParameterHandler &prm)
static void parse_all_parameters(ParameterHandler &prm=ParameterAcceptor::prm)
boost::signals2::signal< void()> parse_parameters_call_back
void enter_my_subsection(ParameterHandler &prm)
void add_parameter(const std::string &entry, ParameterType &parameter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern())
virtual void declare_parameters(ParameterHandler &prm)
std::vector< std::string > get_section_path() const
void add_parameter(const std::string &entry, ParameterType &parameter, const std::string &documentation="", const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern(), const bool has_to_be_set=false)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443