Mantid
Loading...
Searching...
No Matches
Load.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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
11#include "MantidDataHandling/DllConfig.h"
12#include <mutex>
13
14namespace Mantid {
15namespace DataHandling {
16
23class MANTID_DATAHANDLING_DLL Load final : public API::Algorithm {
24public:
26 const std::string name() const override { return "Load"; }
28 const std::string summary() const override {
29 return "Attempts to load a given file by finding an appropriate Load "
30 "algorithm.";
31 }
32
34 int version() const override { return 1; }
35 const std::vector<std::string> seeAlso() const override { return {"LoadNexus", "LoadRaw", "LoadBBY"}; }
36
38 const std::string category() const override { return "DataHandling"; }
40 const std::string alias() const override { return "load"; }
42 void setPropertyValue(const std::string &name, const std::string &value) override;
43
44private:
47 API::IAlgorithm_sptr getFileLoader(const std::string &filePath);
48 void findFilenameProperty(const API::IAlgorithm_sptr &loader);
50 void declareLoaderProperties(const API::IAlgorithm_sptr &loader);
51
53 void init() override;
55 void exec() override;
56
58 void loadSingleFile();
60 void loadMultipleFiles();
61
63 void cancel() override;
65 API::IAlgorithm_sptr createLoader(const double startProgress = -1.0, const double endProgress = -1.0,
66 const bool logging = true) const;
68 void setUpLoader(const API::IAlgorithm_sptr &loader, const double startProgress = -1.0,
69 const double endProgress = -1.0, const bool logging = true) const;
71 void setOutputProperties(const API::IAlgorithm_sptr &loader);
73 API::Workspace_sptr getOutputWorkspace(const std::string &propName, const API::IAlgorithm_sptr &loader) const;
74
76 API::Workspace_sptr loadFileToWs(const std::string &fileName, const std::string &wsName);
80 API::WorkspaceGroup_sptr groupWsList(const std::vector<API::Workspace_sptr> &wsList);
81
83 std::unordered_set<std::string> m_baseProps;
88 std::string m_filenamePropName;
90 static std::recursive_mutex m_mutex;
91};
92
93} // namespace DataHandling
94} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
Loads a workspace from a data file.
Definition Load.h:23
const std::string summary() const override
Summary of algorithms purpose.
Definition Load.h:28
API::IAlgorithm_sptr m_loader
The actual loader.
Definition Load.h:85
static std::recursive_mutex m_mutex
Mutex for temporary fix for #5963.
Definition Load.h:90
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition Load.h:26
const std::string alias() const override
Aliases.
Definition Load.h:40
std::string m_filenamePropName
The name of the property that will be passed the property from our Filename.
Definition Load.h:88
const std::string category() const override
Category.
Definition Load.h:38
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 Load.h:35
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition Load.h:34
std::unordered_set< std::string > m_baseProps
The base properties.
Definition Load.h:83
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Helper class which provides the Collimation Length for SANS instruments.