mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Parameters::printParamList can now be an implementation detail
This commit is contained in:
@@ -116,6 +116,25 @@ std::string parseUnquotedValue(std::string& s, const std::string&)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void printParamList(std::ostream& os,
|
||||
const std::list<std::string>& keyList,
|
||||
bool printDefaults = false)
|
||||
{
|
||||
const Dune::ParameterTree& tree = Opm::Parameters::MetaData::tree();
|
||||
|
||||
for (const auto& key : keyList) {
|
||||
const auto& paramInfo = Opm::Parameters::MetaData::registry().at(key);
|
||||
const std::string& defaultValue = paramInfo.defaultValue;
|
||||
std::string value = defaultValue;
|
||||
if (tree.hasKey(key))
|
||||
value = tree.get(key, "");
|
||||
os << key << "=\"" << value << "\"";
|
||||
if (printDefaults)
|
||||
os << " # default: \"" << defaultValue << "\"";
|
||||
os << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void printParamUsage(std::ostream& os,
|
||||
const Opm::Parameters::ParamInfo& paramInfo)
|
||||
{
|
||||
@@ -472,25 +491,6 @@ void getLists(std::vector<Parameter>& usedParams,
|
||||
}
|
||||
}
|
||||
|
||||
void printParamList(std::ostream& os,
|
||||
const std::list<std::string>& keyList,
|
||||
bool printDefaults)
|
||||
{
|
||||
const Dune::ParameterTree& tree = MetaData::tree();
|
||||
|
||||
for (const auto& key : keyList) {
|
||||
const auto& paramInfo = MetaData::registry().at(key);
|
||||
const std::string& defaultValue = paramInfo.defaultValue;
|
||||
std::string value = defaultValue;
|
||||
if (tree.hasKey(key))
|
||||
value = tree.get(key, "");
|
||||
os << key << "=\"" << value << "\"";
|
||||
if (printDefaults)
|
||||
os << " # default: \"" << defaultValue << "\"";
|
||||
os << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void printUsage(const std::string& helpPreamble,
|
||||
const std::string& errorMsg,
|
||||
std::ostream& os,
|
||||
|
||||
@@ -175,11 +175,6 @@ std::string breakLines(const std::string& msg,
|
||||
|
||||
int getTtyWidth();
|
||||
|
||||
// print the values of a list of parameters
|
||||
void printParamList(std::ostream& os,
|
||||
const std::list<std::string>& keyList,
|
||||
bool printDefaults = false);
|
||||
|
||||
//! \endcond
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user