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
13#include "MantidMDAlgorithms/DllConfig.h"
14#include <mutex>
15#include <nexus/NeXusFile.hpp>
16
17namespace Mantid {
18namespace MDAlgorithms {
19
26class MANTID_MDALGORITHMS_DLL MergeMDFiles final : public API::Algorithm {
27public:
29 ~MergeMDFiles() override;
30
32 const std::string name() const override { return "MergeMDFiles"; };
34 const std::string summary() const override {
35 return "Merge multiple MDEventWorkspaces from files that obey a common box "
36 "format.";
37 }
38
40 int version() const override { return 1; };
41 const std::vector<std::string> seeAlso() const override { return {"MergeMD"}; }
43 const std::string category() const override { return "MDAlgorithms\\Creation"; }
44
45private:
47 void init() override;
49 void exec() override;
50
51 void loadBoxData();
52
53 void doExecByCloning(const Mantid::API::IMDEventWorkspace_sptr &ws, const std::string &outputFile);
54
55 void finalizeOutput(const std::string &outputFile);
56
57 uint64_t loadEventsFromSubBoxes(API::IMDNode *TargetBox);
58
59 // the class which flatten the box structure and deal with it
61 // the vector of box structures for contributing files components
62 std::vector<DataObjects::MDBoxFlatTree> m_fileComponentsStructure;
63
64protected:
66 // bool clonedFirst;
67 void clearEventLoaders();
68
72 std::string m_MDEventType;
73
77 std::vector<std::string> m_Filenames;
78
80 std::vector<API::IBoxControllerIO *> m_EventLoader;
81
84
86 uint64_t m_totalEvents;
87
89 uint64_t m_totalLoaded;
90
92 std::mutex m_fileMutex;
93
95 std::mutex m_statsMutex;
96
98 std::unique_ptr<Mantid::API::Progress> m_progress = nullptr;
99};
100
101} // namespace MDAlgorithms
102} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
The class responsible for saving/loading MD boxes structure to/from HDD and for flattening/restoring ...
Definition: MDBoxFlatTree.h:27
Algorithm to merge multiple MDEventWorkspaces from files that obey a common box format.
Definition: MergeMDFiles.h:26
std::mutex m_fileMutex
Mutex for file access.
Definition: MergeMDFiles.h:92
std::string m_MDEventType
string describes type of the event, stored in the workspaces.
Definition: MergeMDFiles.h:72
int version() const override
Algorithm's version for identification.
Definition: MergeMDFiles.h:40
std::vector< std::string > m_Filenames
Files to load.
Definition: MergeMDFiles.h:77
std::vector< API::IBoxControllerIO * > m_EventLoader
Vector of file handles to each input file //TODO unique?
Definition: MergeMDFiles.h:80
int m_nDims
number of workspace dimensions
Definition: MergeMDFiles.h:70
bool m_fileBasedTargetWS
if the workspace is indeed file-based
Definition: MergeMDFiles.h:75
DataObjects::MDBoxFlatTree m_BoxStruct
Definition: MergeMDFiles.h:60
std::vector< DataObjects::MDBoxFlatTree > m_fileComponentsStructure
Definition: MergeMDFiles.h:62
const std::string category() const override
Algorithm's category for identification.
Definition: MergeMDFiles.h:43
Mantid::API::IMDEventWorkspace_sptr m_OutIWS
Output IMDEventWorkspace.
Definition: MergeMDFiles.h:83
std::mutex m_statsMutex
Mutex for modifying stats.
Definition: MergeMDFiles.h:95
const std::string name() const override
Algorithm's name for identification.
Definition: MergeMDFiles.h:32
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: MergeMDFiles.h:41
const std::string summary() const override
Summary of algorithms purpose.
Definition: MergeMDFiles.h:34
std::shared_ptr< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
Helper class which provides the Collimation Length for SANS instruments.