Mantid
Loading...
Searching...
No Matches
DiffSphere.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
13
14#include <boost/math/special_functions/bessel.hpp>
15
16#include <cmath>
17#include <limits>
18
19namespace {
20Mantid::Kernel::Logger g_log("DiffSphere");
21}
22
24
25DECLARE_FUNCTION(DiffSphere)
26
27
33void DiffSphere::trickleDownAttribute(const std::string &name) {
34 for (size_t iFun = 0; iFun < this->nFunctions(); iFun++) {
35 API::IFunction_sptr fun = this->getFunction(iFun);
36 if (fun->hasAttribute(name)) {
37 fun->setAttribute(name, this->getAttribute(name));
38 }
39 }
40}
41
45void DiffSphere::declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue) {
47 this->trickleDownAttribute(name);
48}
49
59
64 m_elastic = std::dynamic_pointer_cast<ElasticDiffSphere>(
65 API::FunctionFactory::Instance().createFunction("ElasticDiffSphere"));
67 m_inelastic = std::dynamic_pointer_cast<InelasticDiffSphere>(
68 API::FunctionFactory::Instance().createFunction("InelasticDiffSphere"));
70
71 this->setAttributeValue("NumDeriv", true);
73
74 // Set the ties between Elastic and Inelastic parameters
75 this->addDefaultTies("f0.Height=f1.Intensity,f0.Radius=f1.Radius,f0.Centre=0");
76 this->applyTies();
77}
78
79} // namespace Mantid::CurveFitting::Functions
std::string name
Definition Run.cpp:60
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Declare a single attribute.
void setAttribute(const std::string &name, const API::IFunction::Attribute &value) override
Set a value of a named attribute.
void applyTies() override
Apply the ties.
Attribute is a non-fitting parameter.
Definition IFunction.h:285
void setAttributeValue(const std::string &attName, const T &value)
Set an attribute value.
Definition IFunction.h:601
void addDefaultTies(const std::string &ties)
Add default ties.
void addFunction(IFunction *fun)
Overload addFunction to take a bare pointer.
std::shared_ptr< Mantid::CurveFitting::Functions::ElasticDiffSphere > m_elastic
Definition DiffSphere.h:48
virtual void trickleDownAttribute(const std::string &name)
Propagate an attribute to member functions.
std::string name() const override
overwrite IFunction base class methods
Definition DiffSphere.h:26
virtual void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Override parent definition.
void init() override
overwrite IFunction base class method, which declare function parameters
std::shared_ptr< Mantid::CurveFitting::Functions::InelasticDiffSphere > m_inelastic
Definition DiffSphere.h:50
void setAttribute(const std::string &name, const API::IFunction::Attribute &att) override
Override parent definition.
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition Logger.h:51
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition IFunction.h:743
Kernel::Logger g_log("DetermineSpinStateOrder")
STL namespace.