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