Mantid
Loading...
Searching...
No Matches
DeltaFunction.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include "MantidCurveFitting/DllConfig.h"
14#include <cmath>
15
16namespace Mantid {
17namespace CurveFitting {
18namespace Functions {
26class MANTID_CURVEFITTING_DLL DeltaFunction : public API::IPeakFunction {
27public:
30
32 double centre() const override { return getParameter("Centre"); }
33 double height() const override { return getParameter("Height"); }
34 double fwhm() const override { return 0; }
35 void setCentre(const double c) override { setParameter("Centre", c); }
36 void setHeight(const double h) override { setParameter("Height", h); }
37 void setFwhm(const double w) override { UNUSED_ARG(w); }
38 virtual double HeightPrefactor() const { return 1.0; } // modulates the Height of the Delta function
40 std::string name() const override { return "DeltaFunction"; }
41 const std::string category() const override { return "Peak"; }
42
43protected:
44 void function1D(double *out, const double *xValues, const size_t nData) const override;
45 void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override;
46 void functionLocal(double *out, const double *xValues, const size_t nData) const override {
47 UNUSED_ARG(out);
48 UNUSED_ARG(xValues);
49 UNUSED_ARG(nData);
50 }
51 void functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) override {
52 UNUSED_ARG(out);
53 UNUSED_ARG(xValues);
54 UNUSED_ARG(nData);
55 }
56};
57
58} // namespace Functions
59} // namespace CurveFitting
60} // namespace Mantid
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition System.h:48
An interface to a peak function, which extend the interface of IFunctionWithLocation by adding method...
Represents the Jacobian in IFitFunction::functionDeriv.
Definition Jacobian.h:22
void functionLocal(double *out, const double *xValues, const size_t nData) const override
Function evaluation method to be implemented in the inherited classes.
void functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) override
Derivative evaluation method. Default is to calculate numerically.
double height() const override
Returns the height of the function.
const std::string category() const override
The categories the Fit function belong to.
void setHeight(const double h) override
Sets the parameters such that height == h.
double fwhm() const override
Returns the peak FWHM.
std::string name() const override
overwrite IFunction base class methods
void setFwhm(const double w) override
Sets the parameters such that FWHM = w.
double centre() const override
overwrite IPeakFunction base class methods
void setCentre(const double c) override
Sets the parameters such that centre == c.
Helper class which provides the Collimation Length for SANS instruments.