Quantum 3xplorer (Q3)
Loading...
Searching...
No Matches
integer_vector_3d.hpp
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* IntegerVector3D: an integer 3D vector for Miller indices and FFT grid indices.
5
*
6
* Provides element access by index and equality comparison.
7
*/
8
9
#include "
layer_0_core/types/vector_3d.hpp
"
10
11
namespace
q3
{
12
13
/// Integer 3-vector for Miller indices / FFT grid indices
14
struct
[[nodiscard]]
IntegerVector3D
{
15
int
x{}, y{}, z{};
16
IntegerVector3D
() =
default
;
17
constexpr
IntegerVector3D
(
int
x_component,
int
y_component,
int
z_component)
18
: x(x_component), y(y_component), z(z_component) {}
19
[[nodiscard]]
int
operator[]
(
int
component_index)
const
{
20
return
(component_index == 0) ? x : (component_index == 1) ? y : z;
21
}
22
int
&
operator[]
(
int
component_index) {
23
return
(component_index == 0) ? x : (component_index == 1) ? y : z;
24
}
25
[[nodiscard]]
bool
operator==
(
const
IntegerVector3D
& other)
const
{
26
return
x == other.
x
&& y == other.
y
&& z == other.
z
;
27
}
28
};
29
30
}
// namespace q3
q3
Definition
q3_core_api.hpp:33
q3::IntegerVector3D
Integer 3-vector for Miller indices / FFT grid indices.
Definition
integer_vector_3d.hpp:14
q3::IntegerVector3D::operator==
bool operator==(const IntegerVector3D &other) const
Definition
integer_vector_3d.hpp:25
q3::IntegerVector3D::y
int y
Definition
integer_vector_3d.hpp:15
q3::IntegerVector3D::z
int z
Definition
integer_vector_3d.hpp:15
q3::IntegerVector3D::operator[]
int operator[](int component_index) const
Definition
integer_vector_3d.hpp:19
q3::IntegerVector3D::IntegerVector3D
constexpr IntegerVector3D(int x_component, int y_component, int z_component)
Definition
integer_vector_3d.hpp:17
q3::IntegerVector3D::IntegerVector3D
IntegerVector3D()=default
q3::IntegerVector3D::operator[]
int & operator[](int component_index)
Definition
integer_vector_3d.hpp:22
q3::IntegerVector3D::x
int x
Definition
integer_vector_3d.hpp:15
vector_3d.hpp
src
layer_0_core
types
integer_vector_3d.hpp
Generated by
1.9.8