20#include <boost/core/demangle.hpp>
33 : acceptor_id(class_list.size())
37 this, boost::core::demangle(
typeid(*this).name()).c_str());
54 boost::core::demangle(
typeid(*this).name()));
61 const std::string & filename,
62 const std::string & output_filename,
68 if (!filename.empty())
74 catch (const ::PathSearch::ExcFileNotFound &)
78 ExcMessage(
"You specified <" + filename +
"> as input " +
79 "parameter file, but it does not exist. " +
80 "We created it for you."));
84 if (!output_filename.empty())
130 if (instance !=
nullptr)
132 instance->enter_my_subsection(
prm);
133 instance->parse_parameters(
prm);
134 instance->parse_parameters_call_back();
135 instance->leave_my_subsection(
prm);
145 if (instance !=
nullptr)
147 instance->enter_my_subsection(
prm);
148 instance->declare_parameters(
prm);
149 instance->declare_parameters_call_back();
150 instance->leave_my_subsection(
prm);
156std::vector<std::string>
161 const bool is_absolute = (my_section_name.front() ==
sep);
163 std::vector<std::string> sections =
170 sections.erase(sections.begin());
180 bool has_trailing =
class_list[i]->get_section_name().back() ==
sep;
181 auto previous_path =
class_list[i]->get_section_path();
184 if ((previous_path.size() > 0) && has_trailing ==
false)
185 previous_path.resize(previous_path.size() - 1);
187 sections.insert(sections.begin(),
188 previous_path.begin(),
189 previous_path.end());
206 "A subsection name cannot contain the special character '/'"));
209 ExcMessage(
"Cannot create an empty subsection."));
220 ExcMessage(
"There is no subsection to leave here."));
231 for (
const auto &sec : sections)
244 for (
unsigned int i = 0; i < sections.size(); ++i)
virtual ~ParameterAcceptor() override
std::string get_section_name() const
static void declare_all_parameters(ParameterHandler &prm=ParameterAcceptor::prm)
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
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)
void enter_my_subsection(ParameterHandler &prm)
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)
std::ostream & print_parameters(std::ostream &out, const OutputStyle style) const
void enter_subsection(const std::string &subsection)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
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=",")