BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParameterUtils Namespace Reference

Functions

bool isAngleRelated (const std::string &par_name)
 Returns true if given parameter name is related to angles. More...
 
std::string poolParameterUnits (const IParametricComponent &node, const std::string &parName)
 Returns units of main parameter. More...
 

Function Documentation

◆ isAngleRelated()

bool ParameterUtils::isAngleRelated ( const std::string &  par_name)

Returns true if given parameter name is related to angles.

Definition at line 31 of file ParameterUtils.cpp.

32 {
33  static std::vector<std::string> angleRelated = angleRelatedParameters();
34 
35  for (const auto& par : angleRelated) {
36  if (par_name.find(par) != std::string::npos)
37  return true;
38  }
39  return false;
40 }

Referenced by ParticleDistributionItem::createParticleDistribution().

◆ poolParameterUnits()

std::string ParameterUtils::poolParameterUnits ( const IParametricComponent node,
const std::string &  parName 
)

Returns units of main parameter.

Definition at line 42 of file ParameterUtils.cpp.

44 {
45  std::unique_ptr<ParameterPool> pool{node.createParameterTree()};
46  return pool->getUniqueMatch(parName)->unit();
47 }
virtual ParameterPool * createParameterTree() const
Creates new parameter pool, with all local parameters and those of its children.
RealParameter * getUniqueMatch(const std::string &pattern) const
Returns the one parameter that matches the pattern (wildcards '*' allowed), or throws.
std::string unit() const

References IParametricComponent::createParameterTree(), ParameterPool::getUniqueMatch(), and RealParameter::unit().

Referenced by ParticleDistribution::mainUnits().

Here is the call graph for this function: