Mantid
Loading...
Searching...
No Matches
ConvToMDEventsWSIndexing.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 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 +
8
9#include <numeric>
10
11namespace Mantid::MDAlgorithms {
12
13size_t ConvToMDEventsWSIndexing::initialize(const MDWSDescription &WSD, std::shared_ptr<MDEventWSWrapper> inWSWrapper,
14 bool ignoreZeros) {
15 size_t numSpec = ConvToMDEventsWS::initialize(WSD, inWSWrapper, ignoreZeros);
16
17 // check if split parameters are valid
18 const auto &split_into = m_OutWSWrapper->pWorkspace()->getBoxController()->getSplitIntoAll();
19
20 if (!isSplitValid(split_into)) {
21 std::string arg = std::accumulate(split_into.cbegin(), split_into.cend(), std::string(),
22 [](const auto &lhs, const auto &i) { return lhs + std::to_string(i) + " "; });
23 throw std::invalid_argument("SplitInto can't be [" + arg + "]" +
24 " ,all splits have to be the same and equal the power of 2.");
25 }
26 return numSpec;
27}
28
29template <>
30void ConvToMDEventsWSIndexing::appendEventsFromInputWS<2>(API::Progress *pProgress, const API::BoxController_sptr &bc) {
31 if (m_OutWSWrapper->nDimensions() == 2)
32 appendEvents<2>(pProgress, bc);
33}
34
36 appendEventsFromInputWS<8>(pProgress, bc);
37}
38} // namespace Mantid::MDAlgorithms
Helper class for reporting progress from algorithms.
Definition: Progress.h:25
std::shared_ptr< MDEventWSWrapper > m_OutWSWrapper
Definition: ConvToMDBase.h:60
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros) override
method sets up all internal variables necessary to convert from Event Workspace to MDEvent workspace
void appendEventsFromInputWS(API::Progress *pProgress, const API::BoxController_sptr &bc) override
static bool isSplitValid(const std::vector< T > &split_into)
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros) override
method sets up all internal variables necessary to convert from Event Workspace to MDEvent workspace
helper class describes the properties of target MD workspace, which should be obtained as the result ...
std::shared_ptr< BoxController > BoxController_sptr
Shared ptr to BoxController.