-
Notifications
You must be signed in to change notification settings - Fork 122
/
IMDWorkspace.h
143 lines (120 loc) · 5.22 KB
/
IMDWorkspace.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef MANTID_API_IMDWORKSPACE_H_
#define MANTID_API_IMDWORKSPACE_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <stdint.h>
#include "MantidAPI/Workspace.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
#include <vector>
#include <stdarg.h>
#include "MantidAPI/MDGeometry.h"
#include "MantidGeometry/MDGeometry/MDImplicitFunction.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidKernel/SpecialCoordinateSystem.h"
#include "MantidAPI/ITableWorkspace.h"
namespace Mantid {
namespace API {
class IMDIterator;
/** Enum describing different ways to normalize the signal
* in a MDWorkspace.
*/
enum MDNormalization {
/// Don't normalize = return raw counts
NoNormalization = 0,
/// Divide the signal by the volume of the box/bin
VolumeNormalization = 1,
/// Divide the signal by the number of events that contributed to it.
NumEventsNormalization = 2
};
/** Basic MD Workspace Abstract Class.
*
* This defines the interface that allows one to iterate through several types
of workspaces:
*
* - The regularly gridded MDHistoWorkspace
* - The recursively binned MDEventWorkspace
* - The regular (2D) MatrixWorkspace.
*
@author Janik Zikovsky
@date 04/10/2010
Copyright © 2007-2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_API_DLL IMDWorkspace : public Workspace, public API::MDGeometry {
public:
IMDWorkspace();
IMDWorkspace(const IMDWorkspace &other);
virtual ~IMDWorkspace();
/// Get the number of points associated with the workspace.
/// For MDEvenWorkspace it is the number of events contributing into the
/// workspace
/// For regularly gridded workspace (MDHistoWorkspace and MatrixWorkspace), it
/// is
/// the number of bins.
virtual uint64_t getNPoints() const = 0;
/*** Get the number of events, associated with the workspace
* For MDEvenWorkspace it is equal to the number of points
* For regularly gridded workspace (MDHistoWorkspace and MatrixWorkspace),
* it is the number of contributed non-zero events.
*/
virtual uint64_t getNEvents() const = 0;
/// Creates a new iterator pointing to the first cell in the workspace
virtual std::vector<IMDIterator *> createIterators(
size_t suggestedNumCores = 1,
Mantid::Geometry::MDImplicitFunction *function = NULL) const = 0;
/// Returns the (normalized) signal at a given coordinates
virtual signal_t
getSignalAtCoord(const coord_t *coords,
const Mantid::API::MDNormalization &normalization) const = 0;
/// Method to generate a line plot through a MD-workspace
virtual void getLinePlot(const Mantid::Kernel::VMD &start,
const Mantid::Kernel::VMD &end,
Mantid::API::MDNormalization normalize,
std::vector<coord_t> &x, std::vector<signal_t> &y,
std::vector<signal_t> &e) const;
IMDIterator *
createIterator(Mantid::Geometry::MDImplicitFunction *function = NULL) const;
signal_t getSignalAtVMD(const Mantid::Kernel::VMD &coords,
const Mantid::API::MDNormalization &normalization =
Mantid::API::VolumeNormalization) const;
/// Setter for the masking region.
virtual void
setMDMasking(Mantid::Geometry::MDImplicitFunction *maskingRegion) = 0;
/// Clear existing masks
virtual void clearMDMasking() = 0;
///
virtual Kernel::SpecialCoordinateSystem
getSpecialCoordinateSystem() const = 0;
/// if a workspace was filebacked, this should clear file-based status, delete
/// file-based information and close related files.
virtual void clearFileBacked(bool /* loadFileContentsToMemory*/) {}
/// this is the method to build table workspace from any workspace. It does
/// not have much sence and may be placed here erroneously
virtual ITableWorkspace_sptr makeBoxTable(size_t /*start*/, size_t /* num*/) {
throw Kernel::Exception::NotImplementedError(
"This method is not generally implemented ");
}
protected:
virtual const std::string toString() const;
};
/// Shared pointer to the IMDWorkspace base class
typedef boost::shared_ptr<IMDWorkspace> IMDWorkspace_sptr;
/// Shared pointer to the IMDWorkspace base class (const version)
typedef boost::shared_ptr<const IMDWorkspace> IMDWorkspace_const_sptr;
}
}
#endif // MANTID_API_IMDWORKSPACE_H_