Mantid
Loading...
Searching...
No Matches
SpecialWorkspace2D.h
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 +
7#pragma once
8
12
13namespace Mantid {
14namespace DataObjects {
15
27public:
28 enum e { AND, OR, XOR, NOT };
29};
30
31class MANTID_DATAOBJECTS_DLL SpecialWorkspace2D : public Workspace2D {
32public:
33 SpecialWorkspace2D() = default;
34 SpecialWorkspace2D(const Geometry::Instrument_const_sptr &inst, const bool includeMonitors = false);
36
38 std::unique_ptr<SpecialWorkspace2D> clone() const { return std::unique_ptr<SpecialWorkspace2D>(doClone()); }
40 std::unique_ptr<SpecialWorkspace2D> cloneEmpty() const {
41 auto workspace = std::unique_ptr<SpecialWorkspace2D>(doCloneEmpty());
42 workspace->detID_to_WI = this->detID_to_WI;
43 return workspace;
44 }
48 const std::string id() const override { return "SpecialWorkspace2D"; }
49
50 double getValue(const detid_t detectorID) const;
51 double getValue(const detid_t detectorID, const double defaultValue) const;
52
53 void setValue(const detid_t detectorID, const double value, const double error = 0.);
54 void setValue(const std::set<detid_t> &detectorIDs, const double value, const double error = 0.);
55
56 std::set<detid_t> getDetectorIDs(const std::size_t workspaceIndex) const;
57
58 void binaryOperation(const std::shared_ptr<const SpecialWorkspace2D> &ws, const unsigned int operatortype);
59 void binaryOperation(const unsigned int operatortype);
60
61 virtual void copyFrom(std::shared_ptr<const SpecialWorkspace2D> sourcews);
62
63private:
64 SpecialWorkspace2D *doClone() const override { return new SpecialWorkspace2D(*this); }
65 SpecialWorkspace2D *doCloneEmpty() const override { return new SpecialWorkspace2D(); }
66 bool isCompatible(const std::shared_ptr<const SpecialWorkspace2D> &ws);
67
68protected:
71
72 void init(const size_t &NVectors, const size_t &XLength, const size_t &YLength) override;
73 void init(const HistogramData::Histogram &histogram) override;
74
76 const std::string toString() const override;
77
78 void binaryAND(const std::shared_ptr<const SpecialWorkspace2D> &ws);
79 void binaryOR(const std::shared_ptr<const SpecialWorkspace2D> &ws);
80 void binaryXOR(const std::shared_ptr<const SpecialWorkspace2D> &ws);
81 void binaryNOT();
82
84 std::map<detid_t, std::size_t> detID_to_WI;
85};
86
88using SpecialWorkspace2D_sptr = std::shared_ptr<SpecialWorkspace2D>;
89
91using SpecialWorkspace2D_const_sptr = std::shared_ptr<const SpecialWorkspace2D>;
92
93} // namespace DataObjects
94} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
double error
Definition: IndexPeaks.cpp:133
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
An SpecialWorkspace2D is a specialized Workspace2D where the Y value at each pixel will be used for a...
SpecialWorkspace2D * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
SpecialWorkspace2D * doCloneEmpty() const override
Virtual cloneEmpty method.
SpecialWorkspace2D(const SpecialWorkspace2D &)=default
Protected copy constructor. May be used by childs for cloning.
std::unique_ptr< SpecialWorkspace2D > clone() const
Returns a clone of the workspace.
std::map< detid_t, std::size_t > detID_to_WI
Map with key = detector ID, and value = workspace index.
const std::string id() const override
Gets the name of the workspace type.
std::unique_ptr< SpecialWorkspace2D > cloneEmpty() const
Returns a default-initialized clone of the workspace.
SpecialWorkspace2D & operator=(const SpecialWorkspace2D &)=delete
Concrete workspace implementation.
Definition: Workspace2D.h:29
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< const SpecialWorkspace2D > SpecialWorkspace2D_const_sptr
shared pointer to a const SpecialWorkspace2D
std::shared_ptr< SpecialWorkspace2D > SpecialWorkspace2D_sptr
shared pointer to the SpecialWorkspace2D class
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
Helper class which provides the Collimation Length for SANS instruments.