Mantid
Loading...
Searching...
No Matches
PeakFunctionIntegrator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 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#include "MantidAPI/DllConfig.h"
11#include "gsl/gsl_integration.h"
12
13namespace Mantid {
14namespace API {
15
28struct MANTID_API_DLL IntegrationResult {
29 double result; // integrated intensity
30 double error; // error in result due to numerical errors in the integration algorithm
31 size_t intervals; // number of bins in which the integration range is divided
32
34 bool success;
35};
36
37class MANTID_API_DLL PeakFunctionIntegrator {
38public:
39 PeakFunctionIntegrator(double requiredRelativePrecision = 1e-8);
41
42 void setRequiredRelativePrecision(double newPrecision);
43 double requiredRelativePrecision() const;
44
45 IntegrationResult integrateInfinity(const IPeakFunction &peakFunction) const;
46 IntegrationResult integratePositiveInfinity(const IPeakFunction &peakFunction, double lowerLimit) const;
47 IntegrationResult integrateNegativeInfinity(const IPeakFunction &peakFunction, double upperLimit) const;
48
49 IntegrationResult integrate(const IPeakFunction &peakFunction, double lowerLimit, double upperLimit) const;
50 double integrateError(const IPeakFunction &peakFunction, double lowerLimit, double upperLimit) const;
51
52protected:
53 gsl_function getGSLFunction(const IPeakFunction &peakFunction) const;
54 gsl_integration_workspace *m_integrationWorkspace;
55
57};
58
59double MANTID_API_DLL gsl_peak_wrapper(double x, void *parameters);
60} // namespace API
61} // namespace Mantid
An interface to a peak function, which extend the interface of IFunctionWithLocation by adding method...
Definition: IPeakFunction.h:51
gsl_integration_workspace * m_integrationWorkspace
double MANTID_API_DLL gsl_peak_wrapper(double x, void *parameters)
Helper class which provides the Collimation Length for SANS instruments.