25Kernel::Logger
g_log(
"MultiDomainCreator");
29 m_creators[i] = std::shared_ptr<IDomainCreator>(creator);
40 std::shared_ptr<API::FunctionValues> &ivalues,
size_t i0) {
42 throw std::runtime_error(
"Cannot create JointDomain: number of workspaces does not match "
43 "the number of creators");
45 auto jointDomain = std::make_unique<API::JointDomain>();
50 throw std::runtime_error(
"Missing domain creator");
54 creator->createDomain(dom, values, i0);
56 jointDomain->addDomain(dom);
59 domain.reset(jointDomain.release());
68 auto mdFunction = std::dynamic_pointer_cast<API::MultiDomainFunction>(function);
71 for (
size_t iFun = 0; iFun < mdFunction->nFunctions(); ++iFun) {
72 std::vector<size_t> domainIndices;
74 mdFunction->getDomainIndices(iFun,
m_creators.size(), domainIndices);
75 if (!domainIndices.empty()) {
76 size_t index = domainIndices[0];
78 std::stringstream msg;
79 msg <<
"Domain index is out of range. (Function #" << iFun <<
")";
80 throw std::runtime_error(msg.str());
84 g_log.
warning() <<
"Function #" << iFun <<
" doesn't apply to any domain\n";
106 const std::string &baseName,
API::IFunction_sptr function, std::shared_ptr<API::FunctionDomain> domain,
107 std::shared_ptr<API::FunctionValues> values,
const std::string &outputWorkspacePropertyName) {
112 std::vector<API::IFunction_sptr> functions = function->createEquivalentFunctions();
115 throw std::runtime_error(
"Number of functions and domains don't match");
120 for (
size_t i = 0; i < functions.size(); ++i) {
121 std::string localName = baseName +
"Workspace_" +
std::to_string(i);
122 auto fun = functions[i];
124 std::shared_ptr<API::FunctionDomain> localDomain;
125 std::shared_ptr<API::FunctionValues> localValues;
127 creator->createDomain(localDomain, localValues);
128 creator->initFunction(fun);
129 auto ws = creator->createOutputWorkspace(localName, fun, localDomain, localValues,
"");
130 API::AnalysisDataService::Instance().addOrReplace(localName, ws);
131 outWS->addWorkspace(ws);
134 if (!outputWorkspacePropertyName.empty()) {
137 "Name of the output Workspace holding resulting simulated spectrum");
std::map< DeltaEMode::Type, std::string > index
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
An base class for domain creators for use in Fit.
bool m_convolutionCompositeMembers
Perform convolution of output composite components.
virtual void initFunction(API::IFunction_sptr function)
Initialize the function.
bool m_outputCompositeMembers
Output separate composite function values.
std::vector< std::string > m_workspacePropertyNames
Property names for workspaces to get the data from.
Kernel::IPropertyManager * m_manager
Pointer to a property manager.
bool m_ignoreInvalidData
Flag to ignore nans, infinities and zero errors.
void declareProperty(Kernel::Property *prop, const std::string &doc)
Declare a property to the algorithm.
Class to hold a set of workspaces.
A property class for workspaces.
void initFunction(API::IFunction_sptr function) override
Initialize the function.
void setCreator(size_t i, API::IDomainCreator *creator)
Set ith creator.
void createDomain(std::shared_ptr< API::FunctionDomain > &domain, std::shared_ptr< API::FunctionValues > &ivalues, size_t i0=0) override
Create a domain from the input workspace.
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) override
Create the output workspace.
bool hasCreator(size_t i) const
Check if i-th creator has been set with setCreator.
std::vector< std::shared_ptr< API::IDomainCreator > > m_creators
Vector of creators.
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void warning(const std::string &msg)
Logs at warning level.
std::shared_ptr< FunctionValues > FunctionValues_sptr
typedef for a shared pointer
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
std::shared_ptr< FunctionDomain > FunctionDomain_sptr
typedef for a shared pointer
std::string to_string(const wide_integer< Bits, Signed > &n)
@ Output
An output workspace.