Mantid
Loading...
Searching...
No Matches
AddPeakHKL.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
10
14
15namespace Mantid::Crystal {
16
17using namespace Mantid::Kernel;
18using namespace Mantid::API;
19
20// Register the algorithm into the AlgorithmFactory
21DECLARE_ALGORITHM(AddPeakHKL)
22
23//----------------------------------------------------------------------------------------------
24
25
26const std::string AddPeakHKL::name() const { return "AddPeakHKL"; }
27
29int AddPeakHKL::version() const { return 1; }
30
32const std::string AddPeakHKL::category() const { return "Crystal\\Peaks"; }
33
35const std::string AddPeakHKL::summary() const { return "Add a peak in the hkl frame"; }
36
37//----------------------------------------------------------------------------------------------
42 "An input workspace.");
43 declareProperty(std::make_unique<ArrayProperty<double>>("HKL", std::make_shared<ArrayLengthValidator<double>>(3)),
44 "HKL point to add");
45}
46
47//----------------------------------------------------------------------------------------------
51 IPeaksWorkspace_sptr peakWS = this->getProperty("Workspace");
52 const std::vector<double> hklValue = this->getProperty("HKL");
53 auto peak =
54 std::unique_ptr<Mantid::Geometry::IPeak>(peakWS->createPeakHKL(V3D(hklValue[0], hklValue[1], hklValue[2])));
55 peakWS->addPeak(*peak);
56}
57
58} // namespace Mantid::Crystal
std::string name
Definition Run.cpp:60
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
AddPeakHKL : Algorithm to add a peaks to a PeaksWorkspace in the HKL frame.
Definition AddPeakHKL.h:17
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
int version() const override
Algorithm's version for identification.
void exec() override
Execute the algorithm.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
ArrayLenghtValidator : Validate length of an array property.
Support for a property that holds an array of values.
Class for 3D vectors.
Definition V3D.h:34
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
STL namespace.
@ InOut
Both an input & output workspace.
Definition Property.h:55