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");
53 creator->createDomain(dom, values, i0);
55 jointDomain->addDomain(dom);
58 domain.reset(jointDomain.release());
67 auto mdFunction = std::dynamic_pointer_cast<API::MultiDomainFunction>(function);
70 for (
size_t iFun = 0; iFun < mdFunction->nFunctions(); ++iFun) {
71 std::vector<size_t> domainIndices;
73 mdFunction->getDomainIndices(iFun,
m_creators.size(), domainIndices);
74 if (!domainIndices.empty()) {
75 size_t index = domainIndices[0];
77 std::stringstream msg;
78 msg <<
"Domain index is out of range. (Function #" << iFun <<
")";
79 throw std::runtime_error(msg.str());
83 g_log.
warning() <<
"Function #" << iFun <<
" doesn't apply to any domain\n";
105 const std::string &baseName,
API::IFunction_sptr function, std::shared_ptr<API::FunctionDomain> domain,
106 std::shared_ptr<API::FunctionValues> values,
const std::string &outputWorkspacePropertyName) {
111 std::vector<API::IFunction_sptr> functions = function->createEquivalentFunctions();
114 throw std::runtime_error(
"Number of functions and domains don't match");
119 for (
size_t i = 0; i < functions.size(); ++i) {
120 std::string localName = baseName +
"Workspace_" +
std::to_string(i);
121 auto fun = functions[i];
123 std::shared_ptr<API::FunctionDomain> localDomain;
124 std::shared_ptr<API::FunctionValues> localValues;
126 creator->createDomain(localDomain, localValues);
127 creator->initFunction(fun);
128 auto ws = creator->createOutputWorkspace(localName, fun, localDomain, localValues,
"");
130 outWS->addWorkspace(ws);
133 if (!outputWorkspacePropertyName.empty()) {
136 "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.
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.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
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.