Loading...
Searching...
No Matches
PointSimpleListSearcher.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_POINT_SIMPLE_LIST_SEARCHER_HPP
12#define CUBBYFLOW_POINT_SIMPLE_LIST_SEARCHER_HPP
13
15#include <Core/Utils/Macros.hpp>
16
17namespace CubbyFlow
18{
26template <size_t N>
28{
29 public:
31
32 class Builder;
33
36
39
41 ~PointSimpleListSearcher() override = default;
42
45
48
51
55
67 double maxSearchRadius) override;
68
78 const Vector<double, N>& origin, double radius,
79 const ForEachNearbyPointFunc& callback) const override;
80
91 double radius) const override;
92
99 [[nodiscard]] std::shared_ptr<PointNeighborSearcher<N>> Clone()
100 const override;
101
104
106 void Serialize(std::vector<uint8_t>* buffer) const override;
107
109 void Deserialize(const std::vector<uint8_t>& buffer) override;
110
113
114 private:
115 template <size_t M = N>
119
120 template <size_t M = N>
124
125 template <size_t M = N>
129
130 template <size_t M = N>
134
135 Array1<Vector<double, N>> m_points;
136};
137
140
143
146
149
153template <size_t N>
156{
157 public:
159 Builder() = default;
160
162 ~Builder() override = default;
163
165 Builder(const Builder& other) = delete;
166
168 Builder(Builder&& other) noexcept = delete;
169
171 Builder& operator=(const Builder& other) = delete;
172
174 Builder& operator=(Builder&& other) noexcept = delete;
175
178
180 std::shared_ptr<PointSimpleListSearcher<N>> MakeShared() const;
181
183 std::shared_ptr<PointNeighborSearcher<N>> BuildPointNeighborSearcher()
184 const override;
185};
186} // namespace CubbyFlow
187
188#endif
#define CUBBYFLOW_REQUIRES(...)
Definition Macros.hpp:81
#define CUBBYFLOW_NEIGHBOR_SEARCHER_TYPE_NAME(DerivedClassName, N)
Definition PointNeighborSearcher.hpp:163
Definition Array.hpp:36
Generic N-dimensional array class interface.
Definition ArrayView.hpp:26
Definition Matrix.hpp:30
Abstract base class for N-D point neighbor searcher builders.
Definition PointNeighborSearcher.hpp:120
Abstract base class for N-D neighbor point searcher.
Definition PointNeighborSearcher.hpp:33
std::function< void(size_t, const Vector< double, N > &)> ForEachNearbyPointFunc
Definition PointNeighborSearcher.hpp:38
Front-end to create PointSimpleListSearcher objects step by step.
Definition PointSimpleListSearcher.hpp:156
Builder & operator=(Builder &&other) noexcept=delete
Deleted move assignment operator.
std::shared_ptr< PointNeighborSearcher< N > > BuildPointNeighborSearcher() const override
Returns shared pointer of PointNeighborSearcher type.
PointSimpleListSearcher< N > Build() const
Builds PointSimpleListSearcher instance.
std::shared_ptr< PointSimpleListSearcher< N > > MakeShared() const
Builds shared pointer of PointSimpleListSearcher instance.
Builder()=default
Default constructor.
Builder & operator=(const Builder &other)=delete
Deleted copy assignment operator.
~Builder() override=default
Default virtual destructor.
Builder(const Builder &other)=delete
Deleted copy constructor.
Builder(Builder &&other) noexcept=delete
Deleted move constructor.
Simple ad-hoc N-D point searcher.
Definition PointSimpleListSearcher.hpp:28
PointSimpleListSearcher(const PointSimpleListSearcher &other)
Copy constructor.
PointSimpleListSearcher()=default
Default constructor.
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the neighbor searcher into the buffer.
PointSimpleListSearcher(PointSimpleListSearcher &&other) noexcept
Move constructor.
void Build(const ConstArrayView1< Vector< double, N > > &points, double maxSearchRadius) override
Builds internal structure for given points list and max search radius.
void Set(const PointSimpleListSearcher &other)
Copy from the other instance.
std::shared_ptr< PointNeighborSearcher< N > > Clone() const override
Creates a new instance of the object with same properties than original.
~PointSimpleListSearcher() override=default
Default virtual destructor.
static Builder GetBuilder()
Returns builder fox PointSimpleListSearcher.
bool HasNearbyPoint(const Vector< double, N > &origin, double radius) const override
PointSimpleListSearcher & operator=(const PointSimpleListSearcher &other)
Copy assignment operator.
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the neighbor searcher from the buffer.
void ForEachNearbyPoint(const Vector< double, N > &origin, double radius, const ForEachNearbyPointFunc &callback) const override
PointSimpleListSearcher & operator=(PointSimpleListSearcher &&other) noexcept
Move assignment operator.
Definition pybind11Utils.hpp:22
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:719
std::shared_ptr< PointSimpleListSearcher< 3 > > PointSimpleListSearcher3Ptr
Shared pointer for the PointSimpleListSearcher3 type.
Definition PointSimpleListSearcher.hpp:148
std::shared_ptr< PointSimpleListSearcher< 2 > > PointSimpleListSearcher2Ptr
Shared pointer for the PointSimpleListSearcher2 type.
Definition PointSimpleListSearcher.hpp:145