Mantid
Loading...
Searching...
No Matches
Workspace2D.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
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include "MantidDataObjects/DllConfig.h"
16
17namespace Mantid {
18
19namespace DataObjects {
29class MANTID_DATAOBJECTS_DLL Workspace2D : public API::HistoWorkspace {
30public:
35 const std::string id() const override { return "Workspace2D"; }
36
37 Workspace2D(const Parallel::StorageMode storageMode = Parallel::StorageMode::Cloned);
38 Workspace2D &operator=(const Workspace2D &other) = delete;
39 ~Workspace2D() override;
40
42 std::unique_ptr<Workspace2D> clone() const { return std::unique_ptr<Workspace2D>(doClone()); }
43
45 std::unique_ptr<Workspace2D> cloneEmpty() const { return std::unique_ptr<Workspace2D>(doCloneEmpty()); }
46
48 bool isRaggedWorkspace() const override;
49
50 // section required for iteration
51 std::size_t size() const override;
52
53 std::size_t blocksize() const override;
55 std::size_t getNumberBins(const std::size_t &index) const override;
57 std::size_t getMaxNumberBins() const override;
58
60 std::size_t getNumberHistograms() const override;
61
62 Histogram1D &getSpectrum(const size_t index) override {
63 invalidateCommonBinsFlag();
64 return getSpectrumWithoutInvalidation(index);
65 }
66 const Histogram1D &getSpectrum(const size_t index) const override;
67
69 void generateHistogram(const std::size_t index, const MantidVec &X, MantidVec &Y, MantidVec &E,
70 bool skipError = false) const override;
71
75 void setMonitorList(const std::vector<specnum_t> &mList) { m_monitorList = mList; }
76
78 void setImageY(const API::MantidImage &image, size_t start = 0, bool parallelExecution = true) override;
80 void setImageE(const API::MantidImage &image, size_t start = 0, bool parallelExecution = true) override;
82 void setImageYAndE(const API::MantidImage &imageY, const API::MantidImage &imageE, size_t start = 0,
83 bool loadAsRectImg = false, double scale_1 = 1.0, [[maybe_unused]] bool parallelExecution = true);
84
85protected:
87 Workspace2D(const Workspace2D &other);
88
90 void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) override;
91 void init(const HistogramData::Histogram &histogram) override;
92
94 std::vector<specnum_t> m_monitorList;
95
97 std::vector<std::unique_ptr<Histogram1D>> data;
98
99private:
100 Workspace2D *doClone() const override;
101 Workspace2D *doCloneEmpty() const override;
102
103 Histogram1D &getSpectrumWithoutInvalidation(const size_t index) override;
104 virtual std::size_t getHistogramNumberHelper() const;
105};
106} // namespace DataObjects
107} // Namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
HistoWorkspace is an abstract base class for MatrixWorkspace types that are NOT event workspaces.
1D histogram implementation.
Definition: Histogram1D.h:18
Concrete workspace implementation.
Definition: Workspace2D.h:29
std::vector< std::unique_ptr< Histogram1D > > data
A vector that holds the 1D histograms.
Definition: Workspace2D.h:97
const std::string id() const override
Gets the name of the workspace type.
Definition: Workspace2D.h:35
Workspace2D & operator=(const Workspace2D &other)=delete
~Workspace2D() override
Destructor.
std::unique_ptr< Workspace2D > clone() const
Returns a clone of the workspace.
Definition: Workspace2D.h:42
std::vector< specnum_t > m_monitorList
a vector holding workspace index of monitors in the workspace
Definition: Workspace2D.h:94
std::unique_ptr< Workspace2D > cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition: Workspace2D.h:45
Histogram1D & getSpectrum(const size_t index) override
Return the underlying ISpectrum ptr at the given workspace index.
Definition: Workspace2D.h:62
void setMonitorList(const std::vector< specnum_t > &mList)
sets the monitorWorkspace indexlist
Definition: Workspace2D.h:75
std::vector< std::vector< double > > MantidImage
typedef for the image type
Helper class which provides the Collimation Length for SANS instruments.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition: cow_ptr.h:172