Mantid
Loading...
Searching...
No Matches
FakeObjects.h
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/*********************************************************************************
8 * PLEASE READ THIS!!!!!!!
9 *
10 * This header MAY NOT be included in any test from a package below API
11 * (e.g. Kernel, Geometry).
12 * Conversely, this file MAY NOT be modified to use anything from a package
13 *higher
14 * than API (e.g. any algorithm or concrete workspace), even if via the
15 *factory.
16 *********************************************************************************/
17#pragma once
18
19/*
20 * FakeObjects.h: Fake Tester objects for APITest
21 *
22 * Created on: Jul 5, 2011
23 * Author: Janik Zikovsky
24 */
25
26#include <algorithm>
27#include <fstream>
28#include <map>
29#include <string>
30
32#include "MantidAPI/ISpectrum.h"
35#include "MantidAPI/RefAxis.h"
43
44using namespace Mantid::API;
45using namespace Mantid::Geometry;
46using Mantid::coord_t;
47using Mantid::detid_t;
52
53//===================================================================================================================
55class SpectrumTester : public ISpectrum {
56public:
57 SpectrumTester(Mantid::HistogramData::Histogram::XMode xmode, Mantid::HistogramData::Histogram::YMode ymode)
58 : ISpectrum(), m_histogram(xmode, ymode) {
59 m_histogram.setCounts(0);
60 m_histogram.setCountStandardDeviations(0);
61 }
62 SpectrumTester(const specnum_t specNo, Mantid::HistogramData::Histogram::XMode xmode,
63 Mantid::HistogramData::Histogram::YMode ymode)
64 : ISpectrum(specNo), m_histogram(xmode, ymode) {
65 m_histogram.setCounts(0);
66 m_histogram.setCountStandardDeviations(0);
67 }
68
69 void copyDataFrom(const ISpectrum &other) override { other.copyDataInto(*this); }
70
72 MantidVec &dataX() override { return m_histogram.dataX(); }
73 const MantidVec &dataX() const override { return m_histogram.dataX(); }
74 const MantidVec &readX() const override { return m_histogram.readX(); }
76
77 MantidVec &dataDx() override { return m_histogram.dataDx(); }
78 const MantidVec &dataDx() const override { return m_histogram.dataDx(); }
79 const MantidVec &readDx() const override { return m_histogram.readDx(); }
80
81 MantidVec &dataY() override { return m_histogram.dataY(); }
82 MantidVec &dataE() override { return m_histogram.dataE(); }
83
84 const MantidVec &dataY() const override { return m_histogram.dataY(); }
85 const MantidVec &dataE() const override { return m_histogram.dataE(); }
86
87 size_t getMemorySize() const override { return readY().size() * sizeof(double) * 2; }
88
90 void clearData() override {
91 // Assign the value to the data and error arrays
92 MantidVec &yValues = this->dataY();
93 std::fill(yValues.begin(), yValues.end(), 0.0);
94 MantidVec &eValues = this->dataE();
95 std::fill(eValues.begin(), eValues.end(), 0.0);
96 }
97
98protected:
99 Mantid::HistogramData::Histogram m_histogram;
100
101private:
103 void copyDataInto(SpectrumTester &other) const override { other.m_histogram = m_histogram; }
104
105 const Mantid::HistogramData::Histogram &histogramRef() const override { return m_histogram; }
106 Mantid::HistogramData::Histogram &mutableHistogramRef() override { return m_histogram; }
107};
108
109//===================================================================================================================
110
112public:
113 const std::string id() const override { return "FakeWorkspace"; }
114 Workspace *doClone() const override { return new FakeWorkspace(*this); }
115 Workspace *doCloneEmpty() const override { return new FakeWorkspace; }
116 const std::string toString() const override { return "FakeWorkspace instance"; }
117 size_t getMemorySize() const override { return 0; }
118};
119
120//===================================================================================================================
122public:
123 AxeslessWorkspaceTester(const Mantid::Parallel::StorageMode storageMode = Mantid::Parallel::StorageMode::Cloned)
125
126 bool isRaggedWorkspace() const override {
127 if (m_vec.empty()) {
128 throw std::runtime_error("Vector data is empty, cannot check for ragged workspace.");
129 } else {
130 const auto numberOfBins = m_vec[0].dataY().size();
131 return std::any_of(m_vec.cbegin(), m_vec.cend(),
132 [&numberOfBins](const auto &spectrum) { return numberOfBins != spectrum.dataY().size(); });
133 }
134 }
135
136 // Empty overrides of virtual methods
137 size_t getNumberHistograms() const override { return m_spec; }
138 const std::string id() const override { return "AxeslessWorkspaceTester"; }
139 size_t size() const override {
140 return std::accumulate(m_vec.cbegin(), m_vec.cend(), static_cast<size_t>(0),
141 [](size_t total, const SpectrumTester &i) { return total + i.dataY().size(); });
142 }
143 size_t blocksize() const override {
144 if (m_vec.empty()) {
145 return 0;
146 } else {
147 size_t numY = m_vec[0].dataY().size();
148 if (std::any_of(m_vec.cbegin(), m_vec.cend(), [numY](auto it) { return it.dataY().size() != numY; })) {
149 throw std::logic_error("non-constant number of bins");
150 }
151 return numY;
152 }
153 return m_vec.empty() ? 0 : m_vec[0].dataY().size();
154 }
155
156 std::size_t getNumberBins(const std::size_t &index) const override {
157 if (index > m_vec.size())
158 return 0;
159 return m_vec[index].dataY().size();
160 }
161
162 std::size_t getMaxNumberBins() const override {
163 if (m_vec.empty()) {
164 return 0;
165 } else {
166 const auto iter =
167 std::max_element(m_vec.cbegin(), m_vec.cend(), [](const SpectrumTester &s1, const SpectrumTester &s2) {
168 return s1.dataY().size() < s2.dataY().size();
169 });
170 return iter->dataY().size();
171 }
172 }
173
174 ISpectrum &getSpectrum(const size_t index) override {
176 m_vec[index].setMatrixWorkspace(this, index);
177 return m_vec[index];
178 }
179 const ISpectrum &getSpectrum(const size_t index) const override { return m_vec[index]; }
180 void generateHistogram(const std::size_t, const MantidVec &, MantidVec &, MantidVec &, bool) const override {}
182
183protected:
184 void init(const size_t &numspec, const size_t &j, const size_t &k) override {
185 m_spec = numspec;
186 m_vec.resize(m_spec, SpectrumTester(Mantid::HistogramData::getHistogramXMode(j, k),
187 Mantid::HistogramData::Histogram::YMode::Counts));
188 for (size_t i = 0; i < m_spec; i++) {
189 m_vec[i].setMatrixWorkspace(this, i);
190 m_vec[i].dataX().resize(j, 1.0);
191 m_vec[i].dataY().resize(k, 1.0);
192 m_vec[i].dataE().resize(k, 1.0);
193 m_vec[i].addDetectorID(detid_t(i));
194 m_vec[i].setSpectrumNo(specnum_t(i + 1));
195 }
196 }
197 void init(const Mantid::HistogramData::Histogram &histogram) override {
199 m_vec.resize(m_spec, SpectrumTester(histogram.xMode(), histogram.yMode()));
200 for (size_t i = 0; i < m_spec; i++) {
201 m_vec[i].setHistogram(histogram);
202 m_vec[i].addDetectorID(detid_t(i));
203 m_vec[i].setSpectrumNo(specnum_t(i + 1));
204 }
205 }
206
207 AxeslessWorkspaceTester *doClone() const override { return new AxeslessWorkspaceTester(*this); }
209 throw std::runtime_error("Cloning of AxeslessWorkspaceTester is not implemented.");
210 }
211
212private:
213 std::vector<SpectrumTester> m_vec;
214 size_t m_spec;
216 m_vec[index].setMatrixWorkspace(this, index);
217 return m_vec[index];
218 }
219};
220
222public:
223 WorkspaceTester(const Mantid::Parallel::StorageMode storageMode = Mantid::Parallel::StorageMode::Cloned)
225
226 const std::string id() const override { return "WorkspaceTester"; }
227
229 std::unique_ptr<WorkspaceTester> clone() const { return std::unique_ptr<WorkspaceTester>(doClone()); }
230
232 std::unique_ptr<WorkspaceTester> cloneEmpty() const { return std::unique_ptr<WorkspaceTester>(doCloneEmpty()); }
233
234protected:
235 void init(const size_t &numspec, const size_t &j, const size_t &k) override {
236 AxeslessWorkspaceTester::init(numspec, j, k);
237
238 // Put an 'empty' axis in to test the getAxis method
239 m_axes.resize(2);
240 m_axes[0] = std::make_unique<Mantid::API::RefAxis>(this);
241 m_axes[1] = std::make_unique<Mantid::API::SpectraAxis>(this);
242 }
243 void init(const Mantid::HistogramData::Histogram &histogram) override {
245
246 // Put an 'empty' axis in to test the getAxis method
247 m_axes.resize(2);
248 m_axes[0] = std::make_unique<Mantid::API::RefAxis>(this);
249 m_axes[1] = std::make_unique<Mantid::API::SpectraAxis>(this);
250 }
251
252private:
253 WorkspaceTester *doClone() const override { return new WorkspaceTester(*this); }
254 WorkspaceTester *doCloneEmpty() const override { return new WorkspaceTester(storageMode()); }
255};
256
257//===================================================================================================================
259public:
261 std::unique_ptr<TableWorkspaceTester> clone() const { return std::unique_ptr<TableWorkspaceTester>(doClone()); }
262
264 std::unique_ptr<TableWorkspaceTester> cloneEmpty() const {
265 return std::unique_ptr<TableWorkspaceTester>(doCloneEmpty());
266 }
267
268 const std::string id() const override { return "TableWorkspaceTester"; }
269
270 size_t getMemorySize() const override { throw std::runtime_error("getMemorySize not implemented"); }
271
272 Column_sptr addColumn(const std::string &, const std::string &) override {
273 throw std::runtime_error("addColumn not implemented");
274 }
275
276 LogManager_sptr logs() override { throw std::runtime_error("logs not implemented"); }
277
278 LogManager_const_sptr getLogs() const override { throw std::runtime_error("getLogs not implemented"); }
279
280 void removeColumn(const std::string &) override { throw std::runtime_error("removeColumn not implemented"); }
281
282 size_t columnCount() const override { throw std::runtime_error("columnCount not implemented"); }
283
284 Column_sptr getColumn(const std::string &) override { throw std::runtime_error("getColumn(str) not implemented"); }
285
286 Column_const_sptr getColumn(const std::string &) const override {
287 throw std::runtime_error("getColumn(str) const not implemented");
288 }
289
290 Column_sptr getColumn(size_t) override { throw std::runtime_error("getColumn(size_t) not implemented"); }
291
292 Column_const_sptr getColumn(size_t) const override {
293 throw std::runtime_error("getColumn(size_t) const not implemented");
294 }
295
296 std::vector<std::string> getColumnNames() const override {
297 throw std::runtime_error("getColumnNames not implemented");
298 }
299
300 size_t rowCount() const override { throw std::runtime_error("rowCount not implemented"); }
301
302 void setRowCount(size_t) override { throw std::runtime_error("setRowCount not implemented"); }
303
304 size_t insertRow(size_t) override { throw std::runtime_error("insertRow not implemented"); }
305
306 void removeRow(size_t) override { throw std::runtime_error("removeRow not implemented"); }
307
308 void find(size_t, size_t &, size_t) override { throw std::runtime_error("find not implemented"); }
309
310 void find(double, size_t &, size_t) override { throw std::runtime_error("find not implemented"); }
311
312 void find(float, size_t &, size_t) override { throw std::runtime_error("find not implemented"); }
313
314 void find(Boolean, size_t &, size_t) override { throw std::runtime_error("find not implemented"); }
315
316 void find(const std::string &, size_t &, size_t) override { throw std::runtime_error("find not implemented"); }
317
318 void find(const Mantid::Kernel::V3D &, size_t &, size_t) override {
319 throw std::runtime_error("find not implemented");
320 }
321
322private:
323 TableWorkspaceTester *doClone() const override {
324 throw std::runtime_error("Cloning of TableWorkspaceTester is not implemented.");
325 }
327 throw std::runtime_error("Cloning of TableWorkspaceTester is not implemented.");
328 }
329 ITableWorkspace *doCloneColumns(const std::vector<std::string> &) const override {
330 throw std::runtime_error("Cloning of TableWorkspaceTester is not implemented.");
331 }
332};
333
334//===================================================================================================================
335class ColumnTester : public Column {
336 size_t size() const override { throw std::runtime_error("size not implemented"); }
337
338 std::type_info &get_type_info() const override { throw std::runtime_error("get_type_info not implemented"); }
339
340 std::type_info &get_pointer_type_info() const override {
341 throw std::runtime_error("get_pointer_type_info not implemented");
342 }
343
344 void print(size_t, std::ostream &) const override { throw std::runtime_error("print not implemented"); }
345
346 bool isBool() const override { throw std::runtime_error("isBool not implemented"); }
347
348 bool isNumber() const override { throw std::runtime_error("isNumber not implemented"); }
349
350 long int sizeOfData() const override { throw std::runtime_error("sizeOfData not implemented"); }
351
352 Column *clone() const override { throw std::runtime_error("clone not implemented"); }
353
354 double toDouble(size_t) const override { throw std::runtime_error("toDouble not implemented"); }
355
356 void fromDouble(size_t, double) override { throw std::runtime_error("fromDouble not implemented"); }
357
358protected:
359 void resize(size_t) override { throw std::runtime_error("resize not implemented"); }
360 void insert(size_t) override { throw std::runtime_error("insert not implemented"); }
361 void remove(size_t) override { throw std::runtime_error("remove not implemented"); }
362 void *void_pointer(size_t) override { throw std::runtime_error("void_pointer not implemented"); }
363 const void *void_pointer(size_t) const override { throw std::runtime_error("void_pointer const not implemented"); }
364};
365
366//===================================================================================================================
368
369public:
370 uint64_t getNPoints() const override { throw std::runtime_error("Not Implemented"); }
371 uint64_t getNEvents() const override { throw std::runtime_error("Not Implemented"); }
372
373 std::vector<std::unique_ptr<IMDIterator>>
374 createIterators(size_t suggestedNumCores = 1,
375 Mantid::Geometry::MDImplicitFunction *function = nullptr) const override {
376 UNUSED_ARG(suggestedNumCores)
377 UNUSED_ARG(function)
378 throw std::runtime_error("Not Implemented");
379 }
380
381 signal_t getSignalAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const override {
382 UNUSED_ARG(coords);
383 UNUSED_ARG(normalization);
384 throw std::runtime_error("Not Implemented");
385 }
386
388 const Mantid::API::MDNormalization &normalization) const override {
389 UNUSED_ARG(coords);
390 UNUSED_ARG(normalization);
391 throw std::runtime_error("Not Implemented");
392 }
393
394 void setMDMasking(std::unique_ptr<Mantid::Geometry::MDImplicitFunction> maskingRegion) override {
395 UNUSED_ARG(maskingRegion);
396 throw std::runtime_error("Not Implemented");
397 }
398
399 void clearMDMasking() override { throw std::runtime_error("Not Implemented"); }
400
401 SpecialCoordinateSystem getSpecialCoordinateSystem() const override { throw std::runtime_error("Not Implemented"); }
402
403 coord_t getInverseVolume() const override { throw std::runtime_error("Not Implemented"); }
404
405 const signal_t *getSignalArray() const override { throw std::runtime_error("Not Implemented"); }
406
407 const signal_t *getErrorSquaredArray() const override { throw std::runtime_error("Not Implemented"); }
408
409 const signal_t *getNumEventsArray() const override { throw std::runtime_error("Not Implemented"); }
410
411 signal_t *mutableSignalArray() override { throw std::runtime_error("Not Implemented"); }
412
413 signal_t *mutableErrorSquaredArray() override { throw std::runtime_error("Not Implemented"); }
414
415 signal_t *mutableNumEventsArray() override { throw std::runtime_error("Not Implemented"); }
416
417 void setTo(signal_t signal, signal_t errorSquared, signal_t numEvents) override {
418 UNUSED_ARG(signal);
419 UNUSED_ARG(errorSquared);
420 UNUSED_ARG(numEvents);
421 throw std::runtime_error("Not Implemented");
422 }
423
424 Mantid::Kernel::VMD getCenter(size_t linearIndex) const override {
425 UNUSED_ARG(linearIndex);
426 throw std::runtime_error("Not Implemented");
427 }
428
429 void setSignalAt(size_t index, signal_t value) override {
432 throw std::runtime_error("Not Implemented");
433 }
434
435 void setErrorSquaredAt(size_t index, signal_t value) override {
438 throw std::runtime_error("Not Implemented");
439 }
440
441 signal_t getErrorAt(size_t index) const override {
443 throw std::runtime_error("Not Implemented");
444 }
445
446 signal_t getErrorAt(size_t index1, size_t index2) const override {
447 UNUSED_ARG(index1)
448 UNUSED_ARG(index2)
449 throw std::runtime_error("Not Implemented");
450 }
451
452 signal_t getErrorAt(size_t index1, size_t index2, size_t index3) const override {
453 UNUSED_ARG(index1)
454 UNUSED_ARG(index2)
455 UNUSED_ARG(index3)
456 throw std::runtime_error("Not Implemented");
457 }
458
459 signal_t getErrorAt(size_t index1, size_t index2, size_t index3, size_t index4) const override {
460 UNUSED_ARG(index1)
461 UNUSED_ARG(index2)
462 UNUSED_ARG(index3)
463 UNUSED_ARG(index4)
464 throw std::runtime_error("Not Implemented");
465 }
466
467 signal_t getSignalAt(size_t index) const override {
469 throw std::runtime_error("Not Implemented");
470 }
471
472 signal_t getSignalAt(size_t index1, size_t index2) const override {
473 UNUSED_ARG(index1)
474 UNUSED_ARG(index2)
475 throw std::runtime_error("Not Implemented");
476 }
477
478 signal_t getSignalAt(size_t index1, size_t index2, size_t index3) const override {
479 UNUSED_ARG(index1)
480 UNUSED_ARG(index2)
481 UNUSED_ARG(index3)
482 throw std::runtime_error("Not Implemented");
483 }
484
485 signal_t getSignalAt(size_t index1, size_t index2, size_t index3, size_t index4) const override {
486 UNUSED_ARG(index1)
487 UNUSED_ARG(index2)
488 UNUSED_ARG(index3)
489 UNUSED_ARG(index4)
490 throw std::runtime_error("Not Implemented");
491 }
492
493 signal_t getSignalNormalizedAt(size_t index) const override {
495 throw std::runtime_error("Not Implemented");
496 }
497
498 signal_t getSignalNormalizedAt(size_t index1, size_t index2) const override {
499 UNUSED_ARG(index1)
500 UNUSED_ARG(index2)
501 throw std::runtime_error("Not Implemented");
502 }
503
504 signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3) const override {
505 UNUSED_ARG(index1)
506 UNUSED_ARG(index2)
507 UNUSED_ARG(index3)
508 throw std::runtime_error("Not Implemented");
509 }
510
511 signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const override {
512 UNUSED_ARG(index1)
513 UNUSED_ARG(index2)
514 UNUSED_ARG(index3)
515 UNUSED_ARG(index4)
516 throw std::runtime_error("Not Implemented");
517 }
518
519 signal_t getErrorNormalizedAt(size_t index) const override {
521 throw std::runtime_error("Not Implemented");
522 }
523
524 signal_t getErrorNormalizedAt(size_t index1, size_t index2) const override {
525 UNUSED_ARG(index1)
526 UNUSED_ARG(index2)
527 throw std::runtime_error("Not Implemented");
528 }
529
530 signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3) const override {
531 UNUSED_ARG(index1)
532 UNUSED_ARG(index2)
533 UNUSED_ARG(index3)
534 throw std::runtime_error("Not Implemented");
535 }
536
537 signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const override {
538 UNUSED_ARG(index1)
539 UNUSED_ARG(index2)
540 UNUSED_ARG(index3)
541 UNUSED_ARG(index4)
542 throw std::runtime_error("Not Implemented");
543 }
544
545 signal_t &errorSquaredAt(size_t index) override {
547 throw std::runtime_error("Not Implemented");
548 }
549
550 signal_t &signalAt(size_t index) override {
552 throw std::runtime_error("Not Implemented");
553 }
554
555 size_t getLinearIndex(size_t index1, size_t index2) const override {
556 UNUSED_ARG(index1)
557 UNUSED_ARG(index2)
558 throw std::runtime_error("Not Implemented");
559 }
560
561 size_t getLinearIndex(size_t index1, size_t index2, size_t index3) const override {
562 UNUSED_ARG(index1)
563 UNUSED_ARG(index2)
564 UNUSED_ARG(index3)
565 throw std::runtime_error("Not Implemented");
566 }
567
568 size_t getLinearIndex(size_t index1, size_t index2, size_t index3, size_t index4) const override {
569 UNUSED_ARG(index1)
570 UNUSED_ARG(index2)
571 UNUSED_ARG(index3)
572 UNUSED_ARG(index4)
573 throw std::runtime_error("Not Implemented");
574 }
575
578 UNUSED_ARG(start)
579 UNUSED_ARG(end)
581 throw std::runtime_error("Not Implemented");
582 }
583
584 double &operator[](const size_t &index) override {
586 throw std::runtime_error("Not Implemented");
587 }
588
589 void setCoordinateSystem(const SpecialCoordinateSystem coordinateSystem) override {
590 UNUSED_ARG(coordinateSystem)
591 throw std::runtime_error("Not Implemented");
592 }
593
594 void setDisplayNormalization(const Mantid::API::MDNormalization &preferredNormalization) override {
595 UNUSED_ARG(preferredNormalization);
596 throw std::runtime_error("Not Implemented");
597 }
598
599 // Check if this class has an oriented lattice on any sample object
601
602 size_t getMemorySize() const override { throw std::runtime_error("Not Implemented"); }
603
604 const std::string id() const override { throw std::runtime_error("Not Implemented"); }
605 const std::string &getName() const override { throw std::runtime_error("Not Implemented"); }
606 bool threadSafe() const override { throw std::runtime_error("Not Implemented"); }
607 const std::string toString() const override { throw std::runtime_error("Not Implemented"); }
609 const MDHistoDimension_sptr &dimZ) {
610 std::vector<IMDDimension_sptr> dimensions{dimX, dimY, dimZ};
611 initGeometry(dimensions);
612 }
613
614private:
615 IMDHistoWorkspace *doClone() const override { throw std::runtime_error("Not Implemented"); }
616 IMDHistoWorkspace *doCloneEmpty() const override { throw std::runtime_error("Not Implemented"); }
617};
618
620 size_t blocksize() const override {
621 if (getSpectrum(0).dataY().size() == getSpectrum(1).dataY().size())
622 return getSpectrum(0).dataY().size();
623 else
624 throw std::length_error("Mismatched bins sizes");
625
626 return 0;
627 }
628};
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
ISpectrum & getSpectrum(const size_t index) override
Return the underlying ISpectrum ptr at the given workspace index.
Definition: FakeObjects.h:174
std::size_t getMaxNumberBins() const override
Returns the maximum number of bins in a workspace (works on ragged data).
Definition: FakeObjects.h:162
size_t blocksize() const override
Returns the size of each block of data returned by the dataY accessors.
Definition: FakeObjects.h:143
AxeslessWorkspaceTester * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: FakeObjects.h:207
size_t size() const override
Returns the number of single indexable items in the workspace.
Definition: FakeObjects.h:139
ISpectrum & getSpectrumWithoutInvalidation(const size_t index) override
Definition: FakeObjects.h:215
void init(const Mantid::HistogramData::Histogram &histogram) override
Definition: FakeObjects.h:197
Mantid::Kernel::SpecialCoordinateSystem getSpecialCoordinateSystem() const override
Definition: FakeObjects.h:181
void init(const size_t &numspec, const size_t &j, const size_t &k) override
Definition: FakeObjects.h:184
std::vector< SpectrumTester > m_vec
Definition: FakeObjects.h:213
AxeslessWorkspaceTester(const Mantid::Parallel::StorageMode storageMode=Mantid::Parallel::StorageMode::Cloned)
Definition: FakeObjects.h:123
const ISpectrum & getSpectrum(const size_t index) const override
Return the underlying ISpectrum ptr (const version) at the given workspace index.
Definition: FakeObjects.h:179
std::size_t getNumberBins(const std::size_t &index) const override
Returns the number of bins for a given histogram index.
Definition: FakeObjects.h:156
size_t getNumberHistograms() const override
Returns the number of histograms in the workspace.
Definition: FakeObjects.h:137
const std::string id() const override
A string ID for the class.
Definition: FakeObjects.h:138
void generateHistogram(const std::size_t, const MantidVec &, MantidVec &, MantidVec &, bool) const override
Definition: FakeObjects.h:180
bool isRaggedWorkspace() const override
Returns true if the workspace is ragged (has differently sized spectra).
Definition: FakeObjects.h:126
AxeslessWorkspaceTester * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: FakeObjects.h:208
bool isBool() const override
Specialized type check.
Definition: FakeObjects.h:346
double toDouble(size_t) const override
Cast an element to double if possible.
Definition: FakeObjects.h:354
void print(size_t, std::ostream &) const override
Prints out the value to a stream.
Definition: FakeObjects.h:344
std::type_info & get_pointer_type_info() const override
Returns typeid for the pointer type to the data element in the column.
Definition: FakeObjects.h:340
Column * clone() const override
Virtual constructor. Fully clone any column.
Definition: FakeObjects.h:352
void fromDouble(size_t, double) override
Assign an element from double if possible.
Definition: FakeObjects.h:356
void * void_pointer(size_t) override
Pointer to a data element.
Definition: FakeObjects.h:362
std::type_info & get_type_info() const override
Returns typeid for the data in the column.
Definition: FakeObjects.h:338
long int sizeOfData() const override
Must return overall memory size taken by the column.
Definition: FakeObjects.h:350
void insert(size_t) override
Inserts an item.
Definition: FakeObjects.h:360
bool isNumber() const override
Are elements of the column interpretable as a number?
Definition: FakeObjects.h:348
void resize(size_t) override
Sets the new column size.
Definition: FakeObjects.h:359
const void * void_pointer(size_t) const override
Pointer to a data element.
Definition: FakeObjects.h:363
void remove(size_t) override
Removes an item.
Definition: FakeObjects.h:361
size_t size() const override
Number of individual elements in the column.
Definition: FakeObjects.h:336
size_t getMemorySize() const override
Get the footprint in memory in bytes.
Definition: FakeObjects.h:117
const std::string toString() const override
Serializes the object to a string.
Definition: FakeObjects.h:116
Workspace * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: FakeObjects.h:115
const std::string id() const override
A string ID for the class.
Definition: FakeObjects.h:113
Workspace * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: FakeObjects.h:114
signal_t getSignalAt(size_t index1, size_t index2, size_t index3) const override
Definition: FakeObjects.h:478
signal_t getErrorNormalizedAt(size_t index1, size_t index2) const override
Definition: FakeObjects.h:524
void setCoordinateSystem(const SpecialCoordinateSystem coordinateSystem) override
Definition: FakeObjects.h:589
void setTo(signal_t signal, signal_t errorSquared, signal_t numEvents) override
Definition: FakeObjects.h:417
double & operator[](const size_t &index) override
Definition: FakeObjects.h:584
signal_t getSignalAt(size_t index1, size_t index2) const override
Definition: FakeObjects.h:472
signal_t getSignalAt(size_t index1, size_t index2, size_t index3, size_t index4) const override
Definition: FakeObjects.h:485
signal_t getErrorAt(size_t index) const override
Definition: FakeObjects.h:441
LinePlot getLineData(const Mantid::Kernel::VMD &start, const Mantid::Kernel::VMD &end, Mantid::API::MDNormalization normalize) const override
Definition: FakeObjects.h:576
size_t getLinearIndex(size_t index1, size_t index2, size_t index3, size_t index4) const override
Definition: FakeObjects.h:568
SpecialCoordinateSystem getSpecialCoordinateSystem() const override
Definition: FakeObjects.h:401
uint64_t getNEvents() const override
Definition: FakeObjects.h:371
signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const override
Definition: FakeObjects.h:511
signal_t getSignalAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const override
Definition: FakeObjects.h:381
coord_t getInverseVolume() const override
See the MDHistoWorkspace definition for descriptions of these.
Definition: FakeObjects.h:403
signal_t & signalAt(size_t index) override
Definition: FakeObjects.h:550
signal_t getErrorAt(size_t index1, size_t index2) const override
Definition: FakeObjects.h:446
const std::string & getName() const override
Get the workspace name.
Definition: FakeObjects.h:605
const signal_t * getNumEventsArray() const override
Definition: FakeObjects.h:409
signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3) const override
Definition: FakeObjects.h:504
void setErrorSquaredAt(size_t index, signal_t value) override
Definition: FakeObjects.h:435
signal_t getSignalAt(size_t index) const override
Definition: FakeObjects.h:467
MDHistoWorkspaceTester(const MDHistoDimension_sptr &dimX, const MDHistoDimension_sptr &dimY, const MDHistoDimension_sptr &dimZ)
Definition: FakeObjects.h:608
IMDHistoWorkspace * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: FakeObjects.h:615
size_t getMemorySize() const override
Get the footprint in memory in bytes.
Definition: FakeObjects.h:602
signal_t * mutableSignalArray() override
Definition: FakeObjects.h:411
std::vector< std::unique_ptr< IMDIterator > > createIterators(size_t suggestedNumCores=1, Mantid::Geometry::MDImplicitFunction *function=nullptr) const override
Creates a new iterator pointing to the first cell in the workspace.
Definition: FakeObjects.h:374
signal_t getErrorAt(size_t index1, size_t index2, size_t index3) const override
Definition: FakeObjects.h:452
size_t getLinearIndex(size_t index1, size_t index2, size_t index3) const override
Definition: FakeObjects.h:561
Mantid::Kernel::VMD getCenter(size_t linearIndex) const override
Definition: FakeObjects.h:424
const std::string toString() const override
Serializes the object to a string.
Definition: FakeObjects.h:607
signal_t * mutableNumEventsArray() override
Definition: FakeObjects.h:415
signal_t getErrorNormalizedAt(size_t index) const override
Definition: FakeObjects.h:519
uint64_t getNPoints() const override
Get the number of points associated with the workspace.
Definition: FakeObjects.h:370
signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const override
Definition: FakeObjects.h:537
size_t getLinearIndex(size_t index1, size_t index2) const override
Definition: FakeObjects.h:555
signal_t * mutableErrorSquaredArray() override
Definition: FakeObjects.h:413
signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3) const override
Definition: FakeObjects.h:530
signal_t getErrorAt(size_t index1, size_t index2, size_t index3, size_t index4) const override
Definition: FakeObjects.h:459
const std::string id() const override
A string ID for the class.
Definition: FakeObjects.h:604
bool hasOrientedLattice() const override
Definition: FakeObjects.h:600
bool threadSafe() const override
Marks the workspace as safe for multiple threads to edit data simutaneously.
Definition: FakeObjects.h:606
signal_t getSignalWithMaskAtCoord(const coord_t *coords, const Mantid::API::MDNormalization &normalization) const override
Definition: FakeObjects.h:387
signal_t getSignalNormalizedAt(size_t index) const override
Definition: FakeObjects.h:493
void clearMDMasking() override
Clear existing masks.
Definition: FakeObjects.h:399
void setMDMasking(std::unique_ptr< Mantid::Geometry::MDImplicitFunction > maskingRegion) override
Setter for the masking region.
Definition: FakeObjects.h:394
const signal_t * getSignalArray() const override
Definition: FakeObjects.h:405
void setDisplayNormalization(const Mantid::API::MDNormalization &preferredNormalization) override
Definition: FakeObjects.h:594
IMDHistoWorkspace * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: FakeObjects.h:616
void setSignalAt(size_t index, signal_t value) override
Definition: FakeObjects.h:429
const signal_t * getErrorSquaredArray() const override
Definition: FakeObjects.h:407
signal_t getSignalNormalizedAt(size_t index1, size_t index2) const override
Definition: FakeObjects.h:498
signal_t & errorSquaredAt(size_t index) override
Definition: FakeObjects.h:545
Column is the base class for columns of TableWorkspace.
Definition: Column.h:35
size_t numberOfDetectorGroups() const
Returns the number of detector groups.
Abstract interface to MDHistoWorkspace, for use in exposing to Python.
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
Definition: ISpectrum.h:39
virtual MantidVec & dataY()=0
virtual const MantidVec & readY() const
Deprecated, use y() instead. Returns the y data const.
Definition: ISpectrum.cpp:42
virtual void copyDataInto(DataObjects::EventList &) const
Override in child classes for polymorphic copying of data.
Definition: ISpectrum.cpp:201
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
void initGeometry(const std::vector< std::shared_ptr< Geometry::IMDDimension > > &dimensions)
Initialize the geometry.
Definition: MDGeometry.cpp:139
Base MatrixWorkspace Abstract Class.
std::vector< std::unique_ptr< Axis > > m_axes
A vector of pointers to the axes for this workspace.
void invalidateCommonBinsFlag()
Invalidates the commons bins flag.
HistogramData::Histogram histogram(const size_t index) const
Returns the Histogram at the given workspace index.
virtual MantidVec & dataY(const std::size_t index)
Deprecated, use mutableY() instead. Returns the y data.
Base Workspace Abstract Class.
Definition: Workspace.h:30
Parallel::StorageMode storageMode() const
Returns the storage mode (used for MPI runs)
Definition: Workspace.cpp:82
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
Class for 3D vectors.
Definition: V3D.h:34
Implements a copy on write data template.
Definition: cow_ptr.h:41
Helper class that implements ISpectrum.
Definition: FakeObjects.h:55
const MantidVec & dataX() const override
Definition: FakeObjects.h:73
const MantidVec & readDx() const override
Definition: FakeObjects.h:79
void setX(const Mantid::Kernel::cow_ptr< Mantid::HistogramData::HistogramX > &X) override
Definition: FakeObjects.h:71
MantidVec & dataX() override
Definition: FakeObjects.h:72
Mantid::Kernel::cow_ptr< Mantid::HistogramData::HistogramX > ptrX() const override
Definition: FakeObjects.h:75
void clearData() override
Mask the spectrum to this value.
Definition: FakeObjects.h:90
MantidVec & dataE() override
Definition: FakeObjects.h:82
SpectrumTester(Mantid::HistogramData::Histogram::XMode xmode, Mantid::HistogramData::Histogram::YMode ymode)
Definition: FakeObjects.h:57
const Mantid::HistogramData::Histogram & histogramRef() const override
Definition: FakeObjects.h:105
void copyDataFrom(const ISpectrum &other) override
Copy data from another ISpectrum with double-dynamic dispatch.
Definition: FakeObjects.h:69
Mantid::HistogramData::Histogram & mutableHistogramRef() override
Definition: FakeObjects.h:106
MantidVec & dataDx() override
Definition: FakeObjects.h:77
const MantidVec & readX() const override
Definition: FakeObjects.h:74
void copyDataInto(SpectrumTester &other) const override
Override in child classes for polymorphic copying of data.
Definition: FakeObjects.h:103
Mantid::HistogramData::Histogram m_histogram
Definition: FakeObjects.h:99
const MantidVec & dataE() const override
Definition: FakeObjects.h:85
const MantidVec & dataDx() const override
Definition: FakeObjects.h:78
SpectrumTester(const specnum_t specNo, Mantid::HistogramData::Histogram::XMode xmode, Mantid::HistogramData::Histogram::YMode ymode)
Definition: FakeObjects.h:62
MantidVec & dataY() override
Definition: FakeObjects.h:81
const MantidVec & dataY() const override
Definition: FakeObjects.h:84
size_t getMemorySize() const override
Definition: FakeObjects.h:87
std::unique_ptr< TableWorkspaceTester > cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition: FakeObjects.h:264
LogManager_const_sptr getLogs() const override
Get constant access to shared pointer containing workspace properties.
Definition: FakeObjects.h:278
TableWorkspaceTester * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: FakeObjects.h:323
Column_sptr getColumn(const std::string &) override
Gets the shared pointer to a column by name.
Definition: FakeObjects.h:284
Column_const_sptr getColumn(size_t) const override
Gets the shared pointer to a column by index - return none-modifyable column.
Definition: FakeObjects.h:292
void find(double, size_t &, size_t) override
find method to get the index of double cell value in a table workspace
Definition: FakeObjects.h:310
void find(Boolean, size_t &, size_t) override
find method to get the index of API::Boolean value cell in a table workspace
Definition: FakeObjects.h:314
void removeColumn(const std::string &) override
Removes a column.
Definition: FakeObjects.h:280
Column_sptr getColumn(size_t) override
Gets the shared pointer to a column by index.
Definition: FakeObjects.h:290
size_t insertRow(size_t) override
Inserts a row before row pointed to by index and fills it with default vales.
Definition: FakeObjects.h:304
size_t getMemorySize() const override
Get the footprint in memory in bytes.
Definition: FakeObjects.h:270
void removeRow(size_t) override
Delets a row if it exists.
Definition: FakeObjects.h:306
void find(const Mantid::Kernel::V3D &, size_t &, size_t) override
find method to get the index of Mantid::Kernel::V3D cell value in a table workspace
Definition: FakeObjects.h:318
std::unique_ptr< TableWorkspaceTester > clone() const
Returns a clone of the workspace.
Definition: FakeObjects.h:261
void find(const std::string &, size_t &, size_t) override
find method to get the index of cellstd::string value in a table workspace
Definition: FakeObjects.h:316
const std::string id() const override
Return the workspace typeID.
Definition: FakeObjects.h:268
LogManager_sptr logs() override
Get access to shared pointer containing workspace properties.
Definition: FakeObjects.h:276
size_t columnCount() const override
Number of columns in the workspace.
Definition: FakeObjects.h:282
TableWorkspaceTester * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: FakeObjects.h:326
void setRowCount(size_t) override
Resizes the workspace.
Definition: FakeObjects.h:302
void find(float, size_t &, size_t) override
find method to get the index of float cell value in a table workspace
Definition: FakeObjects.h:312
void find(size_t, size_t &, size_t) override
find method to get the index of integer cell value in a table workspace
Definition: FakeObjects.h:308
Column_sptr addColumn(const std::string &, const std::string &) override
Creates a new column.
Definition: FakeObjects.h:272
ITableWorkspace * doCloneColumns(const std::vector< std::string > &) const override
Definition: FakeObjects.h:329
size_t rowCount() const override
Number of rows in the workspace.
Definition: FakeObjects.h:300
std::vector< std::string > getColumnNames() const override
Returns a vector of all column names.
Definition: FakeObjects.h:296
Column_const_sptr getColumn(const std::string &) const override
Gets the shared pointer to a column by name.
Definition: FakeObjects.h:286
size_t blocksize() const override
Returns the size of each block of data returned by the dataY accessors.
Definition: FakeObjects.h:620
void init(const Mantid::HistogramData::Histogram &histogram) override
Definition: FakeObjects.h:243
WorkspaceTester(const Mantid::Parallel::StorageMode storageMode=Mantid::Parallel::StorageMode::Cloned)
Definition: FakeObjects.h:223
WorkspaceTester * doCloneEmpty() const override
Virtual cloneEmpty method.
Definition: FakeObjects.h:254
std::unique_ptr< WorkspaceTester > cloneEmpty() const
Returns a default-initialized clone of the workspace.
Definition: FakeObjects.h:232
void init(const size_t &numspec, const size_t &j, const size_t &k) override
Definition: FakeObjects.h:235
std::unique_ptr< WorkspaceTester > clone() const
Returns a clone of the workspace.
Definition: FakeObjects.h:229
WorkspaceTester * doClone() const override
Virtual clone method. Not implemented to force implementation in children.
Definition: FakeObjects.h:253
const std::string id() const override
A string ID for the class.
Definition: FakeObjects.h:226
std::shared_ptr< const LogManager > LogManager_const_sptr
shared pointer to the logManager base class (const version)
Definition: LogManager.h:210
std::shared_ptr< Column > Column_sptr
Definition: Column.h:228
std::shared_ptr< LogManager > LogManager_sptr
shared pointer to the logManager base class
Definition: LogManager.h:208
std::shared_ptr< const Column > Column_const_sptr
Definition: Column.h:229
MDNormalization
Enum describing different ways to normalize the signal in a MDWorkspace.
Definition: IMDIterator.h:25
std::shared_ptr< MDHistoDimension > MDHistoDimension_sptr
Shared pointer to a MDHistoDimension.
SpecialCoordinateSystem
Special coordinate systems for Q3D.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Definition: V3D.h:341
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27
int32_t detid_t
Typedef for a detector ID.
Definition: SpectrumInfo.h:21
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Definition: MDTypes.h:36
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition: cow_ptr.h:172
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16
As TableColumn stores its data in a std::vector bool type cannot be used in the same way as the other...
Definition: Column.h:209
Holds X, Y, E for a line plot.
Definition: IMDWorkspace.h:48