7#include "CLUEstering/core/detail/CLUEAlpakaKernels.hpp"
8#include "CLUEstering/core/detail/defines.hpp"
11#include "CLUEstering/data_structures/Tiles.hpp"
12#include "CLUEstering/data_structures/internal/Followers.hpp"
24 template <u
int8_t Ndim>
31 using FollowersDevice = clue::Followers<clue::Device>;
32 using Acc = internal::Acc;
33 inline static constexpr auto reserve = detail::reserve;
40 std::array<uint8_t, Ndim> m_wrappedCoordinates;
42 std::optional<TilesDevice> m_tiles;
43 std::optional<clue::device_buffer<Device, VecArray<int32_t, reserve>>> m_seeds;
44 std::optional<FollowersDevice> m_followers;
45 std::optional<PointsDevice> d_points;
47 void init_device(Queue& queue);
48 void init_device(Queue& queue, TilesDevice* tile_buffer);
50 void setupTiles(Queue& queue,
const PointsHost& h_points);
51 void setupTiles(Queue& queue,
const PointsDevice& d_points);
53 void setupFollowers(Queue& queue, int32_t n_points);
55 void setupPoints(
const PointsHost& h_points, PointsDevice& dev_points, Queue& queue);
57 void setup(Queue& queue,
const PointsHost& h_points, PointsDevice& dev_points) {
58 setupTiles(queue, h_points);
59 setupFollowers(queue, h_points.
size());
60 setupPoints(h_points, dev_points, queue);
63 template <concepts::convolutional_kernel Kernel>
64 void make_clusters_impl(PointsHost& h_points,
65 PointsDevice& dev_points,
68 std::size_t block_size);
69 template <concepts::convolutional_kernel Kernel>
70 void make_clusters_impl(PointsDevice& dev_points,
73 std::size_t block_size);
83 Clusterer(
float dc,
float rhoc,
float dm,
float seed_dc = -1.f,
int pPBin = 128);
92 Clusterer(Queue& queue,
float dc,
float rhoc,
float dm,
float seed_dc = -1.f,
int pPBin = 128);
103 TilesDevice* tile_buffer,
107 float seed_dc = -1.f,
117 void setParameters(
float dc,
float rhoc,
float dm,
float seed_dc = -1.f,
int pPBin = 128);
125 template <concepts::convolutional_kernel Kernel = FlatKernel>
127 PointsHost& h_points,
129 std::size_t block_size = 256);
136 template <concepts::convolutional_kernel Kernel = FlatKernel>
139 std::size_t block_size = 256);
147 template <concepts::convolutional_kernel Kernel = FlatKernel>
149 PointsHost& h_points,
150 PointsDevice& dev_points,
152 std::size_t block_size = 256);
160 template <concepts::convolutional_kernel Kernel = FlatKernel>
162 PointsDevice& dev_points,
164 std::size_t block_size = 256);
171 template <concepts::convolutional_kernel Kernel = FlatKernel>
173 PointsDevice& dev_points,
175 std::size_t block_size = 256);
189 template <
typename... TArgs>
196 std::vector<std::vector<int>>
getClusters(
const PointsHost& h_points);
201#include "CLUEstering/core/detail/Clusterer.hpp"
Provides the PointsDevice class for managing points on a device.
Provides the PointsHost class for managing points in host memory.
Clusterer(float dc, float rhoc, float dm, float seed_dc=-1.f, int pPBin=128)
Constuct a Clusterer object.
void setWrappedCoordinates(TArgs... wrappedCoordinates)
Specify which coordinates are periodic.
void make_clusters(PointsHost &h_points, PointsDevice &dev_points, const Kernel &kernel=FlatKernel{.5f}, std::size_t block_size=256)
Construct the clusters from host and device points.
void make_clusters(Queue &queue, PointsDevice &dev_points, const Kernel &kernel=FlatKernel{.5f}, std::size_t block_size=256)
Construct the clusters from device points.
void setParameters(float dc, float rhoc, float dm, float seed_dc=-1.f, int pPBin=128)
Set the parameters for the clustering algorithm.
void setWrappedCoordinates(std::array< uint8_t, Ndim > &&wrappedCoordinates)
Specify which coordinates are periodic.
std::vector< std::vector< int > > getClusters(const PointsHost &h_points)
Get the clusters from the host points.
Clusterer(Queue &queue, TilesDevice *tile_buffer, float dc, float rhoc, float dm, float seed_dc=-1.f, int pPBin=128)
Constuct a Clusterer object.
void make_clusters(Queue &queue, PointsHost &h_points, PointsDevice &dev_points, const Kernel &kernel=FlatKernel{.5f}, std::size_t block_size=256)
Construct the clusters from host and device points.
Clusterer(Queue &queue, float dc, float rhoc, float dm, float seed_dc=-1.f, int pPBin=128)
Constuct a Clusterer object.
void setWrappedCoordinates(const std::array< uint8_t, Ndim > &wrappedCoordinates)
Specify which coordinates are periodic.
void make_clusters(Queue &queue, PointsHost &h_points, const Kernel &kernel=FlatKernel{.5f}, std::size_t block_size=256)
Construct the clusters from host points.
void make_clusters(PointsHost &h_points, const Kernel &kernel=FlatKernel{.5f}, std::size_t block_size=256)
Construct the clusters from host points.
The FlatKernel class implements a flat kernel for convolution. It returns a constant value for the ke...
Definition ConvolutionalKernel.hpp:13
The PointsDevice class is a data structure that manages points on a device. It provides methods to al...
Definition PointsDevice.hpp:25
The PointsHost class is a data structure that manages points in host memory. It provides methods to a...
Definition PointsHost.hpp:22
ALPAKA_FN_HOST int32_t size() const
Returns the number of points.