chombo-discharge
Loading...
Searching...
No Matches
CD_TriangleCollection.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_TRIANGLECOLLECTION_H
14#define CD_TRIANGLECOLLECTION_H
15
16// Std includes
17#include <vector>
18#include <memory>
19#include <string>
20
21// Our includes
22#include <CD_Triangle.H>
23#include <CD_DataParser.H>
24#include <CD_NamespaceHeader.H>
25
49{
50public:
55
59 static constexpr int K = 4;
60
64 using BV = EBGeometry::BoundingVolumes::AABBT<Real>;
65
72
79 TriangleCollection(const std::vector<std::shared_ptr<Triangle>>& a_triangles) noexcept;
80
92 TriangleCollection(const std::string& a_filename, const std::string& a_vertexDataIdentifier);
93
97 virtual ~TriangleCollection() noexcept;
98
108 virtual void
109 define(const std::vector<std::shared_ptr<Triangle>>& a_triangles) noexcept;
110
124 virtual std::vector<std::pair<std::shared_ptr<const Triangle>, Real>>
125 getClosestTriangles(const Vec3& a_point) const noexcept;
126
127protected:
131 bool m_isDefined = false;
132
136 std::shared_ptr<EBGeometry::BVH::PackedBVH<Real, Triangle, K>> m_bvh;
137};
138
139#include <CD_NamespaceFooter.H>
140
141#endif
Declaration of various routines for simple parsing of input data.
Header file for a simple Triangle class.
Class that represents a set of triangles.
Definition CD_TriangleCollection.H:49
EBGeometry::BoundingVolumes::AABBT< Real > BV
Bounding volume type.
Definition CD_TriangleCollection.H:64
std::shared_ptr< EBGeometry::BVH::PackedBVH< Real, Triangle, K > > m_bvh
Triangle collection – stored in a BVH-tree for faster lookup.
Definition CD_TriangleCollection.H:136
Triangle::Vec3 Vec3
3D vector type, re-exported from Triangle for convenience.
Definition CD_TriangleCollection.H:54
virtual std::vector< std::pair< std::shared_ptr< const Triangle >, Real > > getClosestTriangles(const Vec3 &a_point) const noexcept
Hierarchical BVH search that returns candidate closest triangles to a query point.
Definition CD_TriangleCollection.cpp:69
bool m_isDefined
Is defined or not.
Definition CD_TriangleCollection.H:131
virtual void define(const std::vector< std::shared_ptr< Triangle > > &a_triangles) noexcept
Build the BVH tree from a set of triangles.
Definition CD_TriangleCollection.cpp:36
static constexpr int K
Branching factor for BVH tree.
Definition CD_TriangleCollection.H:59
TriangleCollection() noexcept
Default constructor.
Class that represents a single triangle together with associated metadata on the vertices (one float ...
Definition CD_Triangle.H:31
EBGeometry::Vec3T< Real > Vec3
Alias for always-3D vector type.
Definition CD_Triangle.H:36