Mantid
Loading...
Searching...
No Matches
UserFunctionMD.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//----------------------------------------------------------------------
15#include "MantidMDAlgorithms/DllConfig.h"
16
17namespace Mantid {
18namespace MDAlgorithms {
26class MANTID_MDALGORITHMS_DLL UserFunctionMD : virtual public API::IFunctionMD, virtual public API::ParamFunction {
27public:
29 std::string name() const override { return "UserFunctionMD"; }
30
31 std::vector<std::string> getAttributeNames() const override;
32 bool hasAttribute(const std::string &attName) const override;
33 Attribute getAttribute(const std::string &attName) const override;
34 void setAttribute(const std::string &attName, const Attribute &attr) override;
39 void initDimensions() override;
40
41protected:
46 double functionMD(const API::IMDIterator &r) const override;
52 static double *AddVariable(const char *varName, void *pufun);
53
57 void setFormula();
58
59private:
61 mu::Parser m_parser;
63 mutable std::vector<double> m_vars;
64 std::vector<std::string> m_varNames;
65 std::string m_formula;
66};
67
68} // namespace MDAlgorithms
69} // namespace Mantid
This is a specialization of IFunction for functions defined on an IMDWorkspace.
Definition: IFunctionMD.h:50
Attribute is a non-fitting parameter.
Definition: IFunction.h:282
This is an interface to an iterator of an IMDWorkspace.
Definition: IMDIterator.h:39
Implements the part of IFunction interface dealing with parameters.
Definition: ParamFunction.h:33
std::string name() const override
Returns the function's name.
std::vector< std::string > m_varNames
mu::Parser m_parser
Expression parser.
Helper class which provides the Collimation Length for SANS instruments.