Mantid
Loading...
Searching...
No Matches
IFunctionMD.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 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//----------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
14#include "MantidAPI/IFunction.h"
17#ifndef Q_MOC_RUN
18#include <boost/scoped_array.hpp>
19#include <boost/variant.hpp>
20#endif
21#include <memory>
22#include <string>
23#include <vector>
24
25namespace Mantid {
26
27namespace API {
28//----------------------------------------------------------------------
29// Forward declaration
30//----------------------------------------------------------------------
31class IMDWorkspace;
32class IMDIterator;
33class Jacobian;
34class ParameterTie;
35class IConstraint;
36class ParameterReference;
37class FunctionHandler;
38class FunctionDomainMD;
39
49class MANTID_API_DLL IFunctionMD : public virtual IFunction {
50public:
51 /* Overidden methods */
52
54 std::shared_ptr<IFunction> clone() const override;
56 void setWorkspace(std::shared_ptr<const Workspace> ws) override;
57
58 void function(const FunctionDomain &domain, FunctionValues &values) const override;
59 void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override { calNumericalDeriv(domain, jacobian); }
60
61protected:
63 void evaluateFunction(const FunctionDomainMD &domain, FunctionValues &values) const;
64
65 virtual void useDimension(const std::string &id);
67 virtual void initDimensions() {}
69 virtual double functionMD(const IMDIterator &r) const = 0;
70
72 std::map<std::string, size_t> m_dimensionIndexMap;
74 std::vector<std::shared_ptr<const Mantid::Geometry::IMDDimension>> m_dimensions;
75
76private:
78 virtual void useAllDimensions(std::shared_ptr<const IMDWorkspace> workspace);
79};
80
81} // namespace API
82} // namespace Mantid
IPeaksWorkspace_sptr workspace
Implements a domain for MD functions (IFunctionMD).
Base class that represents the domain of a function.
A class to store values calculated by a function.
This is a specialization of IFunction for functions defined on an IMDWorkspace.
Definition IFunctionMD.h:49
std::vector< std::shared_ptr< const Mantid::Geometry::IMDDimension > > m_dimensions
dimensions used in this function in the expected order
Definition IFunctionMD.h:74
virtual double functionMD(const IMDIterator &r) const =0
Does the function evaluation. Must be implemented in derived classes.
void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override
Derivatives of function with respect to active parameters.
Definition IFunctionMD.h:59
std::map< std::string, size_t > m_dimensionIndexMap
maps dimension id to its index in m_dimensions
Definition IFunctionMD.h:72
virtual void initDimensions()
Do finction initialization after useAllDimensions() was called.
Definition IFunctionMD.h:67
This is an interface to a fitting function - a semi-abstarct class.
Definition IFunction.h:167
This is an interface to an iterator of an IMDWorkspace.
Definition IMDIterator.h:39
Represents the Jacobian in IFitFunction::functionDeriv.
Definition Jacobian.h:22
Helper class which provides the Collimation Length for SANS instruments.