Mantid
Loading...
Searching...
No Matches
Framework
MDAlgorithms
src
ConvertToDiffractionMDWorkspace2.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 +
7
#include "
MantidMDAlgorithms/ConvertToDiffractionMDWorkspace2.h
"
8
9
#include "
MantidAPI/IMDEventWorkspace.h
"
10
11
#include "
MantidDataObjects/EventWorkspace.h
"
12
#include "
MantidDataObjects/MDEventWorkspace.h
"
13
#include "
MantidDataObjects/Workspace2D.h
"
14
15
#include "
MantidKernel/ArrayProperty.h
"
16
#include "
MantidKernel/EnabledWhenProperty.h
"
17
#include "
MantidKernel/ListValidator.h
"
18
19
#include "
MantidMDAlgorithms/ConvertToMDMinMaxLocal.h
"
20
#include "
MantidMDAlgorithms/MDTransfFactory.h
"
21
#include "
MantidMDAlgorithms/MDWSTransform.h
"
22
23
#include <algorithm>
24
#include <limits>
25
26
using namespace
Mantid::API
;
27
using namespace
Mantid::Kernel
;
28
using namespace
Mantid::DataObjects
;
29
using namespace
Mantid::Geometry
;
30
31
namespace
Mantid::MDAlgorithms
{
32
33
// Register the algorithm into the AlgorithmFactory
34
DECLARE_ALGORITHM
(ConvertToDiffractionMDWorkspace2)
35
36
//----------------------------------------------------------------------------------------------
39
void
ConvertToDiffractionMDWorkspace2
::init() {
40
// initilise common properties between versions
41
BaseConvertToDiffractionMDWorkspace::init
();
42
43
std::vector<double> extents = {-50.0, 50.0};
44
declareProperty(std::make_unique<
ArrayProperty<double>
>(
"Extents"
, std::move(extents)),
45
"A comma separated list of min, max for each dimension,\n"
46
"specifying the extents of each dimension. Optional, default "
47
"+- 50 in each dimension."
);
48
setPropertyGroup(
"Extents"
, getBoxSettingsGroupName());
49
}
50
58
void
ConvertToDiffractionMDWorkspace2::convertExtents
(
const
std::vector<double> &Extents, std::vector<double> &minVal,
59
std::vector<double> &maxVal) {
60
minVal.resize(3);
61
maxVal.resize(3);
62
if
(Extents.size() == 2) {
63
for
(
size_t
d
= 0;
d
< 3;
d
++) {
64
minVal[
d
] = Extents[0];
65
maxVal[
d
] = Extents[1];
66
}
67
}
else
if
(Extents.size() == 6) {
68
for
(
size_t
d
= 0;
d
< 3;
d
++) {
69
minVal[
d
] = Extents[2 *
d
+ 0];
70
maxVal[
d
] = Extents[2 *
d
+ 1];
71
}
72
}
else
73
throw
std::invalid_argument(
"You must specify either 2 or 6 extents (min,max)."
);
74
}
75
76
}
// namespace Mantid::MDAlgorithms
DECLARE_ALGORITHM
#define DECLARE_ALGORITHM(classname)
Definition
Algorithm.h:538
ArrayProperty.h
ConvertToDiffractionMDWorkspace2.h
ConvertToMDMinMaxLocal.h
EnabledWhenProperty.h
EventWorkspace.h
IMDEventWorkspace.h
ListValidator.h
MDEventWorkspace.h
MDTransfFactory.h
MDWSTransform.h
Workspace2D.h
Mantid::Kernel::ArrayProperty
Support for a property that holds an array of values.
Definition
ArrayProperty.h:28
Mantid::MDAlgorithms::BaseConvertToDiffractionMDWorkspace::init
void init() override
Initialize the algorithm's properties.
Definition
BaseConvertToDiffractionMDWorkspace.cpp:43
Mantid::MDAlgorithms::ConvertToDiffractionMDWorkspace2
ConvertToDiffractionMDWorkspace2 : Create a MDEventWorkspace with events in reciprocal space (Qx,...
Definition
ConvertToDiffractionMDWorkspace2.h:25
Mantid::MDAlgorithms::ConvertToDiffractionMDWorkspace2::convertExtents
void convertExtents(const std::vector< double > &Extents, std::vector< double > &minVal, std::vector< double > &maxVal) override
Splits extents accepted by convertToDiffreactionMD workspace in the form min1,max1 or min1,...
Definition
ConvertToDiffractionMDWorkspace2.cpp:58
Mantid::API
Definition
AbsorptionCorrection.h:20
Mantid::DataObjects
Definition
ConjoinWorkspaces.h:17
Mantid::Geometry
Definition
AbsorptionCorrection.h:23
Mantid::Geometry::d
I a m d
Definition
SpaceGroupFactory.cpp:673
Mantid::Kernel
Definition
AnnularRingAbsorption.h:15
Mantid::MDAlgorithms
Definition
AccumulateMD.h:22
Generated by
1.9.8