Parameters::printParamList can now be an implementation detail

This commit is contained in:
Arne Morten Kvarving
2024-09-02 15:59:20 +02:00
parent faa963056d
commit 672de7665d
2 changed files with 19 additions and 24 deletions

View File

@@ -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,

View File

@@ -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
/*!