Mantid
Loading...
Searching...
No Matches
FunctionParameterDecorator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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"
10#include "MantidAPI/IFunction.h"
11
12namespace Mantid {
13namespace API {
14
28class MANTID_API_DLL FunctionParameterDecorator : virtual public IFunction {
29public:
30 // MSVC 2015 segfaults without this default constructor.
31 // still segfaults with = default
32 FunctionParameterDecorator() : IFunction(), m_wrappedFunction() {}
33 void setDecoratedFunction(const std::string &wrappedFunctionName);
34 IFunction_sptr getDecoratedFunction() const;
35
36 IFunction_sptr clone() const override;
37
38 void setWorkspace(std::shared_ptr<const Workspace> ws) override;
39 void setMatrixWorkspace(std::shared_ptr<const MatrixWorkspace> workspace, size_t wi, double startX,
40 double endX) override;
41
43 void setParameter(size_t i, const double &value, bool explicitlySet = true) override;
45 void setParameterDescription(size_t i, const std::string &description) override;
47 double getParameter(size_t i) const override;
49 void setParameter(const std::string &name, const double &value, bool explicitlySet = true) override;
51 void setParameterDescription(const std::string &name, const std::string &description) override;
52
54 double activeParameter(size_t i) const override;
56 void setActiveParameter(size_t i, double value) override;
57
59 double getParameter(const std::string &name) const override;
61 bool hasParameter(const std::string &name) const override;
63 size_t nParams() const override;
65 size_t parameterIndex(const std::string &name) const override;
67 std::string parameterName(size_t i) const override;
69 std::string parameterDescription(size_t i) const override;
71 bool isExplicitlySet(size_t i) const override;
73 double getError(size_t i) const override;
75 double getError(const std::string &name) const override;
77 void setError(size_t i, double err) override;
79 void setError(const std::string &name, double err) override;
80
83 size_t getParameterIndex(const ParameterReference &ref) const override;
84
86 size_t nAttributes() const override;
88 std::vector<std::string> getAttributeNames() const override;
90 IFunction::Attribute getAttribute(const std::string &attName) const override;
92 void setAttribute(const std::string &attName, const IFunction::Attribute &attValue) override;
94 bool hasAttribute(const std::string &attName) const override;
95
97 void tie(const std::string &parName, const std::string &expr, bool isDefault = false) override;
99 void applyTies() override;
101 void clearTies() override;
102 void removeTie(const std::string &parName) override;
104 bool removeTie(size_t i) override;
106 ParameterTie *getTie(size_t i) const override;
107
109 void addConstraint(std::unique_ptr<IConstraint> ic) override;
111 IConstraint *getConstraint(size_t i) const override;
113 void removeConstraint(const std::string &parName) override;
115 void setUpForFit() override;
116
117protected:
119 void init() override {}
120
121 void throwIfNoFunctionSet() const;
122
123 void declareParameter(const std::string &name, double initValue, const std::string &description) override;
124
125 void addTie(std::unique_ptr<ParameterTie>) override;
126 void setParameterStatus(size_t i, ParameterStatus status) override;
127 ParameterStatus getParameterStatus(size_t i) const override;
128
129 virtual void beforeDecoratedFunctionSet(const IFunction_sptr &fn);
130 void setDecoratedFunctionPrivate(const IFunction_sptr &fn);
131
133};
134
135using FunctionParameterDecorator_sptr = std::shared_ptr<FunctionParameterDecorator>;
136
137} // namespace API
138} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
An interface to a constraint.
Definition: IConstraint.h:26
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
A reference to a parameter in a function.
Ties fitting parameters.
Definition: ParameterTie.h:35
std::shared_ptr< FunctionParameterDecorator > FunctionParameterDecorator_sptr
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
Helper class which provides the Collimation Length for SANS instruments.