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

Functions

bool isAngleRelated (const std::string &par_name)
 
std::string poolParameterUnits (const IParameterized &node, const std::string &parName)
 

Function Documentation

◆ isAngleRelated()

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

Returns true if given parameter name is related to angles.

Definition at line 32 of file ParameterUtils.cpp.

33 {
34  static std::vector<std::string> angleRelated = angleRelatedParameters();
35 
36  for (const auto& par : angleRelated) {
37  if (par_name.find(par) != std::string::npos)
38  return true;
39  }
40  return false;
41 }
std::vector< std::string > angleRelatedParameters()
Returns list of all angle related parameters used in Core library.

References anonymous_namespace{ParameterUtils.cpp}::angleRelatedParameters().

Here is the call graph for this function:

◆ poolParameterUnits()

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

Returns units of main parameter.

Definition at line 43 of file ParameterUtils.cpp.

45 {
46  std::unique_ptr<ParameterPool> pool{node.createParameterTree()};
47  return pool->getUniqueMatch(parName)->unit();
48 }
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 IParameterized::createParameterTree(), ParameterPool::getUniqueMatch(), and RealParameter::unit().

Referenced by SimulationToPython::defineParameterDistributions(), and ParticleDistribution::mainUnits().

Here is the call graph for this function: