22using API::WorkspaceProperty;
23using DataObjects::RebinnedOutput;
44 "Name of the input workspace.");
46 "Name of the output workspace, can be the same as the input.");
57 const auto numSpectra =
static_cast<int>(inputWS->getNumberHistograms());
65 if (inputWS->axes() > 1)
66 outputWS->replaceAxis(1, std::unique_ptr<API::Axis>(inputWS->getAxis(1)->clone(outputWS.get())));
68 bool isRebinnedWorkspace = inputWS->id() ==
"RebinnedOutput";
72 Progress prog(
this, 0.0, 1.0, numSpectra);
74 for (
int i = 0; i < int(numSpectra); ++i) {
78 outputWS->setSharedY(i, inputWS->sharedY(i));
79 outputWS->setSharedE(i, inputWS->sharedE(i));
80 if (isRebinnedWorkspace && outRB) {
82 outF.
access().resize(inputWS->getNumberBins(i), 1.0);
86 if (inputWS->hasDx(i)) {
87 outputWS->setSharedDx(i, inputWS->sharedDx(i));
101 return inputWS->y(0).size();
std::map< DeltaEMode::Type, std::string > index
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_CRITICAL(name)
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Helper class for reporting progress from algorithms.
A property class for workspaces.
virtual Kernel::cow_ptr< HistogramData::HistogramX > calculateXPoints(const Kernel::cow_ptr< HistogramData::HistogramX > inputX) const =0
Calculate the X point values. Implement in an inheriting class.
bool m_sharedX
Flag if the X data is shared.
virtual std::size_t getNewXSize(const std::size_t ySize) const =0
Returns the size of the new X vector.
void setXData(const API::MatrixWorkspace_sptr &outputWS, const API::MatrixWorkspace_sptr &inputWS, const int index)
Set the X data on given spectra.
virtual bool isProcessingRequired(const API::MatrixWorkspace_sptr inputWS) const =0
Returns true if the algorithm needs to be run.
void exec() override
Override exec.
XDataConverter()
Default constructor.
void init() override
Override init.
Kernel::cow_ptr< HistogramData::HistogramX > m_cachedX
Cached data for shared X values.
std::size_t getNewYSize(const API::MatrixWorkspace_sptr &inputWS)
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
Implements a copy on write data template.
DataType & access()
Access function.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Mantid::Kernel::SingletonHolder< WorkspaceFactoryImpl > WorkspaceFactory
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< RebinnedOutput > RebinnedOutput_sptr
shared pointer to the RebinnedOutput class
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
static bool sharedXData(const MatrixWorkspace &WS)
Checks whether all the X vectors in a workspace are the same one underneath.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.