Mantid
Loading...
Searching...
No Matches
Divide.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
10
11namespace Mantid {
12namespace Algorithms {
29class MANTID_ALGORITHMS_DLL Divide : public BinaryOperation {
30public:
32 const std::string name() const override { return "Divide"; }
34 const std::string summary() const override {
35 return "The Divide algorithm will divide the data values and calculate the "
36 "corresponding error values of two compatible workspaces.";
37 }
38
40 int version() const override { return (1); }
41 const std::vector<std::string> seeAlso() const override { return {"Plus", "Minus", "Multiply"}; }
42
43private:
44 void init() override;
45 void exec() override;
46 // Overridden BinaryOperation methods
47 void performBinaryOperation(const HistogramData::Histogram &lhs, const HistogramData::Histogram &rhs,
48 HistogramData::HistogramY &YOut, HistogramData::HistogramE &EOut) override;
49 void performBinaryOperation(const HistogramData::Histogram &lhs, const double rhsY, const double rhsE,
50 HistogramData::HistogramY &YOut, HistogramData::HistogramE &EOut) override;
51 void setOutputUnits(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs,
52 API::MatrixWorkspace_sptr out) override;
53
54 void performEventBinaryOperation(DataObjects::EventList &lhs, const DataObjects::EventList &rhs) override;
55
56 void performEventBinaryOperation(DataObjects::EventList &lhs, const MantidVec &rhsX, const MantidVec &rhsY,
57 const MantidVec &rhsE) override;
58
59 void performEventBinaryOperation(DataObjects::EventList &lhs, const double &rhsY, const double &rhsE) override;
60
61 void checkRequirements() override;
62
63 std::string checkSizeCompatibility(const API::MatrixWorkspace_const_sptr lhs,
64 const API::MatrixWorkspace_const_sptr rhs) const override;
65 // usually you want to warn user if division by 0 occurs. set it to false to
66 // generate these warnings on debug level only
67 bool m_warnOnZeroDivide = true;
68};
69
70} // namespace Algorithms
71} // namespace Mantid
const std::vector< double > & rhs
BinaryOperation supports the implementation of a binary operation on two input workspaces.
Divide performs the division of two input workspaces.
Definition: Divide.h:29
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: Divide.h:40
const std::string summary() const override
Summary of algorithms purpose.
Definition: Divide.h:34
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: Divide.h:41
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: Divide.h:32
A class for holding :
Definition: EventList.h:56
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.