Mantid
Loading...
Searching...
No Matches
IFunctionModel.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2019 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
13
14#include <QList>
15#include <QPair>
16#include <QString>
17#include <QStringList>
18
19namespace MantidQt {
20namespace MantidWidgets {
21
22using namespace Mantid::API;
23
25public:
26 virtual ~IFunctionModel() = default;
27 void setFunctionString(const QString &funStr);
28 QString getFunctionString() const;
29 QString getFitFunctionString() const;
30 void clear();
31 int getNumberLocalFunctions() const;
32 virtual void setFunction(IFunction_sptr fun) = 0;
33 virtual IFunction_sptr getFitFunction() const = 0;
34 virtual bool hasFunction() const = 0;
35 virtual void addFunction(const QString &prefix, const QString &funStr) = 0;
36 virtual void removeFunction(const QString &functionIndex) = 0;
37 virtual void setParameter(const QString &paramName, double value) = 0;
38 virtual void setParameterError(const QString &paramName, double value) = 0;
39 virtual double getParameter(const QString &paramName) const = 0;
40 virtual double getParameterError(const QString &paramName) const = 0;
41 virtual QString getParameterDescription(const QString &paramName) const = 0;
42 virtual QStringList getParameterNames() const = 0;
43 virtual IFunction_sptr getSingleFunction(int index) const = 0;
45 virtual void setNumberDomains(int) = 0;
46 virtual void setDatasets(const QList<FunctionModelDataset> &datasets) = 0;
47 virtual QStringList getDatasetNames() const = 0;
48 virtual QStringList getDatasetDomainNames() const = 0;
49 virtual int getNumberDomains() const = 0;
50 virtual int currentDomainIndex() const = 0;
51 virtual void setCurrentDomainIndex(int) = 0;
52 virtual void changeTie(const QString &paramName, const QString &tie) = 0;
53 virtual void addConstraint(const QString &functionIndex, const QString &constraint) = 0;
54 virtual void removeConstraint(const QString &paramName) = 0;
55 virtual QStringList getGlobalParameters() const = 0;
56 virtual void setGlobalParameters(const QStringList &globals) = 0;
57 virtual bool isGlobal(const QString &parName) const = 0;
58 virtual QStringList getLocalParameters() const = 0;
59 virtual void updateMultiDatasetParameters(const IFunction &fun) = 0;
60 virtual void updateParameters(const IFunction &fun) = 0;
61 virtual double getLocalParameterValue(const QString &parName, int i) const = 0;
62 virtual bool isLocalParameterFixed(const QString &parName, int i) const = 0;
63 virtual QString getLocalParameterTie(const QString &parName, int i) const = 0;
64 virtual QString getLocalParameterConstraint(const QString &parName, int i) const = 0;
65 virtual void setLocalParameterValue(const QString &parName, int i, double value) = 0;
66 virtual void setLocalParameterValue(const QString &parName, int i, double value, double error) = 0;
67 virtual void setLocalParameterFixed(const QString &parName, int i, bool fixed) = 0;
68 virtual void setLocalParameterTie(const QString &parName, int i, const QString &tie) = 0;
69 virtual void setLocalParameterConstraint(const QString &parName, int i, const QString &constraint) = 0;
70 virtual void setGlobalParameterValue(const QString &paramName, double value) = 0;
71 virtual QString setBackgroundA0(double value) = 0;
72
73protected:
74 static void copyParametersAndErrors(const IFunction &funFrom, IFunction &funTo);
75 void copyParametersAndErrorsToAllLocalFunctions(const IFunction &fun);
76};
77
78} // namespace MantidWidgets
79} // 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
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
virtual int getNumberDomains() const =0
virtual double getLocalParameterValue(const QString &parName, int i) const =0
virtual void setLocalParameterValue(const QString &parName, int i, double value, double error)=0
virtual bool hasFunction() const =0
virtual void addFunction(const QString &prefix, const QString &funStr)=0
virtual QString getLocalParameterConstraint(const QString &parName, int i) const =0
virtual void setGlobalParameterValue(const QString &paramName, double value)=0
virtual void updateMultiDatasetParameters(const IFunction &fun)=0
virtual IFunction_sptr getCurrentFunction() const =0
virtual int currentDomainIndex() const =0
virtual void changeTie(const QString &paramName, const QString &tie)=0
virtual QStringList getParameterNames() const =0
virtual void setDatasets(const QList< FunctionModelDataset > &datasets)=0
virtual void addConstraint(const QString &functionIndex, const QString &constraint)=0
virtual void setGlobalParameters(const QStringList &globals)=0
virtual void setFunction(IFunction_sptr fun)=0
virtual IFunction_sptr getSingleFunction(int index) const =0
virtual QString getParameterDescription(const QString &paramName) const =0
virtual void setParameterError(const QString &paramName, double value)=0
virtual void setLocalParameterFixed(const QString &parName, int i, bool fixed)=0
virtual void setLocalParameterConstraint(const QString &parName, int i, const QString &constraint)=0
virtual double getParameter(const QString &paramName) const =0
virtual bool isGlobal(const QString &parName) const =0
virtual void setLocalParameterValue(const QString &parName, int i, double value)=0
virtual void removeFunction(const QString &functionIndex)=0
virtual QStringList getDatasetNames() const =0
virtual void updateParameters(const IFunction &fun)=0
virtual double getParameterError(const QString &paramName) const =0
virtual QString getLocalParameterTie(const QString &parName, int i) const =0
virtual bool isLocalParameterFixed(const QString &parName, int i) const =0
virtual QString setBackgroundA0(double value)=0
virtual QStringList getLocalParameters() const =0
virtual void setLocalParameterTie(const QString &parName, int i, const QString &tie)=0
virtual void removeConstraint(const QString &paramName)=0
virtual IFunction_sptr getFitFunction() const =0
virtual QStringList getGlobalParameters() const =0
virtual void setParameter(const QString &paramName, double value)=0
virtual QStringList getDatasetDomainNames() const =0
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< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732