*/
virtual ~ParameterHandler ();
- /**
- * Read input from a stream until the stream returns the <tt>eof</tt>
- * condition or error. The second argument can be used to denote the name of
- * the file (if that's what the input stream represents) we are reading
- * from; this is only used when creating output for error messages.
- *
- * If non-empty @p last_line is provided, the ParameterHandler object
- * will stop parsing lines after encountering @p last_line .
- * This is handy when adding extra data that shall be parsed manually.
- *
- * @deprecated This function has been deprecated in favor of the replacement
- * ParameterHandler::parse_input, which raises exceptions to indicate errors
- * instead of returning an error code.
- */
- virtual bool read_input (std::istream &input,
- const std::string &filename = "input file",
- const std::string &last_line = "") DEAL_II_DEPRECATED;
-
/**
* Parse each line from a stream until the stream returns the <tt>eof</tt>
* condition or error to provide values for known parameter fields. The second
const std::string &filename = "input file",
const std::string &last_line = "");
- /**
- * Read input from a file the name of which is given. The PathSearch class
- * "PARAMETERS" is used to find the file.
- *
- * Unless <tt>optional</tt> is <tt>true</tt>, this function will
- * automatically generate the requested file with default values if the file
- * did not exist. This file will not contain additional comments if
- * <tt>write_stripped_file</tt> is <tt>true</tt>.
- *
- * If non-empty @p last_line is provided, the ParameterHandler object
- * will stop parsing lines after encountering @p last_line .
- * This is handy when adding extra data that shall be parsed manually.
- *
- * @deprecated This function has been deprecated in favor of the replacement
- * ParameterHandler::parse_input, which raises exceptions to indicate errors
- * instead of returning an error code. ParameterHandler::parse_input does
- * not have the capability to write default values to a file on failure: if
- * you wish to duplicate that old behavior then you should catch the
- * PathSearch::ExcFileNotFound exception and then call
- * ParameterHandler::print_parameters.
- */
- virtual bool read_input (const std::string &filename,
- const bool optional = false,
- const bool write_stripped_file = false,
- const std::string &last_line = "") DEAL_II_DEPRECATED;
-
/**
* Parse the given file to provide values for known parameter fields. The
* PathSearch class "PARAMETERS" is used to find the file.
virtual void parse_input (const std::string &filename,
const std::string &last_line = "");
- /**
- * Read input from a string in memory. The lines in memory have to be
- * separated by <tt>@\n</tt> characters.
- *
- * If non-empty @p last_line is provided, the ParameterHandler object
- * will stop parsing lines after encountering @p last_line .
- * This is handy when adding extra data that shall be parsed manually.
- *
- * @deprecated This function has been deprecated in favor of the replacement
- * ParameterHandler::parse_input_from_string, which raises exceptions to
- * indicate errors instead of returning an error code.
- */
- virtual bool read_input_from_string (const char *s,
- const std::string &last_line = "");
-
/**
* Parse input from a string to populate known parameter fields. The lines
* in the string must be separated by <tt>@\n</tt> characters.
virtual void parse_input_from_string (const char *s,
const std::string &last_line = "");
- /**
- * Read a parameter file in XML format. This could be from a file originally
- * written by the print_parameters() function using the XML output style and
- * then modified by hand as necessary; or from a file written using this
- * method and then modified by the graphical parameter GUI (see the general
- * documentation of this class).
- *
- * @deprecated This function has been deprecated in favor of the replacement
- * ParameterHandler::parse_input_from_xml, which raises exceptions to indicate
- * errors instead of returning an error code.
- */
- virtual bool read_input_from_xml (std::istream &input) DEAL_II_DEPRECATED;
-
/**
* Parse input from an XML stream to populate known parameter fields. This
* could be from a file originally written by the print_parameters() function
*/
virtual ~MultipleParameterLoop ();
- /**
- * Read input from a stream until the stream returns the <tt>eof</tt>
- * condition or error. The second argument can be used to denote the name of
- * the file (if that's what the input stream represents) we are reading
- * from; this is only used when creating output for error messages.
- *
- * Return whether the read was successful.
- *
- * If non-empty @p last_line is provided, the ParameterHandler object
- * will stop parsing lines after encountering @p last_line .
- * This is handy when adding extra data that shall be parsed manually.
- *
- * @note Of the three <tt>read_input</tt> functions implemented by
- * ParameterHandler, this method and its replacement
- * (MultipleParameterLoop::parse_input) are the only ones overridden with
- * new behavior by this class. This is because the other two
- * <tt>read_input</tt> functions just reformat their inputs and then call
- * this version.
- *
- * @deprecated This function has been deprecated in favor of the replacement
- * MultipleParameterLoop::parse_input, which raises exceptions to indicate
- * errors instead of returning an error code.
- */
- virtual bool read_input (std::istream &input,
- const std::string &filename = "input file",
- const std::string &last_line = "") DEAL_II_DEPRECATED;
-
/**
* Read input from a stream until the stream returns the <tt>eof</tt>
* condition or error. The second argument can be used to denote the name of
*/
using ParameterHandler::parse_input;
- /**
- * For backwards compatibility also include the deprecated read functions.
- */
- using ParameterHandler::read_input;
-
/**
* run the central loop.
*/
-bool ParameterHandler::read_input (std::istream &input,
- const std::string &filename,
- const std::string &last_line)
-{
- try
- {
- parse_input(input, filename, last_line);
- return true;
- }
- catch (const ExcIO &)
- {
- throw;
- }
- // This catch block more or less duplicates the old behavior of this function,
- // which was to print something to stderr for every parsing error (which are
- // now exceptions) and then return false.
- catch (const ExceptionBase &exc)
- {
- std::cerr << exc.what() << std::endl;
- }
- return false;
-}
-
-
-
void ParameterHandler::parse_input (std::istream &input,
const std::string &filename,
const std::string &last_line)
-bool ParameterHandler::read_input (const std::string &filename,
- const bool optional,
- const bool write_compact,
- const std::string &last_line)
-{
- PathSearch search("PARAMETERS");
-
- try
- {
- std::string openname = search.find(filename);
- std::ifstream file_stream (openname.c_str());
- AssertThrow(file_stream, ExcIO());
-
- return read_input (file_stream, filename, last_line);
- }
- catch (const PathSearch::ExcFileNotFound &)
- {
- std::cerr << "ParameterHandler::read_input: could not open file <"
- << filename << "> for reading." << std::endl;
- if (!optional)
- {
- std::cerr << "Trying to make file <"
- << filename << "> with default values for you." << std::endl;
- std::ofstream output (filename.c_str());
- if (output)
- print_parameters (output, (write_compact ? ShortText : Text));
- }
- }
- return false;
-}
-
-
-
void ParameterHandler::parse_input (const std::string &filename,
const std::string &last_line)
{
-bool
-ParameterHandler::read_input_from_string (const char *s,
- const std::string &last_line)
-{
- try
- {
- parse_input_from_string (s, last_line);
- return true;
- }
- catch (const ExcIO &)
- {
- throw;
- }
- // This catch block more or less duplicates the old behavior of this function,
- // which was to print something to stderr for every parsing error (which are
- // now exceptions) and then return false.
- catch (const ExceptionBase &exc)
- {
- std::cerr << exc.what() << std::endl;
- }
- return false;
-}
-
-
-
void
ParameterHandler::parse_input_from_string (const char *s,
const std::string &last_line)
-bool ParameterHandler::read_input_from_xml(std::istream &in)
-{
- try
- {
- parse_input_from_xml (in);
- return true;
- }
- catch (const ExcIO &)
- {
- throw;
- }
- catch (const ExceptionBase &exc)
- {
- std::cerr << exc.what() << std::endl;
- }
- return false;
-}
-
-
-
void ParameterHandler::parse_input_from_xml (std::istream &in)
{
AssertThrow(in, ExcIO());
-bool
-MultipleParameterLoop::read_input (std::istream &input,
- const std::string &filename,
- const std::string &last_line)
-{
-
- try
- {
- MultipleParameterLoop::parse_input(input, filename, last_line);
- return true;
- }
- catch (const ExcIO &)
- {
- throw;
- }
- // This catch block more or less duplicates the old behavior of this function,
- // which was to print something to stderr for every parsing error (which are
- // now exceptions) and then return false.
- catch (const ExceptionBase &exc)
- {
- std::cerr << exc.what() << std::endl;
- }
- return false;
-}
-
-
-
void
MultipleParameterLoop::parse_input (std::istream &input,
const std::string &filename,