40 "An MDEventWorkspace, MDHistoWorkspace or "
41 "WorkspaceSingleValue as the left-hand side of the "
44 "An MDEventWorkspace, MDHistoWorkspace or "
45 "WorkspaceSingleValue as the right-hand side of the "
48 "Name of the output MDEventWorkspace or MDHistoWorkspace.");
75 if (!std::dynamic_pointer_cast<WorkspaceSingleValue>(
m_rhs)) {
76 if (
m_lhs->getConvention() !=
m_rhs->getConvention()) {
77 throw std::runtime_error(
"Workspaces have different conventions for Q. "
78 "Use algorithm ChangeQConvention on one workspace. ");
83 if (std::dynamic_pointer_cast<MatrixWorkspace>(
m_lhs))
84 throw std::invalid_argument(
"BinaryOperationMD: can't have a "
85 "MatrixWorkspace (e.g. WorkspaceSingleValue) "
86 "as the LHS argument of " +
118 clone->setProperty(
"InputWorkspace",
m_lhs);
119 clone->executeAsChildAlg();
120 m_out = clone->getProperty(
"OutputWorkspace");
126 throw std::runtime_error(
"Error creating the output workspace");
128 throw std::runtime_error(
"No RHS workspace specified!");
144 throw std::invalid_argument(
"Cannot perform " + this->
name() +
145 " on MDHistoWorkspace's with a different number of dimensions.");
147 throw std::invalid_argument(
"Cannot perform " + this->
name() +
148 " on MDHistoWorkspace's with a different number of points.");
154 if (dimA->getMinimum() != dimB->getMinimum() || dimA->getMaximum() != dimB->getMaximum())
155 g_log.
warning() <<
"Dimension " <<
d <<
" (" << dimA->getName()
156 <<
") has different extents in the two "
157 "MDHistoWorkspaces. The operation may not make "
164 throw std::runtime_error(
"Unexpected operand workspace type. Expected MDHistoWorkspace or "
165 "WorkspaceSingleValue, got " +
170 m_out->clearMDMasking();
177 m_out_histo->getExperimentInfo(0)->mutableRun().addProperty(
180 throw std::runtime_error(
"Unexpected output workspace type. Expected MDEventWorkspace or "
181 "MDHistoWorkspace, got " +
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
This class is shared by a few Workspace types and holds information related to a particular experimen...
A property class for workspaces.
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.
The concrete, templated class for properties.
Mantid::API::IMDEventWorkspace_sptr m_rhs_event
Mantid::DataObjects::WorkspaceSingleValue_sptr m_operand_scalar
Operand WorkspaceSingleValue.
virtual void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::MDHistoWorkspace_const_sptr operand)=0
Run the algorithm with a MDHisotWorkspace as output and operand.
virtual std::string outputPropName() const
The name of the output workspace property.
void init() override
Initialize the algorithm's properties.
virtual void execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar)=0
Run the algorithm with a MDHisotWorkspace as output, scalar and operand.
virtual std::string inputPropName1() const
The name of the first input workspace property.
int version() const override
Algorithm's version for identification.
virtual void initExtraProperties()
Optional extra properties.
Mantid::API::IMDEventWorkspace_sptr m_lhs_event
For checkInputs.
virtual void execEvent()=0
Run the algorithm with an MDEventWorkspace as output.
Mantid::DataObjects::MDHistoWorkspace_sptr m_operand_histo
Operand MDHistoWorkspace.
Mantid::DataObjects::WorkspaceSingleValue_sptr m_rhs_scalar
Mantid::API::IMDEventWorkspace_sptr m_operand_event
Operand MDEventWorkspace.
virtual bool commutative() const =0
Is the operation commutative?
const std::string name() const override
Algorithm's name for identification.
Mantid::API::IMDWorkspace_sptr m_lhs
LHS workspace.
Mantid::DataObjects::MDHistoWorkspace_sptr m_out_histo
Output MDHistoWorkspace.
Mantid::DataObjects::WorkspaceSingleValue_sptr m_lhs_scalar
virtual std::string inputPropName2() const
The name of the second input workspace property.
Mantid::API::IMDWorkspace_sptr m_out
Output workspace.
Mantid::DataObjects::MDHistoWorkspace_sptr m_rhs_histo
virtual void checkInputs()=0
Check the inputs and throw if the algorithm cannot be run.
const std::string category() const override
Algorithm's category for identification.
Mantid::DataObjects::MDHistoWorkspace_sptr m_lhs_histo
void exec() override
Execute the algorithm.
Mantid::API::IMDWorkspace_sptr m_rhs
RHS workspace.
Mantid::API::IMDEventWorkspace_sptr m_out_event
Output MDEventWorkspace.
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
std::shared_ptr< const IMDDimension > IMDDimension_const_sptr
Shared Pointer to const IMDDimension.
@ Input
An input workspace.
@ Output
An output workspace.