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
10#include "MantidDataObjects/DllConfig.h"
13
14namespace Mantid {
15namespace DataObjects {
16
27class MANTID_DATAOBJECTS_DLL RebinnedOutput : public Workspace2D {
28public:
29 RebinnedOutput() : m_finalized(false), m_hasSqrdErrs(true) {}
30 RebinnedOutput(bool finalized, bool hasSqrdErrs) : m_finalized(finalized), m_hasSqrdErrs(hasSqrdErrs) {}
32 std::unique_ptr<RebinnedOutput> clone() const { return std::unique_ptr<RebinnedOutput>(doClone()); }
34 std::unique_ptr<RebinnedOutput> cloneEmpty() const { return std::unique_ptr<RebinnedOutput>(doCloneEmpty()); }
36
38 const std::string id() const override;
39
41 virtual MantidVec &dataF(const std::size_t index);
42
44 virtual const MantidVec &dataF(const std::size_t index) const;
45
47 void finalize(bool hasSqrdErrs = true);
49 void unfinalize();
50
52 bool isFinalized() const { return m_finalized; }
54 void setFinalized(bool value) { m_finalized = value; }
55
57 bool hasSqrdErrors() const { return m_hasSqrdErrs; }
59 void setSqrdErrors(bool value) { m_hasSqrdErrs = value; }
60
62 const MantidVec &readF(std::size_t const index) const;
63
65 void setF(const std::size_t index, const MantidVecPtr &F);
67 void scaleF(const double scale);
69 bool nonZeroF() const;
70
71protected:
73 RebinnedOutput(const RebinnedOutput &) = default;
74
76 void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) override;
77 void init(const HistogramData::Histogram &histogram) override;
78
80 std::vector<MantidVec> fracArea;
81
84
87
88private:
89 RebinnedOutput *doClone() const override { return new RebinnedOutput(*this); }
90 RebinnedOutput *doCloneEmpty() const override { return new RebinnedOutput(m_finalized, m_hasSqrdErrs); }
91};
92
94using RebinnedOutput_sptr = std::shared_ptr<RebinnedOutput>;
96using RebinnedOutput_const_sptr = std::shared_ptr<const RebinnedOutput>;
97
98} // namespace DataObjects
99} // namespace Mantid
100
101// Instantiated and exported by DataObjects/src/PropertyWithValue.cpp
103 Mantid::Kernel::PropertyWithValue<std::shared_ptr<Mantid::DataObjects::RebinnedOutput>>);
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
MANTID_DATAOBJECTS_EXTERN_TEMPLATE(Mantid::Kernel::PropertyWithValue< std::shared_ptr< Mantid::DataObjects::RebinnedOutput > >)
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:30
The concrete, templated class for properties.
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
Definition SumSpectra.h:24
std::shared_ptr< RebinnedOutput > RebinnedOutput_sptr
shared pointer to the RebinnedOutput class
Definition SumSpectra.h:23
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