Mantid
Loading...
Searching...
No Matches
RebinnedOutput.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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 DataObjects {
14
25class MANTID_DATAOBJECTS_DLL RebinnedOutput : public Workspace2D {
26public:
27 RebinnedOutput() : m_finalized(false), m_hasSqrdErrs(true) {}
28 RebinnedOutput(bool finalized, bool hasSqrdErrs) : m_finalized(finalized), m_hasSqrdErrs(hasSqrdErrs) {}
30 std::unique_ptr<RebinnedOutput> clone() const { return std::unique_ptr<RebinnedOutput>(doClone()); }
32 std::unique_ptr<RebinnedOutput> cloneEmpty() const { return std::unique_ptr<RebinnedOutput>(doCloneEmpty()); }
34
36 const std::string id() const override;
37
39 virtual MantidVec &dataF(const std::size_t index);
40
42 virtual const MantidVec &dataF(const std::size_t index) const;
43
45 void finalize(bool hasSqrdErrs = true);
47 void unfinalize();
48
50 bool isFinalized() const { return m_finalized; }
52 void setFinalized(bool value) { m_finalized = value; }
53
55 bool hasSqrdErrors() const { return m_hasSqrdErrs; }
57 void setSqrdErrors(bool value) { m_hasSqrdErrs = value; }
58
60 const MantidVec &readF(std::size_t const index) const;
61
63 void setF(const std::size_t index, const MantidVecPtr &F);
65 void scaleF(const double scale);
67 bool nonZeroF() const;
68
69protected:
71 RebinnedOutput(const RebinnedOutput &) = default;
72
74 void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) override;
75 void init(const HistogramData::Histogram &histogram) override;
76
78 std::vector<MantidVec> fracArea;
79
82
85
86private:
87 RebinnedOutput *doClone() const override { return new RebinnedOutput(*this); }
88 RebinnedOutput *doCloneEmpty() const override { return new RebinnedOutput(m_finalized, m_hasSqrdErrs); }
89};
90
92using RebinnedOutput_sptr = std::shared_ptr<RebinnedOutput>;
94using RebinnedOutput_const_sptr = std::shared_ptr<const RebinnedOutput>;
95
96} // namespace DataObjects
97} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
RebinnedOutput(bool finalized, bool hasSqrdErrs)
RebinnedOutput & operator=(const RebinnedOutput &)=delete
RebinnedOutput * doCloneEmpty() const override
Virtual cloneEmpty method.
bool m_hasSqrdErrs
Flag to indiciate if the finalized data used squared errors.
bool m_finalized
Flag to indicate if finalize has been called, and if errors/variance used.
RebinnedOutput * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
std::unique_ptr< RebinnedOutput > clone() const
Returns a clone of the workspace.
void setSqrdErrors(bool value)
Override the squared errors flag.
void setFinalized(bool value)
Override the finalized flag.
bool hasSqrdErrors() const
Returns if using squared errors.
std::unique_ptr< RebinnedOutput > cloneEmpty() const
Returns a default-initialized clone of the workspace.
RebinnedOutput(const RebinnedOutput &)=default
Protected copy constructor. May be used by childs for cloning.
std::vector< MantidVec > fracArea
A vector that holds the 1D vectors for the fractional area.
bool isFinalized() const
Returns if finalize has been called.
Concrete workspace implementation.
Definition: Workspace2D.h:29
Implements a copy on write data template.
Definition: cow_ptr.h:41
std::shared_ptr< const RebinnedOutput > RebinnedOutput_const_sptr
shared pointer to a const RebinnedOutput
std::shared_ptr< RebinnedOutput > RebinnedOutput_sptr
shared pointer to the RebinnedOutput class
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