EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_DCEL_Iterator.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
11#ifndef EBGEOMETRY_DCEL_ITERATOR_HPP
12#define EBGEOMETRY_DCEL_ITERATOR_HPP
13
14// Std includes
15#include <cstdint>
16#include <type_traits>
17
18// Our includes
19#include "EBGeometry_DCEL.hpp"
20#include "EBGeometry_GPU.hpp"
21
22namespace EBGeometry {
23
24namespace DCEL {
25
49template <class T>
51{
52 static_assert(std::is_floating_point_v<T>, "T must be a floating-point type");
53
54public:
59
63 using Edge = EdgeT<T>;
64
68 using Face = FaceT<T>;
69
73 using Mesh = MeshT<T>;
74
78 EdgeIteratorT() = delete;
79
88 EdgeIteratorT(const Mesh& a_mesh, const Face& a_face) noexcept;
89
99 EdgeIteratorT(const Mesh& a_mesh, const uint32_t a_startEdgeIndex) noexcept;
100
113 EdgeIteratorT(const EdgeIteratorT& a_other) noexcept
114 : m_mesh(a_other.m_mesh),
115 m_fullLoop(a_other.m_fullLoop),
116 m_startEdge(a_other.m_startEdge),
117 m_curEdge(a_other.m_curEdge)
118 {}
119
124 EdgeIteratorT(EdgeIteratorT&& a_other) noexcept = default;
125
129 ~EdgeIteratorT() noexcept = default;
130
137 operator=(const EdgeIteratorT& a_other) noexcept = default;
138
145 operator=(EdgeIteratorT&& a_other) noexcept = default;
146
151 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
152 inline uint32_t
153 operator()() const noexcept;
154
160 inline void
161 reset() noexcept;
162
167 inline void
168 operator++() noexcept;
169
174 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
175 inline bool
176 ok() const noexcept;
177
178protected:
182 const Mesh* m_mesh = nullptr;
183
187 bool m_fullLoop = false;
188
192 uint32_t m_startEdge = UINT32_MAX;
193
197 uint32_t m_curEdge = UINT32_MAX;
198};
199
200static_assert(!std::is_trivially_copyable_v<EdgeIteratorT<float>>,
201 "EdgeIteratorT<float> must NOT be trivially copyable -- see its copy "
202 "constructor's doc comment");
203static_assert(!std::is_trivially_copyable_v<EdgeIteratorT<double>>,
204 "EdgeIteratorT<double> must NOT be trivially copyable -- see its copy "
205 "constructor's doc comment");
206
207} // namespace DCEL
208
209} // namespace EBGeometry
210
211#include "EBGeometry_DCEL_IteratorImplem.hpp"
212
213#endif
Namespace documentation.
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
Half-edge iterator class for navigating the half edge mesh.
Definition EBGeometry_DCEL_Iterator.hpp:51
~EdgeIteratorT() noexcept=default
Destructor.
EdgeIteratorT()=delete
Default construction is not allowed. Use one of the full constructors.
uint32_t m_startEdge
Starting half-edge index, or UINT32_MAX if unset.
Definition EBGeometry_DCEL_Iterator.hpp:192
EdgeIteratorT(const Mesh &a_mesh, const Face &a_face) noexcept
Constructor, taking a mesh and a face as argument. The iterator begins at the half-edge index contain...
EdgeIteratorT(EdgeIteratorT &&a_other) noexcept=default
Move constructor.
EdgeIteratorT(const EdgeIteratorT &a_other) noexcept
Copy constructor.
Definition EBGeometry_DCEL_Iterator.hpp:113
const Mesh * m_mesh
Owning mesh, used to resolve edge indices. Non-owning; must outlive the iterator.
Definition EBGeometry_DCEL_Iterator.hpp:182
bool m_fullLoop
If true, a full loop has been made around the polygon face.
Definition EBGeometry_DCEL_Iterator.hpp:187
EdgeIteratorT(const Mesh &a_mesh, const uint32_t a_startEdgeIndex) noexcept
Constructor, taking a mesh and an arbitrary starting half-edge index directly (rather than a face's o...
bool ok() const noexcept
Function which checks if the iteration can be continued.
void reset() noexcept
Reset function for the iterator. This resets the iterator so that it begins from the starting half-ed...
uint32_t m_curEdge
Current half-edge index, or UINT32_MAX if unset.
Definition EBGeometry_DCEL_Iterator.hpp:197
Half-edge class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Edge.hpp:60
Face class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Face.hpp:68
DCEL mesh class - stores a doubly-connected edge mesh.
Definition EBGeometry_DCEL_Mesh.hpp:102
Vertex class for navigating a DCEL mesh.
Definition EBGeometry_DCEL_Vertex.hpp:63
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26