19#include <boost/core/demangle.hpp>
45std::set<ParameterAcceptor *, internal::ParameterAcceptorCompare>
76 boost::core::demangle(
typeid(*this).name()));
83 const std::string &filename,
84 const std::string &output_filename,
90 if (!filename.empty())
96 catch (const ::ExcFileNotOpen &)
100 ExcMessage(
"You specified <" + filename +
"> as input " +
101 "parameter file, but it does not exist. " +
102 "We created it for you."));
106 if (!output_filename.empty())
154 instance->enter_my_subsection(
prm);
155 instance->parse_parameters(
prm);
156 instance->parse_parameters_call_back();
157 instance->leave_my_subsection(
prm);
168 instance->enter_my_subsection(
prm);
169 instance->declare_parameters(
prm);
170 instance->declare_parameters_call_back();
171 instance->leave_my_subsection(
prm);
177std::vector<std::string>
181 const bool is_absolute = (my_section_name.front() ==
sep);
183 std::vector<std::string> sections =
190 sections.erase(sections.begin());
201 const auto *
const acceptor = *acceptor_it;
204 bool has_trailing = acceptor->get_section_name().back() ==
sep;
205 auto previous_path = acceptor->get_section_path();
208 if ((previous_path.size() > 0) && has_trailing ==
false)
209 previous_path.resize(previous_path.size() - 1);
211 sections.insert(sections.begin(),
212 previous_path.begin(),
213 previous_path.end());
230 "A subsection name cannot contain the special character '/'"));
233 ExcMessage(
"Cannot create an empty subsection."));
244 ExcMessage(
"There is no subsection to leave here."));
255 for (
const auto &sec : sections)
268 for (
unsigned int i = 0; i < sections.size(); ++i)
287 static std::mutex id_mutex;
288 std::lock_guard<std::mutex> lock(id_mutex);
289 static int current_id = 0;
virtual ~ParameterAcceptor() override
std::string get_section_name() const
static void declare_all_parameters(ParameterHandler &prm=ParameterAcceptor::prm)
unsigned int get_acceptor_id() const
const unsigned int acceptor_id
const std::string section_name
ParameterAcceptor(const std::string §ion_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
void leave_my_subsection(ParameterHandler &prm)
void enter_subsection(const std::string &subsection)
virtual void parse_parameters(ParameterHandler &prm)
static unsigned int get_next_free_id()
static void parse_all_parameters(ParameterHandler &prm=ParameterAcceptor::prm)
void enter_my_subsection(ParameterHandler &prm)
static std::mutex class_list_mutex
static std::set< ParameterAcceptor *, internal::ParameterAcceptorCompare > class_list
virtual void declare_parameters(ParameterHandler &prm)
std::vector< std::string > get_section_path() const
virtual void parse_input(std::istream &input, const std::string &filename="input file", const std::string &last_line="", const bool skip_undefined=false)
void enter_subsection(const std::string &subsection, const bool create_path_if_needed=true)
std::ostream & print_parameters(std::ostream &out, const OutputStyle style) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
std::vector< std::string > split_string_list(const std::string &s, const std::string &delimiter=",")
bool operator()(const ParameterAcceptor *p1, const ParameterAcceptor *p2) const