Mantid
Loading...
Searching...
No Matches
IMWDomainCreator.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//----------------------------------------------------------------------
13#include "MantidCurveFitting/DllConfig.h"
15
16#include <list>
17#include <memory>
18#include <utility>
19
20namespace Mantid {
21namespace API {
22class FunctionDomain;
23class FunctionDomain1D;
24class FunctionValues;
25class MatrixWorkspace;
26} // namespace API
27
28namespace CurveFitting {
29
34class MANTID_CURVEFITTING_DLL IMWDomainCreator : public API::IDomainCreator {
35public:
37 IMWDomainCreator(Kernel::IPropertyManager *fit, const std::string &workspacePropertyName,
38 DomainType domainType = Simple);
41 void declareDatasetProperties(const std::string &suffix = "", bool addProp = true) override;
43 std::shared_ptr<API::Workspace> createOutputWorkspace(const std::string &baseName, API::IFunction_sptr function,
44 std::shared_ptr<API::FunctionDomain> domain,
45 std::shared_ptr<API::FunctionValues> values,
46 const std::string &outputWorkspacePropertyName) override;
48 size_t getDomainSize() const override;
50 void initFunction(API::IFunction_sptr function) override;
53 void setWorkspace(std::shared_ptr<API::MatrixWorkspace> ws) { m_matrixWorkspace = std::move(ws); }
56 void setWorkspaceIndex(size_t wi) { m_workspaceIndex = wi; }
60 void setRange(double startX, double endX) {
61 m_startX = startX;
62 m_endX = endX;
63 }
64
65protected:
67 std::pair<size_t, size_t> getXInterval() const;
69 virtual void setParameters() const;
70
72 std::shared_ptr<API::MatrixWorkspace> createEmptyResultWS(const size_t nhistograms, const size_t nyvalues);
74 void setInitialValues(API::IFunction &function);
75 // Unrolls function into its constituent parts if it is a composite and adds
76 // it to the list. Note this is recursive
77 void appendCompositeFunctionMembers(std::list<API::IFunction_sptr> &functionList,
78 const API::IFunction_sptr &function) const;
79 // Create separate Convolutions for each component of the model of a
80 // convolution
81 void appendConvolvedCompositeFunctionMembers(std::list<API::IFunction_sptr> &functionList,
82 const API::IFunction_sptr &function) const;
84 void addFunctionValuesToWS(const API::IFunction_sptr &function, std::shared_ptr<API::MatrixWorkspace> &ws,
85 const size_t wsIndex, const std::shared_ptr<API::FunctionDomain> &domain,
86 const std::shared_ptr<API::FunctionValues> &resultValues) const;
87
95 std::string m_endXPropertyName;
96
98 mutable std::shared_ptr<API::MatrixWorkspace> m_matrixWorkspace;
100 mutable size_t m_workspaceIndex;
102 mutable double m_startX;
104 mutable double m_endX;
106 mutable std::weak_ptr<API::FunctionDomain1D> m_domain;
107 mutable std::weak_ptr<API::FunctionValues> m_values;
109};
110
111} // namespace CurveFitting
112} // namespace Mantid
An base class for domain creators for use in Fit.
DomainType
Type of domain to create.
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163
A base class for domain creators taking 1D data from a spectrum of a matrix workspace.
std::string m_endXPropertyName
Store endX property name.
std::string m_startXPropertyName
Store startX property name.
void setWorkspace(std::shared_ptr< API::MatrixWorkspace > ws)
Set the workspace.
std::weak_ptr< API::FunctionDomain1D > m_domain
Store the created domain and values.
std::shared_ptr< API::MatrixWorkspace > m_matrixWorkspace
The input MareixWorkspace.
std::weak_ptr< API::FunctionValues > m_values
size_t m_workspaceIndex
The workspace index.
void setRange(double startX, double endX)
Set the startX and endX.
std::string m_workspacePropertyName
Store workspace property name.
std::string m_workspaceIndexPropertyName
Store workspace index property name.
void setWorkspaceIndex(size_t wi)
Set the workspace index.
Interface to PropertyManager.
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.