DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
PointCloud.hpp
Go to the documentation of this file.
1#pragma once
2#include "DNDS/Defines.hpp"
3#include "Geometric.hpp"
4
5namespace DNDS::Geom
6{
8 {
9 using coord_t = real; //!< The type of each coordinate
10
11 std::vector<tPoint> pts;
12
13 // Must return the number of data points
14 [[nodiscard]] inline size_t kdtree_get_point_count() const { return pts.size(); }
15
16 [[nodiscard]] inline real kdtree_get_pt(const size_t idx, const size_t dim) const
17 {
18 if (dim == 0)
19 return pts[idx].x();
20 else if (dim == 1)
21 return pts[idx].y();
22 else
23 return pts[idx].z();
24 }
25
26 template <class BBOX>
27 bool kdtree_get_bbox(BBOX & /* bb */) const
28 {
29 return false;
30 }
31 };
32
34 {
35 using coord_t = real; //!< The type of each coordinate
36 using t_f = std::function<tPoint(size_t)>;
37
40
42 {
43 }
44
45 [[nodiscard]] index size() const { return _size; };
46
48 {
49 DNDS_assert(i >= 0 && i < size());
50 return _fun(i);
51 }
52
53 // Must return the number of data points
54 [[nodiscard]] inline size_t kdtree_get_point_count() const { return _size; }
55
56 [[nodiscard]] inline real kdtree_get_pt(const size_t idx, const size_t dim) const
57 {
58 return this->operator[](idx)(dim);
59 }
60
61 template <class BBOX>
62 bool kdtree_get_bbox(BBOX & /* bb */) const
63 {
64 return false;
65 }
66 };
67}
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Definition Errors.hpp:108
Eigen::Vector3d tPoint
Definition Geometric.hpp:9
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Definition Defines.hpp:107
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
Definition Defines.hpp:105
PointCloudFunctional(const t_f &fun, index size)
tPoint operator[](index i) const
bool kdtree_get_bbox(BBOX &) const
real coord_t
The type of each coordinate.
real kdtree_get_pt(const size_t idx, const size_t dim) const
std::function< tPoint(size_t)> t_f
bool kdtree_get_bbox(BBOX &) const
real coord_t
The type of each coordinate.
Definition PointCloud.hpp:9
size_t kdtree_get_point_count() const
real kdtree_get_pt(const size_t idx, const size_t dim) const
std::vector< tPoint > pts