CLUEstering
High-performance density-based weighted clustering library developed at CERN
Loading...
Searching...
No Matches
PointsDevice.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
7#include "CLUEstering/core/detail/defines.hpp"
8#include "CLUEstering/data_structures/internal/PointsCommon.hpp"
9#include "CLUEstering/detail/concepts.hpp"
10#include "CLUEstering/internal/alpaka/memory.hpp"
11
12#include <optional>
13#include <ranges>
14#include <span>
15#include <alpaka/alpaka.hpp>
16
17namespace clue {
18
19 namespace concepts = detail::concepts;
20
26 template <uint8_t Ndim, concepts::device TDev = clue::Device>
28 public:
33 template <concepts::queue TQueue>
34 PointsDevice(TQueue& queue, int32_t n_points);
35
41 template <concepts::queue TQueue>
42 PointsDevice(TQueue& queue, int32_t n_points, std::span<std::byte> buffer);
43
49 template <concepts::queue TQueue, concepts::contiguous_raw_data... TBuffers>
50 requires(sizeof...(TBuffers) == 2 || sizeof...(TBuffers) == 4)
51 PointsDevice(TQueue& queue, int32_t n_points, TBuffers... buffers);
52
53 PointsDevice(const PointsDevice&) = delete;
54 PointsDevice& operator=(const PointsDevice&) = delete;
55 PointsDevice(PointsDevice&&) = default;
56 PointsDevice& operator=(PointsDevice&&) = default;
57 ~PointsDevice() = default;
58
62 ALPAKA_FN_HOST_ACC int32_t size() const;
63
68 ALPAKA_FN_HOST auto coords(size_t dim) const;
73 ALPAKA_FN_HOST auto coords(size_t dim);
74
78 ALPAKA_FN_HOST auto weight() const;
82 ALPAKA_FN_HOST auto weight();
83
87 ALPAKA_FN_HOST auto rho() const;
91 ALPAKA_FN_HOST auto rho();
92
93 ALPAKA_FN_HOST auto delta() const;
94 ALPAKA_FN_HOST auto delta();
95
96 ALPAKA_FN_HOST auto nearestHigher() const;
97 ALPAKA_FN_HOST auto nearestHigher();
98
99 ALPAKA_FN_HOST auto clusterIndex() const;
100 ALPAKA_FN_HOST auto clusterIndex();
101
102 ALPAKA_FN_HOST auto isSeed() const;
103 ALPAKA_FN_HOST auto isSeed();
104
105 ALPAKA_FN_HOST const PointsView* view() const;
106 ALPAKA_FN_HOST PointsView* view();
107
109 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
110 friend void copyToHost(_TQueue& queue,
111 PointsHost<_Ndim>& h_points,
112 const PointsDevice<_Ndim, _TDev>& d_points);
113 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
114 friend void copyToDevice(_TQueue& queue,
116 const PointsHost<_Ndim>& h_points);
117
118 private:
119 device_buffer<TDev, std::byte[]> m_buffer;
120 device_buffer<TDev, PointsView> m_view;
121 host_buffer<PointsView> m_hostView;
122 int32_t m_size;
123 };
124
125} // namespace clue
126
127#include "CLUEstering/data_structures/detail/PointsDevice.hpp"
PointsDevice(TQueue &queue, int32_t n_points, std::span< std::byte > buffer)
Construct a PointsDevice object with a pre-allocated buffer.
PointsDevice(TQueue &queue, int32_t n_points, TBuffers... buffers)
Construct a PointsDevice object with a pre-allocated buffer.
ALPAKA_FN_HOST auto rho()
Get the weighted density values of all the points.
ALPAKA_FN_HOST auto weight()
Get the weights of all the points.
ALPAKA_FN_HOST auto weight() const
Get the weights of all the points.
ALPAKA_FN_HOST auto rho() const
Get the weighted density values of all the points.
ALPAKA_FN_HOST auto coords(size_t dim)
Get the coordinates for a specific dimension.
ALPAKA_FN_HOST_ACC int32_t size() const
Get the size of the points.
ALPAKA_FN_HOST auto coords(size_t dim) const
Get the coordinates for a specific dimension.
PointsDevice(TQueue &queue, int32_t n_points)
Construct a PointsDevice object.
The PointsHost class is a data structure that manages points in host memory. It provides methods to a...
Definition PointsHost.hpp:24