"git@code.ornl.gov:pnb/ADIOS2.git" did not exist on "938e0538001b1c3a1e12fc083d3220fc07363258"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "MantidDataObjects/MDFramesToSpecialCoordinateSystem.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include <boost/pointer_cast.hpp>
namespace Mantid {
namespace DataObjects {
MDFramesToSpecialCoordinateSystem::MDFramesToSpecialCoordinateSystem() {}
MDFramesToSpecialCoordinateSystem::~MDFramesToSpecialCoordinateSystem() {}
/**
* Return a common
*/
Mantid::Kernel::SpecialCoordinateSystem MDFramesToSpecialCoordinateSystem::
operator()(Mantid::API::IMDWorkspace_const_sptr workspace) const {
// Make sure that the workspaces are either an MDHisto or MDEvent workspaces
if (!boost::dynamic_pointer_cast<const Mantid::API::IMDEventWorkspace>(workspace) &&
!boost::dynamic_pointer_cast<const Mantid::API::IMDHistoWorkspace>(workspace)) {
throw std::invalid_argument("Error in MDFrameFromWorkspace: Can only "
"extract MDFrame from MDEvent and MDHisto "
"workspaces");
}
// Extract expected special coordinate system
auto coordinteSystem = extractCoordinateSystem(workspace->getDimension(0));
for (size_t dimIndex = 0; dimIndex < workspace->getNumDims(); ++dimIndex) {
auto current = extractCoordinateSystem(workspace->getDimension(dimIndex));
if (coordinteSystem == current) {
coordinteSystem = current;
} else {
throw std::invalid_argument("Error in MDFrameFromWorkspace: Coordinate "
"system in the different dimensions don't "
"match.");
}
}
return coordinteSystem;
}
Mantid::Kernel::SpecialCoordinateSystem
MDFramesToSpecialCoordinateSystem::extractCoordinateSystem(
Mantid::Geometry::IMDDimension_const_sptr dimension) const {
auto &frame = dimension->getMDFrame();
return frame.equivalientSpecialCoordinateSystem();
}
}
}