Mantid
Loading...
Searching...
No Matches
FunctionModel.h
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#pragma once
8
9#include "DllOption.h"
10
11#include "IFunctionModel.h"
12#include "MantidAPI/IFunction.h"
14
15#include <QString>
16#include <QStringList>
17
18namespace MantidQt {
19namespace MantidWidgets {
20
21using namespace Mantid::API;
22
24public:
25 void setFunction(IFunction_sptr) override;
26 IFunction_sptr getFitFunction() const override;
27 bool hasFunction() const override;
28 void addFunction(const QString &prefix, const QString &funStr) override;
29 void removeFunction(const QString &functionIndex) override;
30 void setParameter(const QString &paramName, double value) override;
31 void setAttribute(const QString &attrName, const IFunction::Attribute &val);
32 void setParameterError(const QString &paramName, double value) override;
33 double getParameter(const QString &paramName) const override;
34 double getParameterError(const QString &paramName) const override;
35 IFunction::Attribute getAttribute(const QString &attrName) const;
36 QString getParameterDescription(const QString &paramName) const override;
37 bool isParameterFixed(const QString &parName) const;
38 QString getParameterTie(const QString &parName) const;
39 void setParameterFixed(const QString &parName, bool fixed);
40 void setParameterTie(const QString &parName, const QString &tie);
41 QStringList getParameterNames() const override;
42 QStringList getAttributeNames() const;
43 IFunction_sptr getSingleFunction(int index) const override;
44 IFunction_sptr getCurrentFunction() const override;
45 void setNumberDomains(int) override;
46 void setDatasets(const QStringList &datasetNames);
47 void setDatasets(const QList<FunctionModelDataset> &datasets) override;
48 void addDatasets(const QStringList &datasetNames);
49 void removeDatasets(QList<int> &indices);
50 QStringList getDatasetNames() const override;
51 QStringList getDatasetDomainNames() const override;
52 int getNumberDomains() const override;
53 int currentDomainIndex() const override;
54 void setCurrentDomainIndex(int) override;
55 double getLocalParameterValue(const QString &parName, int i) const override;
56 bool isLocalParameterFixed(const QString &parName, int i) const override;
57 QString getLocalParameterTie(const QString &parName, int i) const override;
58 QString getLocalParameterConstraint(const QString &parName, int i) const override;
59 void setLocalParameterValue(const QString &parName, int i, double value) override;
60 void setLocalParameterValue(const QString &parName, int i, double value, double error) override;
61 void setLocalParameterFixed(const QString &parName, int i, bool fixed) override;
62 void setLocalParameterTie(const QString &parName, int i, const QString &tie) override;
63 void setLocalParameterConstraint(const QString &parName, int i, const QString &constraint) override;
64 void setGlobalParameterValue(const QString &paramName, double value) override;
65 void changeTie(const QString &parName, const QString &tie) override;
66 void addConstraint(const QString &functionIndex, const QString &constraint) override;
67 void removeConstraint(const QString &paramName) override;
68 QStringList getGlobalParameters() const override;
69 void setGlobalParameters(const QStringList &globals) override;
70 bool isGlobal(const QString &parName) const override;
71 QStringList getLocalParameters() const override;
72 void updateMultiDatasetParameters(const IFunction &fun) override;
73 void updateMultiDatasetAttributes(const IFunction &fun);
74 void updateParameters(const IFunction &fun) override;
75 QString setBackgroundA0(double value) override;
76
77protected:
78 size_t m_numberDomains = 0;
80
81private:
82 IFunction_sptr getFitFunctionWithGlobals(std::size_t const &index) const;
83
84 void checkDatasets();
85 void checkNumberOfDomains(const QList<FunctionModelDataset> &datasets) const;
86 int numberOfDomains(const QList<FunctionModelDataset> &datasets) const;
87 void checkIndex(int) const;
88 void updateGlobals();
89 void setResolutionFromWorkspace(const IFunction_sptr &fun);
90 void setResolutionFromWorkspace(const IFunction_sptr &fun, const MatrixWorkspace_sptr &workspace);
91 size_t m_currentDomainIndex = 0;
92 // The datasets being fitted. A list of workspace names paired to lists of
93 // spectra.
95 mutable QStringList m_globalParameterNames;
96};
97
98} // namespace MantidWidgets
99} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
double value
The value of the point.
Definition: FitMW.cpp:51
double error
Definition: IndexPeaks.cpp:133
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
MultiDomainFunction_sptr m_function
Definition: FunctionModel.h:79
QList< FunctionModelDataset > m_datasets
Definition: FunctionModel.h:94
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
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< MultiDomainFunction > MultiDomainFunction_sptr
Shared pointer to Mantid::API::MultiDomainFunction.
Definition: IFunction_fwd.h:35
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class