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 "MantidKernel/Logger.h"
14#include <boost/math/special_functions/bessel.hpp>
15#include <cmath>
16#include <limits>
17
21
22namespace {
23Mantid::Kernel::Logger g_log("IsoRotDiff");
24}
25
27
28DECLARE_FUNCTION(IsoRotDiff)
29
30
36void IsoRotDiff::trickleDownAttribute(const std::string &name) {
37 for (size_t iFun = 0; iFun < this->nFunctions(); iFun++) {
38 auto fun = this->getFunction(iFun);
39 if (fun->hasAttribute(name)) {
40 fun->setAttribute(name, this->getAttribute(name));
41 }
42 }
43}
44
48void IsoRotDiff::declareAttribute(const std::string &name, const Attribute &defaultValue) {
49 ImmutableCompositeFunction::declareAttribute(name, defaultValue);
50 this->trickleDownAttribute(name);
51}
52
58void IsoRotDiff::setAttribute(const std::string &name, const Attribute &att) {
59 ImmutableCompositeFunction::setAttribute(name, att);
60 this->trickleDownAttribute(name);
61}
62
67 m_elastic = std::dynamic_pointer_cast<ElasticIsoRotDiff>(
68 API::FunctionFactory::Instance().createFunction("ElasticIsoRotDiff"));
70 m_inelastic = std::dynamic_pointer_cast<InelasticIsoRotDiff>(
71 API::FunctionFactory::Instance().createFunction("InelasticIsoRotDiff"));
73
76
77 // Set the ties between Elastic and Inelastic parameters
78 this->addDefaultTies("f1.Height=f0.Height,f1.Radius=f0.Radius,f1.Centre=f0.Centre");
79 this->applyTies();
80}
81
82} // 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:286
This is an interface to a fitting function - a semi-abstarct class.
Definition IFunction.h:167
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.