Mantid
Loading...
Searching...
No Matches
IDomainCreator.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 "MantidAPI/IFunction.h"
15
16namespace Mantid {
17
18namespace API {
19class FunctionDomain;
20class FunctionValues;
21class Workspace;
22} // namespace API
23
24namespace API {
39class MANTID_API_DLL IDomainCreator {
40public:
42 enum DomainType { Simple = 0, Sequential, Parallel };
44 IDomainCreator(Kernel::IPropertyManager *manager, std::vector<std::string> workspacePropertyNames,
45 DomainType domainType = Simple);
47 virtual ~IDomainCreator() = default;
49 virtual void initialize(Kernel::IPropertyManager *, const std::string &, DomainType) {}
50
52 void separateCompositeMembersInOutput(const bool value, const bool conv = false);
53
59 virtual void declareDatasetProperties(const std::string &suffix = "", bool addProp = true) {
60 UNUSED_ARG(suffix);
61 UNUSED_ARG(addProp);
62 }
63
75 virtual void createDomain(std::shared_ptr<API::FunctionDomain> &domain, std::shared_ptr<API::FunctionValues> &values,
76 size_t i0 = 0) = 0;
77
89 virtual std::shared_ptr<API::Workspace>
90 createOutputWorkspace(const std::string &baseName, API::IFunction_sptr function,
91 std::shared_ptr<API::FunctionDomain> domain, std::shared_ptr<API::FunctionValues> values,
92 const std::string &outputWorkspacePropertyName = "OutputWorkspace") {
93 UNUSED_ARG(baseName);
94 UNUSED_ARG(function);
95 UNUSED_ARG(domain);
96 UNUSED_ARG(values);
97 UNUSED_ARG(outputWorkspacePropertyName);
98 throw std::logic_error("Method createOutputWorkspace() isn't implemented");
99 }
102 virtual void initFunction(API::IFunction_sptr function);
103
105 virtual size_t getDomainSize() const = 0;
106
108 void ignoreInvalidData(bool yes) { m_ignoreInvalidData = yes; }
109
110protected:
112 void declareProperty(Kernel::Property *prop, const std::string &doc);
116 std::vector<std::string> m_workspacePropertyNames;
125};
126
128using IDomainCreator_sptr = std::shared_ptr<IDomainCreator>;
129
130} // namespace API
131} // namespace Mantid
132
133/* Used to register classes into the factory. creates a global object in an
134 * anonymous namespace. The object itself does nothing, but the comma operator
135 * is used in the call to its constructor to effect a call to the factory's
136 * subscribe method.
137 * The id is the key that should be used to create the object
138 */
139#define DECLARE_DOMAINCREATOR(classname) \
140 namespace { \
141 Mantid::Kernel::RegistrationHelper \
142 register_alg_##classname(((Mantid::API::DomainCreatorFactory::Instance().subscribe<classname>(#classname)), 0)); \
143 }
double value
The value of the point.
Definition: FitMW.cpp:51
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
An base class for domain creators for use in Fit.
DomainType
Type of domain to create.
virtual void createDomain(std::shared_ptr< API::FunctionDomain > &domain, std::shared_ptr< API::FunctionValues > &values, size_t i0=0)=0
Create a domain and values from the input workspace.
bool m_convolutionCompositeMembers
Perform convolution of output composite components.
virtual ~IDomainCreator()=default
Virtual destructor.
bool m_outputCompositeMembers
Output separate composite function values.
virtual void initialize(Kernel::IPropertyManager *, const std::string &, DomainType)
Initialize.
std::vector< std::string > m_workspacePropertyNames
Property names for workspaces to get the data from.
Kernel::IPropertyManager * m_manager
Pointer to a property manager.
virtual std::shared_ptr< API::Workspace > createOutputWorkspace(const std::string &baseName, API::IFunction_sptr function, std::shared_ptr< API::FunctionDomain > domain, std::shared_ptr< API::FunctionValues > values, const std::string &outputWorkspacePropertyName="OutputWorkspace")
Create an output workspace filled with data simulated with the fitting function.
bool m_ignoreInvalidData
Flag to ignore nans, infinities and zero errors.
virtual size_t getDomainSize() const =0
Return the size of the domain to be created.
DomainType m_domainType
Domain type.
void ignoreInvalidData(bool yes)
Set to ignore invalid data.
virtual void declareDatasetProperties(const std::string &suffix="", bool addProp=true)
Declare properties that specify the dataset within the workspace to fit to.
Interface to PropertyManager.
Base class for properties.
Definition: Property.h:94
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
std::shared_ptr< IDomainCreator > IDomainCreator_sptr
Typedef for a shared pointer to IDomainCreator.
Helper class which provides the Collimation Length for SANS instruments.