Mantid
Loading...
Searching...
No Matches
MaskWorkspace.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
13
14namespace Mantid {
15namespace DataObjects {
16
17class MANTID_DATAOBJECTS_DLL MaskWorkspace : public SpecialWorkspace2D, public API::IMaskWorkspace {
18public:
19 MaskWorkspace() = default;
20 MaskWorkspace(std::size_t numvectors);
21 MaskWorkspace(const Mantid::Geometry::Instrument_const_sptr &instrument, const bool includeMonitors = false);
23
25 std::unique_ptr<MaskWorkspace> clone() const { return std::unique_ptr<MaskWorkspace>(doClone()); }
27 std::unique_ptr<MaskWorkspace> cloneEmpty() const { return std::unique_ptr<MaskWorkspace>(doCloneEmpty()); }
28 MaskWorkspace &operator=(const MaskWorkspace &other) = delete;
29 bool isMasked(const detid_t detectorID) const override;
30 bool isMasked(const std::set<detid_t> &detectorIDs) const override;
31 bool isMaskedIndex(const std::size_t wkspIndex) const;
32 void setMasked(const detid_t detectorID, const bool mask = true) override;
33 void setMasked(const std::set<detid_t> &detectorIDs, const bool mask = true) override;
34 void setMaskedIndex(const std::size_t wkspIndex, const bool mask = true);
35 std::size_t getNumberMasked() const override;
36 std::set<detid_t> getMaskedDetectors() const;
37 std::set<std::size_t> getMaskedWkspIndices() const;
38
39 const std::string id() const override;
40
42 void copyFrom(std::shared_ptr<const SpecialWorkspace2D> sourcews) override;
43
44protected:
46 MaskWorkspace(const MaskWorkspace &) = default;
47
49 const std::string toString() const override;
50
51private:
52 MaskWorkspace *doClone() const override { return new MaskWorkspace(*this); }
53 MaskWorkspace *doCloneEmpty() const override { return new MaskWorkspace(); }
54
55 IMaskWorkspace *doInterfaceClone() const override { return doClone(); }
57 void clearMask();
58
60 bool hasInstrument() const;
61};
62
64using MaskWorkspace_sptr = std::shared_ptr<MaskWorkspace>;
65
67using MaskWorkspace_const_sptr = std::shared_ptr<const MaskWorkspace>;
68
69} // namespace DataObjects
70} // namespace Mantid
This class provides an interface to a MaskWorkspace.
std::unique_ptr< MaskWorkspace > cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition: MaskWorkspace.h:27
MaskWorkspace & operator=(const MaskWorkspace &other)=delete
MaskWorkspace * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: MaskWorkspace.h:52
MaskWorkspace(const MaskWorkspace &)=default
Protected copy constructor. May be used by childs for cloning.
std::unique_ptr< MaskWorkspace > clone() const
Returns a clone of the workspace.
Definition: MaskWorkspace.h:25
MaskWorkspace * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: MaskWorkspace.h:53
IMaskWorkspace * doInterfaceClone() const override
returns a clone of the workspace as the interface
Definition: MaskWorkspace.h:55
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< const MaskWorkspace > MaskWorkspace_const_sptr
shared pointer to a const MaskWorkspace
Definition: MaskWorkspace.h:67
std::shared_ptr< MaskWorkspace > MaskWorkspace_sptr
shared pointer to the MaskWorkspace class
Definition: MaskWorkspace.h:64
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.