16 #include <deal.II/base/parameter_acceptor.h>
17 #include <deal.II/base/path_search.h>
18 #include <deal.II/base/utilities.h>
20 #include <boost/core/demangle.hpp>
24 DEAL_II_NAMESPACE_OPEN
33 : acceptor_id(class_list.size())
37 this, boost::core::demangle(
typeid(*this).name()).c_str());
51 boost::core::demangle(
typeid(*this).name()));
57 const std::string & filename,
58 const std::string & output_filename,
63 if (!filename.empty())
66 if (filename.substr(filename.find_last_of(
'.') + 1) ==
"prm")
72 catch (const ::PathSearch::ExcFileNotFound &)
74 std::ofstream out(filename);
81 "parameter file, but it does not exist. " +
82 "We created it for you."));
85 else if (filename.substr(filename.find_last_of(
'.') + 1) ==
"xml")
87 std::ifstream is(filename);
90 std::ofstream out(filename);
97 "parameter file, but it does not exist. " +
98 "We created it for you."));
106 "Invalid extension of parameter file. Please use .prm or .xml"));
109 if (!output_filename.empty())
111 std::ofstream outfile(output_filename.c_str());
113 std::string extension =
114 output_filename.substr(output_filename.find_last_of(
'.') + 1);
116 if (extension ==
"prm")
118 outfile <<
"# Parameter file generated with " << std::endl
119 <<
"# DEAL_II_PACKAGE_VERSION = " << DEAL_II_PACKAGE_VERSION
125 "Only Text or ShortText can be specified in output_style_for_prm_format."))
128 else if (extension ==
"xml")
130 else if (extension ==
"latex" || extension ==
"tex")
177 if (instance !=
nullptr)
179 instance->enter_my_subsection(
prm);
180 instance->parse_parameters(
prm);
181 instance->parse_parameters_call_back();
182 instance->leave_my_subsection(
prm);
190 if (instance !=
nullptr)
192 instance->enter_my_subsection(
prm);
193 instance->declare_parameters(
prm);
194 instance->declare_parameters_call_back();
195 instance->leave_my_subsection(
prm);
200 std::vector<std::string>
205 const bool is_absolute = (my_section_name.front() ==
sep);
207 std::vector<std::string> sections =
214 sections.erase(sections.begin());
224 bool has_trailing =
class_list[i]->get_section_name().back() ==
sep;
225 auto previous_path =
class_list[i]->get_section_path();
228 if ((previous_path.size() > 0) && has_trailing ==
false)
229 previous_path.resize(previous_path.size() - 1);
231 sections.insert(sections.begin(),
232 previous_path.begin(),
233 previous_path.end());
246 for (
const auto &sec : sections)
257 for (
unsigned int i = 0; i < sections.size(); ++i)
265 DEAL_II_NAMESPACE_CLOSE