Mantid
Loading...
Searching...
No Matches
IMDDimension.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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#pragma once
8
9#include "MantidGeometry/DllConfig.h"
12#include "MantidKernel/MDUnit.h"
13#include "MantidKernel/V3D.h"
14#ifndef Q_MOC_RUN
15#include <memory>
16#endif
17#include <stdexcept>
18#include <vector>
19
20namespace Mantid {
21namespace Kernel {
22//---------------------------------------------------------------------------
23// Forward declarations
24//---------------------------------------------------------------------------
25class UnitLabel;
26} // namespace Kernel
27
28namespace Geometry {
39class MANTID_GEOMETRY_DLL IMDDimension {
40public:
42 virtual ~IMDDimension() = default;
43
45 virtual std::string getName() const = 0;
46
48 virtual const Geometry::MDFrame &getMDFrame() const = 0;
49
51 virtual const Kernel::UnitLabel getUnits() const = 0;
52
54 virtual const Kernel::MDUnit &getMDUnits() const = 0;
55
60 virtual const std::string &getDimensionId() const = 0;
61
63 virtual coord_t getMinimum() const = 0;
64
66 virtual coord_t getMaximum() const = 0;
67
70 virtual size_t getNBins() const = 0;
71
73 virtual size_t getNBoundaries() const = 0;
74
76 virtual std::string toXMLString() const = 0;
77
81 virtual void setRange(size_t nBins, coord_t min, coord_t max) = 0;
82
85 virtual coord_t getX(size_t ind) const = 0;
86
88 virtual coord_t getBinWidth() const { return (getMaximum() - getMinimum()) / static_cast<coord_t>(getNBins()); }
89
91 virtual bool getIsIntegrated() const { return getNBins() == 1; }
92
93 bool operator==(const IMDDimension &) const { throw std::runtime_error("Not Implemented."); }
94 bool operator!=(const IMDDimension &) const { throw std::runtime_error("Not Implemented."); }
95};
96
98using IMDDimension_sptr = std::shared_ptr<IMDDimension>;
101using IMDDimension_const_sptr = std::shared_ptr<const IMDDimension>;
103using VecIMDDimension_const_sptr = std::vector<IMDDimension_const_sptr>;
105using VecIMDDimension_sptr = std::vector<IMDDimension_sptr>;
106} // namespace Geometry
107} // namespace Mantid
The class describes one dimension of multidimensional dataset representing an orthogonal dimension an...
Definition: IMDDimension.h:39
virtual bool getIsIntegrated() const
Definition: IMDDimension.h:91
virtual coord_t getMaximum() const =0
virtual coord_t getMinimum() const =0
virtual ~IMDDimension()=default
Destructor.
virtual std::string getName() const =0
virtual const Geometry::MDFrame & getMDFrame() const =0
virtual const Kernel::UnitLabel getUnits() const =0
virtual const Kernel::MDUnit & getMDUnits() const =0
virtual const std::string & getDimensionId() const =0
short name which identify the dimension among other dimension.
bool operator==(const IMDDimension &) const
Definition: IMDDimension.h:93
virtual void setRange(size_t nBins, coord_t min, coord_t max)=0
Change the extents and number of bins.
virtual coord_t getBinWidth() const
Definition: IMDDimension.h:88
virtual std::string toXMLString() const =0
bool operator!=(const IMDDimension &) const
Definition: IMDDimension.h:94
virtual coord_t getX(size_t ind) const =0
virtual size_t getNBoundaries() const =0
virtual size_t getNBins() const =0
MDFrame : The coordinate frame for a dimension, or set of dimensions in a multidimensional workspace.
Definition: MDFrame.h:22
MDUnit : Unit type for multidimensional data types.
Definition: MDUnit.h:20
A base-class for the a class that is able to return unit labels in different representations.
Definition: UnitLabel.h:20
std::shared_ptr< IMDDimension > IMDDimension_sptr
Shared Pointer for IMDDimension. Frequently used type in framework.
Definition: IMDDimension.h:98
std::vector< IMDDimension_const_sptr > VecIMDDimension_const_sptr
Vector of constant shared pointers to IMDDimensions.
Definition: IMDDimension.h:103
std::vector< IMDDimension_sptr > VecIMDDimension_sptr
Vector of shared pointers to IMDDimensions.
Definition: IMDDimension.h:105
std::shared_ptr< const IMDDimension > IMDDimension_const_sptr
Shared Pointer to const IMDDimension.
Definition: IMDDimension.h:101
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27