Mantid
Loading...
Searching...
No Matches
HKLFilter.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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"
10#include "MantidKernel/V3D.h"
11
12#include <functional>
13#include <memory>
14
15namespace Mantid {
16namespace Geometry {
17
65class MANTID_GEOMETRY_DLL HKLFilter {
66public:
67 virtual ~HKLFilter() = default;
68
69 std::function<bool(const Kernel::V3D &)> fn() const noexcept;
70
71 virtual std::string getDescription() const = 0;
72 virtual bool isAllowed(const Kernel::V3D &hkl) const = 0;
73};
74
75using HKLFilter_uptr = std::unique_ptr<HKLFilter>;
76using HKLFilter_const_sptr = std::shared_ptr<const HKLFilter>;
77using HKLFilter_sptr = std::shared_ptr<HKLFilter>;
78
80class MANTID_GEOMETRY_DLL HKLFilterUnaryLogicOperation : public HKLFilter {
81public:
83
85 const HKLFilter_const_sptr &getOperand() const noexcept { return m_operand; }
86
87protected:
89};
90
92class MANTID_GEOMETRY_DLL HKLFilterNot final : public HKLFilterUnaryLogicOperation {
93public:
97
98 std::string getDescription() const noexcept override;
99 bool isAllowed(const Kernel::V3D &hkl) const noexcept override;
100};
101
103class MANTID_GEOMETRY_DLL HKLFilterBinaryLogicOperation : public HKLFilter {
104public:
106
108 const HKLFilter_const_sptr &getLHS() const noexcept { return m_lhs; }
109
111 const HKLFilter_const_sptr &getRHS() const noexcept { return m_rhs; }
112
113protected:
116};
117
119class MANTID_GEOMETRY_DLL HKLFilterAnd final : public HKLFilterBinaryLogicOperation {
120public:
125
126 std::string getDescription() const noexcept override;
127 bool isAllowed(const Kernel::V3D &hkl) const noexcept override;
128};
129
131class MANTID_GEOMETRY_DLL HKLFilterOr final : public HKLFilterBinaryLogicOperation {
132public:
137
138 std::string getDescription() const noexcept override;
139 bool isAllowed(const Kernel::V3D &hkl) const noexcept override;
140};
141
142MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator~(const HKLFilter_const_sptr &filter);
143
144MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator&(const HKLFilter_const_sptr &lhs,
146
147MANTID_GEOMETRY_DLL const HKLFilter_const_sptr operator|(const HKLFilter_const_sptr &lhs,
149
150} // namespace Geometry
151} // namespace Mantid
const std::vector< double > & rhs
Logical "And"-operation for HKLFilter.
Definition: HKLFilter.h:119
HKLFilterAnd(const HKLFilter_const_sptr &lhs, const HKLFilter_const_sptr &rhs)
Constructor, calls base class constructor, throws exception if either of the operands is null.
Definition: HKLFilter.h:123
Base class for binary logic operations for HKLFilter.
Definition: HKLFilter.h:103
const HKLFilter_const_sptr & getRHS() const noexcept
Returns the right-hand side operand of the operation.
Definition: HKLFilter.h:111
const HKLFilter_const_sptr & getLHS() const noexcept
Returns the left-hand side operand of the operation.
Definition: HKLFilter.h:108
Logical "Not"-operation for HKLFilter.
Definition: HKLFilter.h:92
HKLFilterNot(const HKLFilter_const_sptr &filter)
Constructor, calls base class constructor, throws exception if filter is a null pointer.
Definition: HKLFilter.h:96
Logical "Or"-operation for HKLFilter.
Definition: HKLFilter.h:131
HKLFilterOr(const HKLFilter_const_sptr &lhs, const HKLFilter_const_sptr &rhs)
Constructor, calls base class constructor, throws exception if either of the operands is null.
Definition: HKLFilter.h:135
Base class for unary logic operations for HKLFilter.
Definition: HKLFilter.h:80
const HKLFilter_const_sptr & getOperand() const noexcept
Returns the operand of the function.
Definition: HKLFilter.h:85
virtual ~HKLFilter()=default
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< const HKLFilter > HKLFilter_const_sptr
Definition: HKLFilter.h:76
std::shared_ptr< HKLFilter > HKLFilter_sptr
Definition: HKLFilter.h:77
std::unique_ptr< HKLFilter > HKLFilter_uptr
Definition: HKLFilter.h:75
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.