Mantid
Loading...
Searching...
No Matches
IsoRotDiff.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#include <boost/math/special_functions/bessel.hpp>
14#include <cmath>
15#include <limits>
16
20
21namespace {
22Mantid::Kernel::Logger g_log("IsoRotDiff");
23}
24
26
27DECLARE_FUNCTION(IsoRotDiff)
28
29
35void IsoRotDiff::trickleDownAttribute(const std::string &name) {
36 for (size_t iFun = 0; iFun < this->nFunctions(); iFun++) {
37 auto fun = this->getFunction(iFun);
38 if (fun->hasAttribute(name)) {
39 fun->setAttribute(name, this->getAttribute(name));
40 }
41 }
42}
43
47void IsoRotDiff::declareAttribute(const std::string &name, const Attribute &defaultValue) {
48 ImmutableCompositeFunction::declareAttribute(name, defaultValue);
49 this->trickleDownAttribute(name);
50}
51
57void IsoRotDiff::setAttribute(const std::string &name, const Attribute &att) {
58 ImmutableCompositeFunction::setAttribute(name, att);
59 this->trickleDownAttribute(name);
60}
61
66 m_elastic = std::dynamic_pointer_cast<ElasticIsoRotDiff>(
67 API::FunctionFactory::Instance().createFunction("ElasticIsoRotDiff"));
69 m_inelastic = std::dynamic_pointer_cast<InelasticIsoRotDiff>(
70 API::FunctionFactory::Instance().createFunction("InelasticIsoRotDiff"));
72
75
76 // Set the ties between Elastic and Inelastic parameters
77 this->addDefaultTies("f1.Height=f0.Height,f1.Radius=f0.Radius,f1.Centre=f0.Centre");
78 this->applyTies();
79}
80
81} // 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 applyTies() override
Apply the ties.
Attribute is a non-fitting parameter.
Definition IFunction.h:285
This is an interface to a fitting function - a semi-abstarct class.
Definition IFunction.h:166
Immutable composite function is a composite function which members cannot be added or removed after c...
void addDefaultTies(const std::string &ties)
Add default ties.
void addFunction(IFunction *fun)
Overload addFunction to take a bare pointer.
void setAttribute(const std::string &name, const API::IFunction::Attribute &att) override
Override parent definition.
std::string name() const override
overwrite IFunction base class methods
Definition IsoRotDiff.h:27
std::shared_ptr< Mantid::CurveFitting::Functions::InelasticIsoRotDiff > m_inelastic
Definition IsoRotDiff.h:51
virtual void trickleDownAttribute(const std::string &name)
Propagate an attribute to member functions.
void init() override
overwrite IFunction base class method, which declare function parameters
virtual void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Override parent definition.
std::shared_ptr< Mantid::CurveFitting::Functions::ElasticIsoRotDiff > m_elastic
Definition IsoRotDiff.h:49
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition Logger.h:51
STL namespace.