Mantid
Loading...
Searching...
No Matches
MergeMDFiles.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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
12#include "MantidMDAlgorithms/DllConfig.h"
13#include <mutex>
14
15namespace Mantid {
16namespace MDAlgorithms {
17
24class MANTID_MDALGORITHMS_DLL MergeMDFiles final : public API::Algorithm {
25public:
27 ~MergeMDFiles() override;
28
30 const std::string name() const override { return "MergeMDFiles"; };
32 const std::string summary() const override {
33 return "Merge multiple MDEventWorkspaces from files that obey a common box "
34 "format.";
35 }
36
38 int version() const override { return 1; };
39 const std::vector<std::string> seeAlso() const override { return {"MergeMD"}; }
41 const std::string category() const override { return "MDAlgorithms\\Creation"; }
42
43private:
45 void init() override;
47 void exec() override;
48
49 void loadBoxData();
50
51 void doExecByCloning(const Mantid::API::IMDEventWorkspace_sptr &ws, const std::string &outputFile);
52
53 void finalizeOutput(const std::string &outputFile);
54
55 uint64_t loadEventsFromSubBoxes(API::IMDNode *TargetBox);
56
57 // the class which flatten the box structure and deal with it
59 // the vector of box structures for contributing files components
60 std::vector<DataObjects::MDBoxFlatTree> m_fileComponentsStructure;
61
62protected:
64 // bool clonedFirst;
65 void clearEventLoaders();
66
70 std::string m_MDEventType;
71
75 std::vector<std::string> m_Filenames;
76
78 std::vector<API::IBoxControllerIO *> m_EventLoader;
79
82
84 uint64_t m_totalEvents;
85
87 uint64_t m_totalLoaded;
88
90 std::mutex m_fileMutex;
91
93 std::mutex m_statsMutex;
94
96 std::unique_ptr<Mantid::API::Progress> m_progress = nullptr;
97};
98
99} // namespace MDAlgorithms
100} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
The class responsible for saving/loading MD boxes structure to/from HDD and for flattening/restoring ...
Algorithm to merge multiple MDEventWorkspaces from files that obey a common box format.
std::mutex m_fileMutex
Mutex for file access.
std::string m_MDEventType
string describes type of the event, stored in the workspaces.
int version() const override
Algorithm's version for identification.
std::vector< std::string > m_Filenames
Files to load.
std::vector< API::IBoxControllerIO * > m_EventLoader
Vector of file handles to each input file //TODO unique?
int m_nDims
number of workspace dimensions
bool m_fileBasedTargetWS
if the workspace is indeed file-based
DataObjects::MDBoxFlatTree m_BoxStruct
std::vector< DataObjects::MDBoxFlatTree > m_fileComponentsStructure
const std::string category() const override
Algorithm's category for identification.
Mantid::API::IMDEventWorkspace_sptr m_OutIWS
Output IMDEventWorkspace.
std::mutex m_statsMutex
Mutex for modifying stats.
const std::string name() const override
Algorithm's name for identification.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string summary() const override
Summary of algorithms purpose.
std::shared_ptr< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
Helper class which provides the Collimation Length for SANS instruments.