14#include <unordered_map>
17namespace CurveFitting {
25 std::string
name()
const override {
return "CrystalFieldFunction"; }
26 const std::string
category()
const override {
return "General"; }
27 size_t getNumberDomains()
const override;
28 std::vector<API::IFunction_sptr> createEquivalentFunctions()
const override;
35 void setParameter(
size_t,
const double &
value,
bool explicitlySet =
true)
override;
37 void setParameterDescription(
size_t,
const std::string &description)
override;
39 double getParameter(
size_t i)
const override;
41 void setParameter(
const std::string &name,
const double &
value,
bool explicitlySet =
true)
override;
43 void setParameterDescription(
const std::string &name,
const std::string &description)
override;
45 double getParameter(
const std::string &name)
const override;
47 bool hasParameter(
const std::string &name)
const override;
49 size_t nParams()
const override;
51 size_t parameterIndex(
const std::string &name)
const override;
53 std::string parameterName(
size_t i)
const override;
55 std::string parameterDescription(
size_t i)
const override;
57 bool isExplicitlySet(
size_t i)
const override;
59 double getError(
size_t i)
const override;
61 double getError(
const std::string &name)
const override;
63 void setError(
size_t i,
double err)
override;
65 void setError(
const std::string &name,
double err)
override;
70 void setUpForFit()
override;
82 size_t nAttributes()
const override;
84 std::vector<std::string> getAttributeNames()
const override;
86 Attribute getAttribute(
const std::string &name)
const override;
88 void setAttribute(
const std::string &name,
const Attribute &)
override;
90 bool hasAttribute(
const std::string &name)
const override;
97 bool isMultiSite()
const;
100 bool isMultiSpectrum()
const;
102 bool hasBackground()
const;
104 bool hasPeaks()
const;
106 bool hasPhysProperties()
const;
110 void checkSourceFunction()
const;
112 void buildTargetFunction()
const;
118 void declareParameter(
const std::string &name,
double initValue = 0,
const std::string &description =
"")
override;
120 void setParameterStatus(
size_t i, ParameterStatus status)
override;
122 ParameterStatus getParameterStatus(
size_t i)
const override;
125 void buildSourceFunction()
const;
127 void updateTargetFunction()
const;
131 void buildSingleSite()
const;
133 void buildMultiSite()
const;
135 void buildSingleSiteSingleSpectrum()
const;
137 void buildSingleSiteMultiSpectrum()
const;
139 void buildMultiSiteSingleSpectrum()
const;
141 void buildMultiSiteMultiSpectrum()
const;
144 void updateSingleSite()
const;
146 void updateMultiSite()
const;
148 void updateSingleSiteSingleSpectrum()
const;
150 void updateSingleSiteMultiSpectrum()
const;
152 void updateMultiSiteSingleSpectrum()
const;
154 void updateMultiSiteMultiSpectrum()
const;
158 double temperature,
double fwhm,
size_t i,
bool addBackground,
159 double intensityScaling)
const;
162 double temperature,
double fwhm,
size_t iSpec,
size_t iFirst,
double intensityScaling)
const;
176 void checkTargetFunction()
const;
181 std::pair<API::IFunction *, std::string> getAttributeReference(
const std::string &attName)
const;
183 void buildAttributeNames()
const;
186 void makeMaps()
const;
187 void makeMapsSingleSiteSingleSpectrum()
const;
188 void makeMapsSingleSiteMultiSpectrum()
const;
189 void makeMapsMultiSiteSingleSpectrum()
const;
190 void makeMapsMultiSiteMultiSpectrum()
const;
191 size_t makeMapsForFunction(
const IFunction &fun,
size_t iFirst,
const std::string &prefix)
const;
192 void cacheSourceParameters()
const;
double value
The value of the point.
A composite function is a function containing other functions.
Base class that represents the domain of a function.
A class to store values calculated by a function.
An interface to a constraint.
Attribute is a non-fitting parameter.
This is an interface to a fitting function - a semi-abstarct class.
A reference to a parameter in a function.
A function that controls creation of the source of CrystalFieldFunction.
Calculates crystal field spectra.
std::unordered_map< std::string, size_t > m_mapNames2Indices
Map parameter names to indices.
API::IFunction_sptr m_source
Function that calculates parameters of the target function.
bool m_dirtyTarget
Flag indicating that updateTargetFunction() is required.
std::vector< std::string > m_attributeNames
Attribute names.
std::vector< std::string > m_mapIndices2Names
Map parameter indices to names.
std::vector< double > m_parameterResetCache
Temporary cache for parameter values during source function resetting.
std::unordered_map< std::string, API::IFunction_sptr > m_mapPrefixes2PhysProps
Map parameter/attribute prefixes to pointers to phys prop functions.
const std::string category() const override
The categories the Fit function belong to.
std::vector< bool > m_fixResetCache
size_t m_nControlParams
Cached number of parameters in m_control.
CrystalFieldControl m_control
Function that creates the source function.
size_t m_nControlSourceParams
Cached number of parameters in m_control and m_source.
API::CompositeFunction_sptr m_target
Function that actually calculates the output.
std::string name() const override
Returns the function's name.
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
std::shared_ptr< CompositeFunction > CompositeFunction_sptr
shared pointer to the composite function base class
Helper class which provides the Collimation Length for SANS instruments.