Skip to content
Snippets Groups Projects
Commit c4536e80 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Merge commit '02188c06' into develop

parents 666640b1 02188c06
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ RealParameter* ParameterPool::getParameter(const std::string& name) ...@@ -110,7 +110,7 @@ RealParameter* ParameterPool::getParameter(const std::string& name)
"ParameterPool::getParameter() -> Warning. No parameter with name '"+name+"'"); "ParameterPool::getParameter() -> Warning. No parameter with name '"+name+"'");
} }
//! Returns vector of parameters that match the _pattern_ (wildcards '*' allowed). //! Returns nonempty vector of parameters that match the _pattern_ ('*' allowed), or throws.
std::vector<RealParameter*> ParameterPool::getMatchedParameters(const std::string& pattern) const std::vector<RealParameter*> ParameterPool::getMatchedParameters(const std::string& pattern) const
{ {
...@@ -143,19 +143,15 @@ void ParameterPool::setParameterValue(const std::string& name, double value) ...@@ -143,19 +143,15 @@ void ParameterPool::setParameterValue(const std::string& name, double value)
int ParameterPool::setMatchedParametersValue(const std::string& pattern, double value) int ParameterPool::setMatchedParametersValue(const std::string& pattern, double value)
{ {
int npars(0); int npars = 0;
for (auto* par: m_params) { for (RealParameter* par: getMatchedParameters(pattern)) {
if( Utils::String::matchesPattern( par->getName(), pattern ) ) { try {
try { par->setValue(value);
par->setValue(value); npars++;
npars++; } catch(std::runtime_error) {
} catch(std::runtime_error) { report_set_value_error(par->getName(), value);
report_set_value_error(par->getName(), value);
}
} }
} }
if(npars == 0)
report_find_matched_parameters_error(pattern);
return npars; return npars;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment