BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Public Member Functions | |
ParameterPool () | |
virtual | ~ParameterPool () |
ParameterPool * | clone () const |
void | copyToExternalPool (const std::string &prefix, ParameterPool *other_pool) const |
void | clear () |
size_t | size () const |
bool | empty () const |
RealParameter & | addParameter (RealParameter *newPar) |
RealParameter * | parameter (const std::string &name) |
const RealParameter * | parameter (const std::string &name) const |
const std::vector< RealParameter * > | parameters () const |
std::vector< RealParameter * > | getMatchedParameters (const std::string &pattern) const |
RealParameter * | getUniqueMatch (const std::string &pattern) const |
void | setParameterValue (const std::string &name, double value) |
int | setMatchedParametersValue (const std::string &wildcards, double value) |
void | setUniqueMatchValue (const std::string &pattern, double value) |
std::vector< std::string > | parameterNames () const |
void | removeParameter (const std::string &name) |
const RealParameter * | operator[] (size_t index) const |
RealParameter * | operator[] (size_t index) |
virtual void | transferToCPP () |
Private Member Functions | |
virtual void | print (std::ostream &ostr) const |
void | report_find_matched_parameters_error (const std::string &pattern) const |
void | report_set_value_error (const std::string &parname, double value, std::string message={}) const |
size_t | check_index (size_t index) const |
Private Attributes | |
std::vector< RealParameter * > | m_params |
Friends | |
std::ostream & | operator<< (std::ostream &ostr, const ParameterPool &obj) |
Container with parameters for IParameterized object.
Definition at line 29 of file ParameterPool.h.
|
default |
Constructs an empty parameter pool.
Referenced by clone().
|
virtual |
Definition at line 29 of file ParameterPool.cpp.
References clear().
|
virtual |
Returns a literal clone.
Implements ICloneable.
Definition at line 36 of file ParameterPool.cpp.
References m_params, and ParameterPool().
void ParameterPool::copyToExternalPool | ( | const std::string & | prefix, |
ParameterPool * | other_pool | ||
) | const |
Copies parameters of given pool to other pool, prepeding prefix to the parameter names.
Definition at line 72 of file ParameterPool.cpp.
References addParameter(), RealParameter::clone(), and m_params.
Referenced by INode::createParameterTree().
void ParameterPool::clear | ( | ) |
Clears the parameter map.
Definition at line 46 of file ParameterPool.cpp.
References m_params.
Referenced by SampleBuilderNode::borrow_builder_parameters(), INode::INode(), SampleBuilderNode::reset(), and ~ParameterPool().
|
inline |
Returns number of parameters in the pool.
Definition at line 42 of file ParameterPool.h.
References m_params.
Referenced by empty().
|
inline |
Definition at line 43 of file ParameterPool.h.
References size().
Referenced by IParameterized::IParameterized().
RealParameter & ParameterPool::addParameter | ( | RealParameter * | newPar | ) |
Adds parameter to the pool, and returns reference to the input pointer.
Returning the input pointer allows us to concatenate function calls like pool->addParameter( new RealParameter(...) ).setLimits(-1,+1).setFixed().setUnit("nm")
Definition at line 58 of file ParameterPool.cpp.
References IParameter< T >::getName(), and m_params.
Referenced by copyToExternalPool().
RealParameter * ParameterPool::parameter | ( | const std::string & | name | ) |
Returns parameter with given name.
Definition at line 93 of file ParameterPool.cpp.
Referenced by removeParameter(), report_set_value_error(), and setParameterValue().
const RealParameter * ParameterPool::parameter | ( | const std::string & | name | ) | const |
Returns parameter with given name.
Definition at line 82 of file ParameterPool.cpp.
References m_params.
|
inline |
Returns full vector of parameters.
Definition at line 52 of file ParameterPool.h.
References m_params.
Referenced by pyfmt2::argumentList(), and anonymous_namespace{NodeUtils.cpp}::poolToString().
std::vector< RealParameter * > ParameterPool::getMatchedParameters | ( | const std::string & | pattern | ) | const |
Returns nonempty vector of parameters that match the pattern ('*' allowed), or throws.
Definition at line 100 of file ParameterPool.cpp.
References m_params, StringUtils::matchesPattern(), and report_find_matched_parameters_error().
Referenced by getUniqueMatch(), and setMatchedParametersValue().
RealParameter * ParameterPool::getUniqueMatch | ( | const std::string & | pattern | ) | const |
Returns the one parameter that matches the pattern (wildcards '*' allowed), or throws.
Definition at line 114 of file ParameterPool.cpp.
References getMatchedParameters().
Referenced by ParameterUtils::poolParameterUnits().
void ParameterPool::setParameterValue | ( | const std::string & | name, |
double | value | ||
) |
Sets parameter value.
Definition at line 128 of file ParameterPool.cpp.
References parameter(), and report_set_value_error().
int ParameterPool::setMatchedParametersValue | ( | const std::string & | wildcards, |
double | value | ||
) |
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.
Definition at line 147 of file ParameterPool.cpp.
References getMatchedParameters(), report_find_matched_parameters_error(), and report_set_value_error().
Referenced by DistributionHandler::setParameterToMeans(), IParameterized::setParameterValue(), DistributionHandler::setParameterValues(), and setUniqueMatchValue().
void ParameterPool::setUniqueMatchValue | ( | const std::string & | pattern, |
double | value | ||
) |
Sets value of the one parameter that matches pattern ('*' allowed), or throws.
Definition at line 165 of file ParameterPool.cpp.
References setMatchedParametersValue().
Referenced by ParticleDistribution::generateParticles().
std::vector< std::string > ParameterPool::parameterNames | ( | ) | const |
void ParameterPool::removeParameter | ( | const std::string & | name | ) |
Removes parameter with given name from the pool.
Definition at line 182 of file ParameterPool.cpp.
References m_params, and parameter().
const RealParameter * ParameterPool::operator[] | ( | size_t | index | ) | const |
Definition at line 190 of file ParameterPool.cpp.
References check_index(), and m_params.
RealParameter * ParameterPool::operator[] | ( | size_t | index | ) |
Definition at line 195 of file ParameterPool.cpp.
|
privatevirtual |
|
private |
reports error while finding parameters matching given name.
Definition at line 208 of file ParameterPool.cpp.
References m_params.
Referenced by getMatchedParameters(), and setMatchedParametersValue().
|
private |
Reports error while setting parname to given value.
Definition at line 220 of file ParameterPool.cpp.
References RealParameter::limits(), and parameter().
Referenced by setMatchedParametersValue(), and setParameterValue().
|
private |
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 34 of file ICloneable.h.
|
friend |
Definition at line 64 of file ParameterPool.h.
|
private |
Definition at line 84 of file ParameterPool.h.
Referenced by addParameter(), check_index(), clear(), clone(), copyToExternalPool(), getMatchedParameters(), operator[](), parameter(), parameterNames(), parameters(), print(), removeParameter(), report_find_matched_parameters_error(), and size().