Mantid
Loading...
Searching...
No Matches
CoordTransform.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 +
10#include "MantidKernel/Matrix.h"
11#include "MantidKernel/VMD.h"
12#include <boost/algorithm/string.hpp>
13#include <boost/format.hpp>
14
15using namespace Mantid::Geometry;
16using namespace Mantid::Kernel;
17
18namespace Mantid::API {
19
20//----------------------------------------------------------------------------------------------
27CoordTransform::CoordTransform(const size_t inD, const size_t outD) : inD(inD), outD(outD) {
28 if (outD > inD)
29 throw std::runtime_error("CoordTransform: Cannot have more output "
30 "dimensions than input dimensions!");
31 if (outD == 0)
32 throw std::runtime_error("CoordTransform: invalid number of output dimensions!");
33 if (inD == 0)
34 throw std::runtime_error("CoordTransform: invalid number of input dimensions!");
35}
36
37//----------------------------------------------------------------------------------------------
45 if (inputVector.getNumDims() != inD)
46 throw std::runtime_error("CoordTransform::apply(): inputVector has the "
47 "wrong number of coordinates!");
48 auto outArray = new coord_t[outD];
49 this->apply(inputVector.getBareArray(), outArray);
50 VMD out(outD, outArray);
51 delete[] outArray;
52 return out;
53}
54
55} // namespace Mantid::API
size_t inD
Input number of dimensions.
Mantid::Kernel::VMD applyVMD(const Mantid::Kernel::VMD &inputVector) const
Wrapper for VMD.
size_t outD
Output number of dimensions.
CoordTransform(const size_t inD, const size_t outD)
Constructor.
virtual void apply(const coord_t *inputVector, coord_t *outVector) const =0
const TYPE * getBareArray() const
Definition VMD.cpp:248
size_t getNumDims() const
Definition VMD.cpp:236
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition MDTypes.h:27