14#include <unordered_map>
17namespace CurveFitting {
25 std::string
name()
const override {
return "CrystalFieldFunction"; }
26 size_t getNumberDomains()
const override;
27 std::vector<API::IFunction_sptr> createEquivalentFunctions()
const override;
34 void setParameter(
size_t,
const double &
value,
bool explicitlySet =
true)
override;
36 void setParameterDescription(
size_t,
const std::string &description)
override;
38 double getParameter(
size_t i)
const override;
40 void setParameter(
const std::string &
name,
const double &
value,
bool explicitlySet =
true)
override;
42 void setParameterDescription(
const std::string &
name,
const std::string &description)
override;
44 double getParameter(
const std::string &
name)
const override;
46 bool hasParameter(
const std::string &
name)
const override;
48 size_t nParams()
const override;
50 size_t parameterIndex(
const std::string &
name)
const override;
52 std::string parameterName(
size_t i)
const override;
54 std::string parameterDescription(
size_t i)
const override;
56 bool isExplicitlySet(
size_t i)
const override;
58 double getError(
size_t i)
const override;
60 double getError(
const std::string &
name)
const override;
62 void setError(
size_t i,
double err)
override;
64 void setError(
const std::string &
name,
double err)
override;
69 void setUpForFit()
override;
81 size_t nAttributes()
const override;
83 std::vector<std::string> getAttributeNames()
const override;
85 Attribute getAttribute(
const std::string &
name)
const override;
87 void setAttribute(
const std::string &
name,
const Attribute &)
override;
89 bool hasAttribute(
const std::string &
name)
const override;
96 bool isMultiSite()
const;
99 bool isMultiSpectrum()
const;
101 bool hasBackground()
const;
103 bool hasPeaks()
const;
105 bool hasPhysProperties()
const;
109 void checkSourceFunction()
const;
111 void buildTargetFunction()
const;
117 void declareParameter(
const std::string &
name,
double initValue = 0,
const std::string &description =
"")
override;
119 void setParameterStatus(
size_t i, ParameterStatus status)
override;
121 ParameterStatus getParameterStatus(
size_t i)
const override;
124 void buildSourceFunction()
const;
126 void updateTargetFunction()
const;
130 void buildSingleSite()
const;
132 void buildMultiSite()
const;
134 void buildSingleSiteSingleSpectrum()
const;
136 void buildSingleSiteMultiSpectrum()
const;
138 void buildMultiSiteSingleSpectrum()
const;
140 void buildMultiSiteMultiSpectrum()
const;
143 void updateSingleSite()
const;
145 void updateMultiSite()
const;
147 void updateSingleSiteSingleSpectrum()
const;
149 void updateSingleSiteMultiSpectrum()
const;
151 void updateMultiSiteSingleSpectrum()
const;
153 void updateMultiSiteMultiSpectrum()
const;
157 double temperature,
double fwhm,
size_t i,
bool addBackground,
158 double intensityScaling)
const;
161 double temperature,
double fwhm,
size_t iSpec,
size_t iFirst,
double intensityScaling)
const;
175 void checkTargetFunction()
const;
180 std::pair<API::IFunction *, std::string> getAttributeReference(
const std::string &attName)
const;
182 void buildAttributeNames()
const;
185 void makeMaps()
const;
186 void makeMapsSingleSiteSingleSpectrum()
const;
187 void makeMapsSingleSiteMultiSpectrum()
const;
188 void makeMapsMultiSiteSingleSpectrum()
const;
189 void makeMapsMultiSiteMultiSpectrum()
const;
190 size_t makeMapsForFunction(
const IFunction &fun,
size_t iFirst,
const std::string &prefix)
const;
191 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.
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.