Mantid
Loading...
Searching...
No Matches
HasUB.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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
9using namespace Mantid::API;
10using namespace Mantid::Kernel;
11
12namespace Mantid::Crystal {
13
14// Register the algorithm into the AlgorithmFactory
16
17//----------------------------------------------------------------------------------------------
19const std::string HasUB::name() const { return "HasUB"; }
20
22int HasUB::version() const { return 1; }
23
25const std::string HasUB::category() const { return "Crystal\\UBMatrix"; }
26
27//----------------------------------------------------------------------------------------------
28
29//----------------------------------------------------------------------------------------------
33 declareProperty(std::make_unique<WorkspaceProperty<Workspace>>("Workspace", "", Direction::Input),
34 "Workspace to clear the UB from.");
35 declareProperty(std::make_unique<PropertyWithValue<bool>>("HasUB", false, Direction::Output),
36 "Indicates action performed, or predicted to perform if DryRun.");
37}
38
39//----------------------------------------------------------------------------------------------
43 Workspace_sptr ws = this->getProperty("Workspace");
44 bool hasUB = ClearUB::doExecute(ws.get(), true /*DryRun*/);
45 this->setProperty("HasUB", hasUB);
46}
47
48} // namespace Mantid::Crystal
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Definition: Algorithm.cpp:1913
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Definition: Algorithm.cpp:2076
A property class for workspaces.
bool doExecute(Mantid::API::Workspace *const ws, bool dryRun)
Perform the working for the algorithm.
Definition: ClearUB.cpp:70
HasUB : Determine if a workspace has a UB matrix on any of it's samples.
Definition: HasUB.h:20
int version() const override
Algorithm's version for identification.
Definition: HasUB.cpp:22
void init() override
Initialize the algorithm's properties.
Definition: HasUB.cpp:32
const std::string category() const override
Algorithm's category for identification.
Definition: HasUB.cpp:25
void exec() override
Execute the algorithm.
Definition: HasUB.cpp:42
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
The concrete, templated class for properties.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
STL namespace.
@ Input
An input workspace.
Definition: Property.h:53
@ Output
An output workspace.
Definition: Property.h:54