Store unhandled command-line arguments.

A new method ParameterGroup::unhandledArguments() is available to
access the list of unhandled arguments. Before, when such arguments
were encountered they were ignored and a warning was printed to
standard out.

Apart from the lack of a (potentially misleading) warning, this
should not change the behaviour of existing clients of the class.
This commit is contained in:
Atgeirr Flø Rasmussen
2015-04-14 13:39:43 +02:00
parent 68d901fce1
commit 1fb2bc651c
3 changed files with 10 additions and 3 deletions

View File

@@ -329,5 +329,10 @@ namespace Opm {
}
}
const std::vector<std::string> ParameterGroup::unhandledArguments() const
{
return unhandled_arguments_;
}
} // namespace parameter
} // namespace Opm

View File

@@ -267,6 +267,9 @@ namespace Opm {
/// Insert a new parameter item into the group.
void insertParameter(const std::string& name, const std::string& value);
/// Unhandled arguments from command line parsing.
const std::vector<std::string> unhandledArguments() const;
private:
typedef std::shared_ptr<ParameterMapItem> data_type;
typedef std::pair<std::string, data_type> pair_type;
@@ -276,6 +279,7 @@ namespace Opm {
map_type map_;
const ParameterGroup* parent_;
bool output_is_enabled_;
std::vector<std::string> unhandled_arguments_;
template<typename T, class Requirement>
T translate(const pair_type& data, const Requirement& chk) const;

View File

@@ -150,9 +150,7 @@ namespace Opm {
} else if (file_type.second == "param") {
this->readParam(files[i]);
} else {
std::cout << "WARNING: Ignoring file '"
<< files[i] << "' with unknown extension.\n"
<< "Valid filename extensions are 'xml' and 'param'.\n";
unhandled_arguments_.push_back(files[i]);
}
}
for (int i = 0; i < int(assignments.size()); ++i) {