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;
58 void setWorkspace(std::shared_ptr<const Workspace> ws) override;
59
60 void function(const FunctionDomain &domain, FunctionValues &values) const override;
61 void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override { calNumericalDeriv(domain, jacobian); }
62
63protected:
65 void evaluateFunction(const FunctionDomainMD &domain, FunctionValues &values) const;
66
67 virtual void useDimension(const std::string &id);
69 virtual void initDimensions() {}
71 virtual double functionMD(const IMDIterator &r) const = 0;
72
74 std::map<std::string, size_t> m_dimensionIndexMap;
76 std::vector<std::shared_ptr<const Mantid::Geometry::IMDDimension>> m_dimensions;
77
78private:
80 virtual void useAllDimensions(std::shared_ptr<const IMDWorkspace> workspace);
81};
82
83} // namespace API
84} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
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:76
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:61
std::map< std::string, size_t > m_dimensionIndexMap
maps dimension id to its index in m_dimensions
Definition: IFunctionMD.h:74
virtual void initDimensions()
Do finction initialization after useAllDimensions() was called.
Definition: IFunctionMD.h:69
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163
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.