Mantid
Loading...
Searching...
No Matches
SparseWorkspace.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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 "MantidAlgorithms/DllConfig.h"
13
14#include <array>
15#include <tuple>
16#include <utility>
17
18namespace Mantid {
19namespace Algorithms {
20class DetectorGridDefinition;
21}
22namespace Geometry {
23class ReferenceFrame;
24}
25namespace HistogramData {
26class Histogram;
27}
28namespace Kernel {
29class V3D;
30}
31namespace Algorithms {
36class MANTID_ALGORITHMS_DLL SparseWorkspace : public DataObjects::Workspace2D {
37public:
38 SparseWorkspace(const API::MatrixWorkspace &modelWS, const size_t wavelengthPoints, const size_t rows,
39 const size_t columns);
40 virtual HistogramData::Histogram interpolateFromDetectorGrid(const double lat, const double lon) const;
41 virtual HistogramData::Histogram bilinearInterpolateFromDetectorGrid(const double lat, const double lon) const;
42
43protected:
44 SparseWorkspace(const SparseWorkspace &other);
45 std::unique_ptr<Algorithms::DetectorGridDefinition> m_gridDef;
46 static std::array<double, 4> inverseDistanceWeights(const std::array<double, 4> &distances);
47 static double greatCircleDistance(const double lat1, const double long1, const double lat2, const double long2);
48 Mantid::Geometry::IObject_sptr makeCubeShape();
49 static HistogramData::Histogram modelHistogram(const API::MatrixWorkspace &modelWS, const size_t wavelengthPoints);
50 static std::tuple<double, double> extremeWavelengths(const API::MatrixWorkspace &ws);
51 static std::tuple<double, double, double, double> extremeAngles(const API::MatrixWorkspace &ws);
52 HistogramData::HistogramY secondDerivative(const std::array<size_t, 3> indices, const double distanceStep) const;
53 HistogramData::HistogramE esq(const HistogramData::HistogramE &e) const;
54 HistogramData::HistogramE esqrt(HistogramData::HistogramE e) const;
55
56private:
57 SparseWorkspace *doClone() const override;
58};
59
61using SparseWorkspace_uptr = std::unique_ptr<SparseWorkspace>;
62using SparseWorkspace_sptr = std::shared_ptr<SparseWorkspace>;
63
64} // namespace Algorithms
65} // namespace Mantid
Base MatrixWorkspace Abstract Class.
Defines functions and utilities to create and deal with sparse instruments.
std::unique_ptr< Algorithms::DetectorGridDefinition > m_gridDef
Concrete workspace implementation.
Definition: Workspace2D.h:29
std::shared_ptr< SparseWorkspace > SparseWorkspace_sptr
std::unique_ptr< SparseWorkspace > SparseWorkspace_uptr
unique pointer to Mantid::API::SparseWorkspace
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition: IObject.h:92
Helper class which provides the Collimation Length for SANS instruments.