BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParameterPool Class Reference

Container with parameters for IParametricComponent object. More...

+ Inheritance diagram for ParameterPool:

Public Member Functions

 ParameterPool ()
 Constructs an empty parameter pool.
 
RealParameteraddParameter (RealParameter *newPar)
 Adds parameter to the pool, and returns reference to the input pointer. More...
 
void clear ()
 Clears the parameter map.
 
ParameterPoolclone () const
 Returns a literal clone.
 
void copyToExternalPool (const std::string &prefix, ParameterPool *other_pool) const
 Copies parameters of given pool to other pool, prepeding prefix to the parameter names.
 
bool empty () const
 
std::vector< RealParameter * > getMatchedParameters (const std::string &pattern) const
 Returns nonempty vector of parameters that match the pattern ('*' allowed), or throws.
 
RealParametergetUniqueMatch (const std::string &pattern) const
 Returns the one parameter that matches the pattern (wildcards '*' allowed), or throws.
 
RealParameteroperator[] (size_t index)
 
const RealParameteroperator[] (size_t index) const
 
RealParameterparameter (const std::string &name)
 Returns parameter with given name.
 
const RealParameterparameter (const std::string &name) const
 Returns parameter with given name.
 
std::vector< std::string > parameterNames () const
 
const std::vector< RealParameter * > parameters () const
 Returns full vector of parameters.
 
void removeParameter (const std::string &name)
 Removes parameter with given name from the pool.
 
int setMatchedParametersValue (const std::string &wildcards, double value)
 Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.
 
void setParameterValue (const std::string &name, double value)
 Sets parameter value.
 
void setUniqueMatchValue (const std::string &pattern, double value)
 Sets value of the one parameter that matches pattern ('*' allowed), or throws.
 
size_t size () const
 Returns number of parameters in the pool.
 

Friends

std::ostream & operator<< (std::ostream &ostr, const ParameterPool &obj)
 

Detailed Description

Container with parameters for IParametricComponent object.

Member Function Documentation

◆ addParameter()

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")