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 "MantidKernel/System.h"
15#include <cmath>
16
17namespace Mantid {
18namespace CurveFitting {
19namespace Functions {
27class MANTID_CURVEFITTING_DLL DeltaFunction : public API::IPeakFunction {
28public:
31
33 double centre() const override { return getParameter("Centre"); }
34 double height() const override { return getParameter("Height"); }
35 double fwhm() const override { return 0; }
36 void setCentre(const double c) override { setParameter("Centre", c); }
37 void setHeight(const double h) override { setParameter("Height", h); }
38 void setFwhm(const double w) override { UNUSED_ARG(w); }
39 virtual double HeightPrefactor() const { return 1.0; } // modulates the Height of the Delta function
41 std::string name() const override { return "DeltaFunction"; }
42 const std::string category() const override { return "Peak"; }
43
44protected:
45 void function1D(double *out, const double *xValues, const size_t nData) const override;
46 void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override;
47 void functionLocal(double *out, const double *xValues, const size_t nData) const override {
48 UNUSED_ARG(out);
49 UNUSED_ARG(xValues);
50 UNUSED_ARG(nData);
51 }
52 void functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) override {
53 UNUSED_ARG(out);
54 UNUSED_ARG(xValues);
55 UNUSED_ARG(nData);
56 }
57};
58
59} // namespace Functions
60} // namespace CurveFitting
61} // namespace Mantid
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
An interface to a peak function, which extend the interface of IFunctionWithLocation by adding method...
Definition: IPeakFunction.h:51
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.
Definition: DeltaFunction.h:47
void functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) override
Derivative evaluation method. Default is to calculate numerically.
Definition: DeltaFunction.h:52
double height() const override
Returns the height of the function.
Definition: DeltaFunction.h:34
const std::string category() const override
The categories the Fit function belong to.
Definition: DeltaFunction.h:42
void setHeight(const double h) override
Sets the parameters such that height == h.
Definition: DeltaFunction.h:37
double fwhm() const override
Returns the peak FWHM.
Definition: DeltaFunction.h:35
std::string name() const override
overwrite IFunction base class methods
Definition: DeltaFunction.h:41
void setFwhm(const double w) override
Sets the parameters such that FWHM = w.
Definition: DeltaFunction.h:38
double centre() const override
overwrite IPeakFunction base class methods
Definition: DeltaFunction.h:33
void setCentre(const double c) override
Sets the parameters such that centre == c.
Definition: DeltaFunction.h:36
Helper class which provides the Collimation Length for SANS instruments.