From 0ab95f85794e8c0750fb8c5fb6cb64e82f6d9e0a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 22 Mar 2015 18:43:56 -0500 Subject: [PATCH] Also list aliases in the output generated by print_parameters in LaTeX mode. --- include/deal.II/base/parameter_handler.h | 2 +- source/base/parameter_handler.cc | 31 ++++++++++++++++++- tests/bits/parameter_handler_4a_with_alias.cc | 4 +++ .../parameter_handler_4a_with_alias.output | 18 +++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index 5b5e1b3e33..50f65328c6 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -1809,7 +1809,7 @@ public: * ParameterHandler in order to get a valid XML document and all * subsections under it. * - * In Text format, the output contains the same information but in + * In LaTeX format, the output contains the same information but in * a format so that the resulting file can be input into a latex document * such as a manual for the code for which this object handles run-time * parameters. The various sections of parameters are then represented by diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index a246f59ff6..5f80e2b06f 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -2140,7 +2140,9 @@ ParameterHandler::print_parameters_section (std::ostream &out, for (boost::property_tree::ptree::const_assoc_iterator p = current_section.ordered_begin(); p != current_section.not_found(); ++p) - if (is_parameter_node (p->second) == true) + if ((is_parameter_node (p->second) == true) + || + (is_alias_node (p->second) == true)) { parameters_exist_here = true; break; @@ -2200,6 +2202,33 @@ ParameterHandler::print_parameters_section (std::ostream &out, << p->second.get ("pattern_description") << std::endl; } + else if (is_alias_node (p->second) == true) + { + const std::string alias = p->second.get("alias"); + + // print name + out << "\\item {\\it Parameter name:} {\\tt " << demangle(p->first) << "}\n" + << "\\phantomsection\\label{parameters:"; + for (unsigned int i=0; ifirst); + out << "}\n\n" + << std::endl; + + out << "\\index[prmindex]{" + << demangle(p->first) + << "}\n"; + out << "\\index[prmindexfull]{"; + for (unsigned int i=0; ifirst) + << "}\n"; + + // finally print value and default + out << "This parameter is an alias for the parameter ``\\texttt{" + << alias << "}''.\n\n" + << std::endl; + } out << "\\end{itemize}" << std::endl; } diff --git a/tests/bits/parameter_handler_4a_with_alias.cc b/tests/bits/parameter_handler_4a_with_alias.cc index a567c1426a..564f7c2383 100644 --- a/tests/bits/parameter_handler_4a_with_alias.cc +++ b/tests/bits/parameter_handler_4a_with_alias.cc @@ -61,10 +61,14 @@ int main () prm.declare_entry ("int", "1", Patterns::Integer()); + prm.declare_alias ("int", + "int_alias"); prm.declare_entry ("double", "3.1415926", Patterns::Double(), "docs 3"); + prm.declare_alias ("double", + "double_alias"); } prm.leave_subsection (); diff --git a/tests/bits/parameter_handler_4a_with_alias.output b/tests/bits/parameter_handler_4a_with_alias.output index 6dcf0739c9..8d5a7a675f 100644 --- a/tests/bits/parameter_handler_4a_with_alias.output +++ b/tests/bits/parameter_handler_4a_with_alias.output @@ -24,6 +24,15 @@ {\it Possible values:} [Double -1.79769e+308...1.79769e+308 (inclusive)] +\item {\it Parameter name:} {\tt double_alias} +\phantomsection\label{parameters:Testing/double_alias} + + +\index[prmindex]{double_alias} +\index[prmindexfull]{Testing!double_alias} +This parameter is an alias for the parameter ``\texttt{double}''. + + \item {\it Parameter name:} {\tt int} \phantomsection\label{parameters:Testing/int} @@ -37,6 +46,15 @@ {\it Possible values:} [Integer range -2147483648...2147483647 (inclusive)] +\item {\it Parameter name:} {\tt int_alias} +\phantomsection\label{parameters:Testing/int_alias} + + +\index[prmindex]{int_alias} +\index[prmindexfull]{Testing!int_alias} +This parameter is an alias for the parameter ``\texttt{int}''. + + \item {\it Parameter name:} {\tt string list} \phantomsection\label{parameters:Testing/string list} -- 2.39.5