From 5e5564b1e3ff644c5a5b4aaa535209738c71740b Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 2 Mar 2011 16:49:33 +0000 Subject: [PATCH] Cleanup and clarify documentation of ParameterHandler and DataOut and simplify the usage in step-29. git-svn-id: https://svn.dealii.org/trunk@23453 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-29/step-29.cc | 30 +++++++------------ deal.II/include/deal.II/base/data_out_base.h | 7 ++++- .../include/deal.II/base/parameter_handler.h | 29 +++++++++--------- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/deal.II/examples/step-29/step-29.cc b/deal.II/examples/step-29/step-29.cc index cfe23252d3..ae8cb91c26 100644 --- a/deal.II/examples/step-29/step-29.cc +++ b/deal.II/examples/step-29/step-29.cc @@ -1359,30 +1359,20 @@ void UltrasoundProblem::output_results () const // DataOut object accordingly. prm.enter_subsection("Output parameters"); - const std::string output_file = prm.get("Output file"), - output_format = prm.get("Output format"); + const std::string output_file = prm.get("Output file"); data_out.parse_parameters(prm); prm.leave_subsection (); - // Since the ParameterHandler - // provides the output format - // parameter as a string, we need - // to convert it to a format flag - // that can be understood by the - // DataOut object. The following - // function takes care of this: - DataOutBase::OutputFormat format = DataOutBase::parse_output_format(output_format); - - // Now we put together the filename - // from the base name provided by - // the ParameterHandler and the - // suffix which is derived from the - // format by the - // DataOutBase::default_suffix - // function: + // Now we put together the filename from + // the base name provided by the + // ParameterHandler and the suffix which is + // provided by the DataOut class (the + // default suffix is set to the right type + // that matches the one set in the .prm + // file through parse_parameters()): const std::string filename = output_file + - DataOutBase::default_suffix(format); + data_out.default_suffix(); std::ofstream output (filename.c_str()); @@ -1411,7 +1401,7 @@ void UltrasoundProblem::output_results () const // the output format without having to // re-compile this program: data_out.build_patches (); - data_out.write (output, format); + data_out.write (output); timer.stop (); deallog << "done (" diff --git a/deal.II/include/deal.II/base/data_out_base.h b/deal.II/include/deal.II/base/data_out_base.h index 52235e9100..7a40abcc8a 100644 --- a/deal.II/include/deal.II/base/data_out_base.h +++ b/deal.II/include/deal.II/base/data_out_base.h @@ -2425,7 +2425,12 @@ class DataOutInterface : private DataOutBase * the base class does; the only * exception being that if the parameter * is omitted, then the value for the - * present default format is returned. + * present default format is returned, + * i.e. the correct suffix for the format + * that was set through + * set_default_format() or + * parse_parameters() before calling this + * function. */ std::string default_suffix (const OutputFormat output_format = default_format) const; diff --git a/deal.II/include/deal.II/base/parameter_handler.h b/deal.II/include/deal.II/base/parameter_handler.h index 46ca2d6b9a..f97c05df3c 100644 --- a/deal.II/include/deal.II/base/parameter_handler.h +++ b/deal.II/include/deal.II/base/parameter_handler.h @@ -113,7 +113,7 @@ namespace Patterns * bytes) of this object. To * avoid unnecessary * overhead, we do not force - * derivd classes to provide + * derived classes to provide * this function as a virtual * overloaded one, but rather * try to cast the present @@ -778,7 +778,7 @@ namespace Patterns { public: /** - * Constrcuctor. + * Constructor. */ Bool (); @@ -1044,10 +1044,10 @@ namespace Patterns * which provides at run-time for program parameters such as time step * sizes, geometries, right hand sides etc. The input for the program is * given in files, streams or strings in memory using text like - * @verbatim + * @code * set Time step size = 0.3 * set Geometry = [0,1]x[0,3] - * @endverbatim + * @endcode * Input may be sorted into subsection trees in order to give the input a * logical structure. * @@ -1165,21 +1165,22 @@ namespace Patterns *

Input files and special characters

* * For the first example above the input file would look like the following: - * @verbatim + * @code * ... * subsection Nonlinear solver * set Nonlinear method = Gradient + * # this is a comment * subsection Linear solver * set Solver = CG * set Maxmimum number of iterations = 30 * end * end * ... # other stuff - * @endverbatim + * @endcode * The words subsection, set and end may be either written in lowercase or uppercase * letters. Leading and trailing whitespace is removed, multiple whitespace is condensed into * only one. Since the latter applies also to the name of an entry, an entry name will not - * be recognised if in the declaration multiple whitespace is used. + * be recognized if in the declaration multiple whitespace is used. * * In entry names and values the following characters are not allowed: \#, {, * }, |. Their use is reserved for the MultipleParameterLoop class. @@ -1197,7 +1198,7 @@ namespace Patterns * In order to read input you can use three possibilities: reading from an * std::istream object, reading from a file of which the name is * given and reading from a string in memory in which the lines are - * separated by @\n characters. These possibilites are used as + * separated by @\n characters. These possibilities are used as * follows: * @code * ParameterHandler prm; @@ -1466,7 +1467,7 @@ namespace Patterns * * * This is the input file (named "prmtest.prm"): - * @verbatim + * @code * # first declare the types of equations * set Equation 1 = Poisson * set Equation 2 = Navier-Stokes @@ -1486,10 +1487,10 @@ namespace Patterns * set Maximum number of iterations = 100 * end * end - * @endverbatim + * @endcode * - * And here is the ouput of the program: - * @verbatim + * And here is the output of the program: + * @code * Line 8: * The entry value * Gauss-Seidel @@ -1526,7 +1527,7 @@ namespace Patterns * Problem: outfile=out * eq1=Poisson, eq2=Navier-Stokes * Matrix1=Sparse, Matrix2=Full - * @endverbatim + * @endcode * * * @@ -1644,7 +1645,7 @@ namespace Patterns * * * @ingroup input - * @author Wolfgang Bangerth, October 1997, revised February 1998, 2010 + * @author Wolfgang Bangerth, October 1997, revised February 1998, 2010, 2011 */ class ParameterHandler : public Subscriptor { -- 2.39.5