--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2002 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// check ParameterHandler::parse_input_from_xml
+
+#include "../tests.h"
+#include <deal.II/base/parameter_handler.h>
+
+
+int main ()
+{
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+
+ ParameterHandler prm;
+ prm.declare_entry ("int1",
+ "1",
+ Patterns::Integer(),
+ "doc 1");
+ prm.declare_entry ("int2",
+ "2",
+ Patterns::Integer(),
+ "doc 2");
+ prm.enter_subsection ("ss1");
+ {
+ prm.declare_entry ("double 1",
+ "1.234",
+ Patterns::Double(),
+ "doc 3");
+
+ prm.enter_subsection ("ss2");
+ {
+ prm.declare_entry ("double 2",
+ "4.321",
+ Patterns::Double(),
+ "doc 4");
+ }
+ prm.leave_subsection ();
+ }
+ prm.leave_subsection ();
+
+ // things with strange characters
+ prm.enter_subsection ("Testing%testing");
+ {
+ prm.declare_entry ("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
+ prm.declare_entry ("int*int",
+ "2",
+ Patterns::Integer());
+ prm.declare_entry ("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
+ }
+ prm.leave_subsection ();
+
+ // read from json
+ std::ifstream in (SOURCE_DIR "/prm/parameter_handler_read_json.prm");
+ prm.parse_input_from_json (in);
+
+ // write it out again
+ prm.print_parameters (deallog.get_file_stream(), ParameterHandler::JSON);
+ logfile << std::endl;
+
+ return 0;
+}
--- /dev/null
+
+{
+ "int1":
+ {
+ "value": "2",
+ "default_value": "1",
+ "documentation": "doc 1",
+ "pattern": "0",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "int2":
+ {
+ "value": "3",
+ "default_value": "2",
+ "documentation": "doc 2",
+ "pattern": "1",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "ss1":
+ {
+ "double_201":
+ {
+ "value": "2.234",
+ "default_value": "1.234",
+ "documentation": "doc 3",
+ "pattern": "2",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ },
+ "ss2":
+ {
+ "double_202":
+ {
+ "value": "5.321",
+ "default_value": "4.321",
+ "documentation": "doc 4",
+ "pattern": "3",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ }
+ }
+ },
+ "Testing_25testing":
+ {
+ "string_26list":
+ {
+ "value": "< & > ; \/",
+ "default_value": "< & > ; \/",
+ "documentation": "docs 1",
+ "pattern": "4",
+ "pattern_description": "[Anything]"
+ },
+ "int_2aint":
+ {
+ "value": "2",
+ "default_value": "2",
+ "documentation": "",
+ "pattern": "5",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "double_2bdouble":
+ {
+ "value": "7.1415926",
+ "default_value": "6.1415926",
+ "documentation": "docs 3",
+ "pattern": "6",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ }
+ }
+}
+
--- /dev/null
+
+{
+ "int1":
+ {
+ "value": "2",
+ "default_value": "1",
+ "documentation": "doc 1",
+ "pattern": "0",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "int2":
+ {
+ "value": "3",
+ "default_value": "2",
+ "documentation": "doc 2",
+ "pattern": "1",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "ss1":
+ {
+ "double_201":
+ {
+ "value": "2.234",
+ "default_value": "1.234",
+ "documentation": "doc 3",
+ "pattern": "2",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ },
+ "ss2":
+ {
+ "double_202":
+ {
+ "value": "5.321",
+ "default_value": "4.321",
+ "documentation": "doc 4",
+ "pattern": "3",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ }
+ }
+ },
+ "Testing_25testing":
+ {
+ "string_26list":
+ {
+ "value": "< & > ; \/",
+ "default_value": "< & > ; \/",
+ "documentation": "docs 1",
+ "pattern": "4",
+ "pattern_description": "[Anything]"
+ },
+ "int_2aint":
+ {
+ "value": "2",
+ "default_value": "2",
+ "documentation": "",
+ "pattern": "5",
+ "pattern_description": "[Integer range -2147483648...2147483647 (inclusive)]"
+ },
+ "double_2bdouble":
+ {
+ "value": "7.1415926",
+ "default_value": "6.1415926",
+ "documentation": "docs 3",
+ "pattern": "6",
+ "pattern_description": "[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]"
+ }
+ }
+}
+