Mantid
Loading...
Searching...
No Matches
IPeakFunctionAdapter.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 +
9
10//-----------------------------------------------------------------------------
11// IPeakFunction definition
12//-----------------------------------------------------------------------------
14using namespace boost::python;
15
21 : IFunctionAdapter(self, "functionLocal", "functionDerivLocal") {}
22
23double IPeakFunctionAdapter::centre() const { return callMethodNoCheck<double>(getSelf(), "centre"); }
24
25double IPeakFunctionAdapter::height() const { return callMethodNoCheck<double>(getSelf(), "height"); }
26
31void IPeakFunctionAdapter::setCentre(const double c) { callMethodNoCheck<void, double>(getSelf(), "setCentre", c); }
32
37void IPeakFunctionAdapter::setHeight(const double h) { callMethodNoCheck<void, double>(getSelf(), "setHeight", h); }
38
40double IPeakFunctionAdapter::fwhm() const { return callMethodNoCheck<double>(getSelf(), "fwhm"); }
41
47void IPeakFunctionAdapter::setFwhm(const double w) { return callMethodNoCheck<void, double>(getSelf(), "setFwhm", w); }
48
56void IPeakFunctionAdapter::functionLocal(double *out, const double *xValues, const size_t nData) const {
57 evaluateFunction(out, xValues, nData);
58}
59
66object IPeakFunctionAdapter::functionLocal(const boost::python::object &xvals) const {
67 return callMethodNoCheck<object, object>(getSelf(), "functionLocal", xvals);
68}
69
78void IPeakFunctionAdapter::functionDerivLocal(API::Jacobian *jacobian, const double *xValues, const size_t nData) {
80 evaluateDerivative(jacobian, xValues, nData);
81 } else {
82 Base::functionDerivLocal(jacobian, xValues, nData);
83 }
84}
85
93void IPeakFunctionAdapter::functionDerivLocal(const boost::python::object &xvals, boost::python::object &jacobian) {
94 callMethodNoCheck<void, object, object>(getSelf(), "functionDerivLocal", xvals, jacobian);
95}
96} // namespace Mantid::PythonInterface
virtual void functionDerivLocal(Jacobian *jacobian, const double *xValues, const size_t nData)
Derivative evaluation method. Default is to calculate numerically.
Represents the Jacobian in IFitFunction::functionDeriv.
Definition: Jacobian.h:22
Provides a layer to hook into the protected functions of IFunction.
void evaluateFunction(double *out, const double *xValues, const size_t nData) const
Evaluate the function by calling the overridden method.
void evaluateDerivative(API::Jacobian *out, const double *xValues, const size_t nData) const
Evaluate the derivative by calling the overridden method.
void setCentre(const double c) override
Calls 'setCentre' method in Python.
void functionLocal(double *out, const double *xValues, const size_t nData) const override
Implemented Base-class method.
double height() const override
Calls 'height' method in Python.
void setHeight(const double h) override
Calls 'setHeight' method in Python.
double fwhm() const override
Calls Python fwhm method.
IPeakFunctionAdapter(PyObject *self)
A constructor that looks like a Python init method.
double centre() const override
Calls 'centre' method in Python.
void setFwhm(const double w) override
Called by framework when the width is changed.
void functionDerivLocal(API::Jacobian *jacobian, const double *xValues, const size_t nData) override
Implemented base-class method.