diff --git a/opm/core/utility/parameters/ParameterGroup.cpp b/opm/core/utility/parameters/ParameterGroup.cpp index 224d899db..1f0f59e31 100644 --- a/opm/core/utility/parameters/ParameterGroup.cpp +++ b/opm/core/utility/parameters/ParameterGroup.cpp @@ -47,7 +47,6 @@ #include #include #include -#include namespace Opm { namespace parameter { @@ -99,11 +98,6 @@ namespace Opm { return get(name); } - void ParameterGroup::readXML(const std::string& xml_filename) - { - fill_xml(*this, xml_filename, output_is_enabled_); - } - namespace { inline std::istream& samcode_readline(std::istream& is, std::string& parameter) { diff --git a/opm/core/utility/parameters/ParameterGroup.hpp b/opm/core/utility/parameters/ParameterGroup.hpp index 68279ee9d..f9d3c557a 100644 --- a/opm/core/utility/parameters/ParameterGroup.hpp +++ b/opm/core/utility/parameters/ParameterGroup.hpp @@ -52,8 +52,7 @@ namespace Opm { /// given by main). This parses the command line, where each token /// either /// A) specifies a parameter (by a "param=value" token). - /// B) specifies a xml file to be read (by a "filename.xml" token). - /// C) specifies a param file to be read (by a "filename.param" token). + /// B) specifies a param file to be read (by a "filename.param" token). /// After the tokens are parsed they are stored in a tree structure /// in the ParameterGroup object; it is worth mentioning that parameters /// are inherited in this tree structure. Thus, if ``grid\_prefix'' is @@ -76,36 +75,10 @@ namespace Opm { /// simulator param=value1 param=value2 /// will use value2 as the value of ``param''. /// - /// XML parameters - /// - /// In the introduction to this section it was mentioned that the parameters for - /// the simulator are organized in a tree structure. This is mirrored in the XML - /// file by the use of groups; a group is a collection of parameters and subgroups - /// enclosed by a \fixed{}-\fixed{} pair. The only - /// attribute of relevance in a \fixed{ParameterGroup} tag is that of \fixed{name}, - /// which is used to navigate in the tree. - /// The actual parameters are specified by the \fixed{} tag. Each - /// parameter has three attributes: \fixed{name}, \fixed{type}, and \fixed{value}. - /// Both name and value should be evident. Type is one of \fixed{bool} (for things - /// that are either true or false), \fixed{int} (for integers), \fixed{double} (for - /// floating point numbers with double precision), \fixed{string} (for text - /// strings), or \fixed{file} (for files and directories relative to the location - /// of the XML file). - /// /// param files /// /// A param file consists of multiple lienes, where each line consists of "param=value". - /// This syntax is identical to the one for paramters specified on the command line. - /// - /// - /// If one combines both XML files and parameters, one should note that that if a parameter - /// is specified on the command line is also found in a XML file, the parameter - /// specified on the command line is the one used. Thus, if ``parameters.xml'' - /// specifies that ``stepsize'' is 2.71828 while, the command used to run the - /// application ``simulator'' is - /// simulator stepsize=3.14159 parameters.xml - /// the simulator will run with ``stepsize'' equal to 3.14159. - /// + /// This syntax is identical to the one for parameters specified on the command line. class ParameterGroup : public ParameterMapItem { public: struct NotFoundException : public std::exception {}; @@ -128,7 +101,7 @@ namespace Opm { /// /// It is required that argv[0] is the program name, while if /// 0 < i < argc, then argv[i] is either - /// the name of an xml file, parameter file or parametername=value. + /// the name of a parameter file or parametername=value. /// /// \param argc is the number of command-line arguments, /// including the name of the executable. @@ -212,13 +185,6 @@ namespace Opm { /// getGroup is enabled. bool isOutputEnabled() const; - - /// \brief Reads the contents of the xml file specified by - /// xml_filename into this ParameterGroup. - /// - /// \param xml_filename is the name of a xml file. - void readXML(const std::string& xml_filename); - /// \brief Reads the contents of the param file specified by /// param_filename into this ParameterGroup. /// diff --git a/opm/core/utility/parameters/ParameterGroup_impl.hpp b/opm/core/utility/parameters/ParameterGroup_impl.hpp index a1e06a9c5..3400221b2 100644 --- a/opm/core/utility/parameters/ParameterGroup_impl.hpp +++ b/opm/core/utility/parameters/ParameterGroup_impl.hpp @@ -113,8 +113,8 @@ namespace Opm { { if (verify_syntax && (argc < 2)) { std::cerr << "Usage: " << argv[0] << " " - << "[paramfilename1.{xml,param}] " - << "[paramfilename2.{xml,param}] " + << "[paramfilename1.param] " + << "[paramfilename2.param] " << "[overridden_arg1=value1] " << "[overridden_arg2=value2] " << "[...]" << std::endl; @@ -150,14 +150,12 @@ namespace Opm { } for (int i = 0; i < int(files.size()); ++i) { std::pair file_type = filename_split(files[i]); - if (file_type.second == "xml") { - this->readXML(files[i]); - } else if (file_type.second == "param") { + if (file_type.second == "param") { this->readParam(files[i]); } else { if (verify_syntax) { std::cerr << "ERROR: Input '" << files[i] << "' is not a valid name for a parameter file.\n"; - std::cerr << " Valid filename extensions are 'xml' and 'param'.\n"; + std::cerr << " Valid filename extensions are 'param'.\n"; OPM_THROW(std::runtime_error, "ParameterGroup cannot handle argument: " << files[i]); } else { unhandled_arguments_.push_back(files[i]); diff --git a/opm/core/utility/parameters/ParameterStrings.hpp b/opm/core/utility/parameters/ParameterStrings.hpp index 66640aa2e..1441fdcf7 100644 --- a/opm/core/utility/parameters/ParameterStrings.hpp +++ b/opm/core/utility/parameters/ParameterStrings.hpp @@ -45,12 +45,6 @@ namespace Opm { const std::string ID_xmltag__param_grp = "ParameterGroup"; const std::string ID_xmltag__param = "Parameter"; - const std::string ID_xmltag__file_param_grp = "ParameterGroupFromFile"; - const std::string ID_xmltag__file_params = "MergeWithFile"; - - const std::string ID_xmlatt__value = "value"; - const std::string ID_xmlatt__name = "name"; - const std::string ID_xmlatt__type = "type"; const std::string ID_param_type__bool = "bool"; const std::string ID_param_type__int = "int"; diff --git a/tests/test_param.cpp b/tests/test_param.cpp index 972b20db3..f219a85d0 100644 --- a/tests/test_param.cpp +++ b/tests/test_param.cpp @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(xml_syntax_init) { typedef const char* cp; std::vector argv = { "program_command", - "testdata.xml", + "testdata.param", "/group/item=overridingstring", "unhandledargument", 0}; @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(failing_strict_xml_syntax_init) { typedef const char* cp; std::vector argv = { "program_command", - "testdata.xml", + "testdata.param", "/group/item=overridingstring", "unhandledargument", 0 }; diff --git a/tests/testdata.param b/tests/testdata.param new file mode 100644 index 000000000..e85f7e9f7 --- /dev/null +++ b/tests/testdata.param @@ -0,0 +1,6 @@ +topitem=somestring +/slashtopitem=anotherstring +/group/item=1 +/group/anotheritem=2 +/group/subgroup/item=3 +/group/subgroup/anotheritem=4