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 +
7// Mantid Coding standars <http://www.mantidproject.org/Coding_Standards>
8// Main Module Header
10// Mantid Headers from the same project
13// Mantid headers from other projects
15#include "MantidAPI/IFunction.h"
17// third party library headers (N/A)
18#include <boost/math/special_functions/bessel.hpp>
19// standard library headers (N/A)
20#include <cmath>
21#include <limits>
22
26
27namespace {
28Mantid::Kernel::Logger g_log("IsoRotDiff");
29}
30
32
33DECLARE_FUNCTION(IsoRotDiff)
34
35
41void IsoRotDiff::trickleDownAttribute(const std::string &name) {
42 for (size_t iFun = 0; iFun < this->nFunctions(); iFun++) {
43 auto fun = this->getFunction(iFun);
44 if (fun->hasAttribute(name)) {
45 fun->setAttribute(name, this->getAttribute(name));
46 }
47 }
48}
49
53void IsoRotDiff::declareAttribute(const std::string &name, const Attribute &defaultValue) {
54 ImmutableCompositeFunction::declareAttribute(name, defaultValue);
55 this->trickleDownAttribute(name);
56}
57
63void IsoRotDiff::setAttribute(const std::string &name, const Attribute &att) {
64 ImmutableCompositeFunction::setAttribute(name, att);
65 this->trickleDownAttribute(name);
66}
67
72 m_elastic = std::dynamic_pointer_cast<ElasticIsoRotDiff>(
73 API::FunctionFactory::Instance().createFunction("ElasticIsoRotDiff"));
75 m_inelastic = std::dynamic_pointer_cast<InelasticIsoRotDiff>(
76 API::FunctionFactory::Instance().createFunction("InelasticIsoRotDiff"));
78
81
82 // Set the ties between Elastic and Inelastic parameters
83 this->addDefaultTies("f1.Height=f0.Height,f1.Radius=f0.Radius,f1.Centre=f0.Centre");
84 this->applyTies();
85}
86
87} // namespace Mantid::CurveFitting::Functions
#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:282
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163
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.
Definition: IsoRotDiff.cpp:63
std::string name() const override
overwrite IFunction base class methods
Definition: IsoRotDiff.h:32
std::shared_ptr< Mantid::CurveFitting::Functions::InelasticIsoRotDiff > m_inelastic
Definition: IsoRotDiff.h:56
virtual void trickleDownAttribute(const std::string &name)
Propagate an attribute to member functions.
Definition: IsoRotDiff.cpp:41
void init() override
overwrite IFunction base class method, which declare function parameters
Definition: IsoRotDiff.cpp:71
virtual void declareAttribute(const std::string &name, const API::IFunction::Attribute &defaultValue)
Override parent definition.
Definition: IsoRotDiff.cpp:53
std::shared_ptr< Mantid::CurveFitting::Functions::ElasticIsoRotDiff > m_elastic
Definition: IsoRotDiff.h:54
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition: Logger.h:52
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
STL namespace.