15using namespace Kernel;
45 m_source->setParameterDescription(i, description);
119 return m_source->parameterDescription(i);
129 return m_source->isExplicitlySet(i);
171 m_source->setParameterStatus(i, status);
181 return m_source->getParameterStatus(i);
210 const std::string & ) {
231 return m_source->getAttribute(attName);
234 return m_target->getAttribute(attName);
245 m_source->setAttribute(attName, att);
249 m_target->setAttribute(attName, att);
259 return m_source->hasAttribute(attName);
262 return m_target->hasAttribute(attName);
281 throw(std::runtime_error(
"Attribute index out of range"));
289 throw std::logic_error(
"FunctionGenerator failed to generate target function.");
298 throw std::invalid_argument(
"Parameter or attribute name cannot be empty string.");
300 return (aName.front() !=
'f' || aName.find(
'.') == std::string::npos);
309 throw std::logic_error(
"FunctionGenerator failed to generate target function.");
331 if (constraint ==
nullptr) {
333 constraint =
m_source->getConstraint(i);
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
Base class that represents the domain of a function.
ParameterTie * getTie(size_t i) const override
Get the tie for i-th parameter.
IFunction_sptr m_source
Function that calculates parameters of the target function.
IConstraint * getConstraint(size_t i) const override
Get the i-th constraint.
size_t parameterIndex(const std::string &name) const override
Returns the index of parameter name.
void setError(size_t i, double err) override
Set the fitting error for a parameter.
void init() override
overwrite IFunction base class method, which declare function parameters
double getParameter(size_t i) const override
Get i-th parameter.
void function(const FunctionDomain &domain, FunctionValues &values) const override
Evaluate the function.
virtual bool isSourceName(const std::string &aName) const
Test if a name (parameter's or attribute's) belongs to m_source.
void setParameter(size_t, const double &value, bool explicitlySet=true) override
Set i-th parameter.
void setParameterStatus(size_t i, ParameterStatus status) override
Change status of parameter.
void setAttribute(const std::string &name, const Attribute &) override
Set a value to attribute attName.
void declareParameter(const std::string &name, double initValue=0, const std::string &description="") override
Declare a new parameter.
std::vector< std::string > getAttributeNames() const override
Returns a list of attribute names.
bool hasAttribute(const std::string &name) const override
Check if attribute attName exists.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
bool isExplicitlySet(size_t i) const override
Checks if a parameter has been set explicitly.
size_t nParams() const override
Total number of parameters.
IFunction_sptr m_target
Function that actually calculates the output.
virtual void updateTargetFunction() const =0
Update target function.
bool m_dirty
Flag indicating that updateTargetFunction() is required.
void setUpForFit() override
Set up the function for a fit.
void checkTargetFunction() const
Update target function if necessary.
double getError(size_t i) const override
Get the fitting error for a parameter.
size_t getParameterIndex(const ParameterReference &ref) const override
Return parameter index from a parameter reference.
void setSource(IFunction_sptr source) const
Set the source function.
size_t nAttributes() const override
Returns the number of attributes associated with the function.
std::string parameterDescription(size_t i) const override
Returns the description of parameter i.
bool hasParameter(const std::string &name) const override
Check if function has a parameter with this name.
Attribute getAttribute(const std::string &name) const override
Return a value of attribute attName.
size_t m_nOwnParams
Cached number of parameters in m_source.
void setParameterDescription(size_t, const std::string &description) override
Set i-th parameter description.
ParameterStatus getParameterStatus(size_t i) const override
Get status of parameter.
std::string attributeName(size_t i) const override
Return the name of the ith attribute.
A class to store values calculated by a function.
An interface to a constraint.
Attribute is a non-fitting parameter.
virtual Attribute getAttribute(const std::string &name) const
Return a value of attribute attName.
void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Declare a single attribute.
ParameterStatus
Describe parameter status in relation to fitting: Active: Fit varies such parameter directly.
virtual void tie(const std::string &parName, const std::string &expr, bool isDefault=false)
Tie a parameter to other parameters (or a constant)
virtual ParameterTie * getTie(size_t i) const
Get the tie of i-th parameter.
virtual void setAttribute(const std::string &name, const Attribute &)
Set a value to attribute attName.
friend class FunctionGenerator
virtual void setUpForFit()
Set up the function for a fit.
virtual std::vector< std::string > getAttributeNames() const
Returns a list of attribute names.
virtual std::string attributeName(size_t index) const
Get name of ith attribute.
virtual std::string name() const =0
Returns the function's name.
virtual bool hasAttribute(const std::string &name) const
Check if attribute attName exists.
virtual size_t nAttributes() const
Returns the number of attributes associated with the function.
virtual IConstraint * getConstraint(size_t i) const
Get constraint of i-th parameter.
A reference to a parameter in a function.
std::size_t getLocalIndex() const
Return parameter index in the local function.
IFunction * getLocalFunction() const
Return pointer to the local function.
Marks code as not implemented yet.
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class