Mantid
Loading...
Searching...
No Matches
BooleanBinaryOperationMD.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
9
10using namespace Mantid::Kernel;
11using namespace Mantid::API;
12
13namespace Mantid::MDAlgorithms {
14
15//----------------------------------------------------------------------------------------------
17const std::string BooleanBinaryOperationMD::name() const { return "BooleanBinaryOperationMD"; }
18
20int BooleanBinaryOperationMD::version() const { return 1; }
21
22//----------------------------------------------------------------------------------------------
24const std::string BooleanBinaryOperationMD::summary() const {
25 std::string algo = this->name();
26 algo = algo.substr(0, algo.size() - 2);
27 return "Perform the " + algo + " boolean operation on two MDHistoWorkspaces";
28}
29
30//----------------------------------------------------------------------------------------------
32bool BooleanBinaryOperationMD::commutative() const { return true; }
33
34//----------------------------------------------------------------------------------------------
38 throw std::runtime_error("Cannot perform the " + this->name() + " operation on a MDEventWorkspace.");
40 throw std::runtime_error("Cannot perform the " + this->name() + " operation on a WorkspaceSingleValue.");
41 if (!this->commutative() && m_lhs_scalar)
42 throw std::runtime_error("Cannot perform the " + this->name() + " operation with a scalar on the left-hand side.");
43}
44
45//----------------------------------------------------------------------------------------------
48 throw std::runtime_error("Cannot perform the " + this->name() + " operation on a MDEventWorkspace.");
49}
50
51//----------------------------------------------------------------------------------------------
55 throw std::runtime_error("Cannot perform the " + this->name() + " operation on a WorkspaceSingleValue.");
56}
57
58} // namespace Mantid::MDAlgorithms
Mantid::API::IMDEventWorkspace_sptr m_rhs_event
Mantid::API::IMDEventWorkspace_sptr m_lhs_event
For checkInputs.
Mantid::DataObjects::WorkspaceSingleValue_sptr m_rhs_scalar
Mantid::DataObjects::WorkspaceSingleValue_sptr m_lhs_scalar
bool commutative() const override
Is the operation commutative?
const std::string name() const override
Algorithm's name for identification.
virtual bool acceptScalar() const
Return true if the algorithm can operate on a scalar.
int version() const override
Algorithm's version for identification.
const std::string summary() const override
Summary of algorithms purpose.
void checkInputs() override
Check the inputs and throw if the algorithm cannot be run.
void execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) override
Run the algorithm with a MDHisotWorkspace as output, scalar and operand.
void execEvent() override
Run the algorithm with an MDEventWorkspace as output.
std::shared_ptr< const WorkspaceSingleValue > WorkspaceSingleValue_const_sptr
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.