Mantid
Loading...
Searching...
No Matches
HKLGenerator.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
10#include "MantidGeometry/DllConfig.h"
11#include "MantidKernel/V3D.h"
12
13#include <boost/iterator/iterator_facade.hpp>
14
15namespace Mantid {
16namespace Geometry {
17
82class MANTID_GEOMETRY_DLL HKLGenerator {
83public:
96 class MANTID_GEOMETRY_DLL const_iterator
97 : public boost::iterator_facade<const_iterator, const Kernel::V3D &, boost::forward_traversal_tag> {
98 public:
100
101 explicit const_iterator(const Kernel::V3D &current);
102
103 explicit const_iterator(const Kernel::V3D &hklMin, const Kernel::V3D &hklMax);
104
105 private:
106 // Required for boost::iterator_facade to work
107 friend class boost::iterator_core_access;
108
109 void increment();
110
112 inline bool equal(const const_iterator &other) const {
113 return this->m_h == other.m_h && this->m_k == other.m_k && this->m_l == other.m_l;
114 }
115
117 inline const Kernel::V3D &dereference() const { return m_hkl; }
118
121 inline void advance(difference_type) {}
122 inline void decrement() {}
123
124 int m_h, m_k, m_l;
126
128 int m_kMin, m_kMax;
129 int m_lMin, m_lMax;
130 };
131
132 HKLGenerator(const Kernel::V3D &hklMin, const Kernel::V3D &hklMax);
133 HKLGenerator(const Kernel::V3D &hklMinMax);
134 HKLGenerator(int hMinMax, int kMinMax, int lMinMax);
135 HKLGenerator(const UnitCell &unitCell, double dMin);
136
137 virtual ~HKLGenerator() = default;
138
140 inline size_t size() const { return m_size; }
141
143 inline const const_iterator &begin() const { return m_begin; }
144
146 inline const const_iterator &end() const { return m_end; }
147
148private:
149 size_t getSize(const Kernel::V3D &min, const Kernel::V3D &max) const;
150
151 const_iterator getBeginIterator() const;
152 const_iterator getEndIterator() const;
153 Kernel::V3D getEndHKL() const;
154
157
158 size_t m_size;
159
162};
163
164} // namespace Geometry
165} // namespace Mantid
size_t m_size
Maximum size of the store.
void advance(difference_type)
Required for compilation in VS.
Definition: HKLGenerator.h:121
const Kernel::V3D & dereference() const
Returns a const reference to the currently pointed at HKL.
Definition: HKLGenerator.h:117
bool equal(const const_iterator &other) const
Returns true if other is at the same position.
Definition: HKLGenerator.h:112
const const_iterator & end() const
Returns an iterator which "points at" one element past the end.
Definition: HKLGenerator.h:146
virtual ~HKLGenerator()=default
const const_iterator & begin() const
Returns an iterator to the beginning of the sequence.
Definition: HKLGenerator.h:143
size_t size() const
Returns the number of HKLs to be generated.
Definition: HKLGenerator.h:140
Class to implement unit cell of crystals.
Definition: UnitCell.h:44
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.