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#include "MantidKernel/Unit.h"
18#ifndef Q_MOC_RUN
19#include <boost/scoped_array.hpp>
20#include <boost/variant.hpp>
21#endif
22#include <memory>
23#include <string>
24#include <vector>
25
26namespace Mantid {
27
28namespace API {
29//----------------------------------------------------------------------
30// Forward declaration
31//----------------------------------------------------------------------
32class IMDWorkspace;
33class IMDIterator;
34class Jacobian;
35class ParameterTie;
36class IConstraint;
37class ParameterReference;
38class FunctionHandler;
39class FunctionDomainMD;
40
50class MANTID_API_DLL IFunctionMD : public virtual IFunction {
51public:
52 /* Overidden methods */
53
55 std::shared_ptr<IFunction> clone() const override;
57 void setWorkspace(std::shared_ptr<const Workspace> ws) override;
58
59 void function(const FunctionDomain &domain, FunctionValues &values) const override;
60 void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override { calNumericalDeriv(domain, jacobian); }
61
62protected:
64 void evaluateFunction(const FunctionDomainMD &domain, FunctionValues &values) const;
65
66 virtual void useDimension(const std::string &id);
68 virtual void initDimensions() {}
70 virtual double functionMD(const IMDIterator &r) const = 0;
71
73 std::map<std::string, size_t> m_dimensionIndexMap;
75 std::vector<std::shared_ptr<const Mantid::Geometry::IMDDimension>> m_dimensions;
76
77private:
79 virtual void useAllDimensions(std::shared_ptr<const IMDWorkspace> workspace);
80};
81
82} // namespace API
83} // 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:50
std::vector< std::shared_ptr< const Mantid::Geometry::IMDDimension > > m_dimensions
dimensions used in this function in the expected order
Definition IFunctionMD.h:75
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:60
std::map< std::string, size_t > m_dimensionIndexMap
maps dimension id to its index in m_dimensions
Definition IFunctionMD.h:73
virtual void initDimensions()
Do finction initialization after useAllDimensions() was called.
Definition IFunctionMD.h:68
This is an interface to a fitting function - a semi-abstarct class.
Definition IFunction.h:166
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.