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
24 template <uint8_t Ndim, concepts::device TDev = clue::Device>
25 class PointsDevice : public internal::points_interface<PointsDevice<Ndim, TDev>> {
26 private:
27 device_buffer<TDev, std::byte[]> m_buffer;
28 PointsView m_view;
29 int32_t m_size;
30
31 public:
36 template <concepts::queue TQueue>
37 PointsDevice(TQueue& queue, int32_t n_points);
38
44 template <concepts::queue TQueue>
45 PointsDevice(TQueue& queue, int32_t n_points, std::span<std::byte> buffer);
46
52 template <concepts::queue TQueue, concepts::contiguous_raw_data... TBuffers>
53 requires(sizeof...(TBuffers) == 2 || sizeof...(TBuffers) == 4)
54 PointsDevice(TQueue& queue, int32_t n_points, TBuffers... buffers);
55
56 PointsDevice(const PointsDevice&) = delete;
57 PointsDevice& operator=(const PointsDevice&) = delete;
58 PointsDevice(PointsDevice&&) = default;
59 PointsDevice& operator=(PointsDevice&&) = default;
60 ~PointsDevice() = default;
61
62#ifdef CLUE_BUILD_DOXYGEN
65 ALPAKA_FN_HOST int32_t size() const;
68 ALPAKA_FN_HOST auto coords() const;
71 ALPAKA_FN_HOST auto coords();
75 ALPAKA_FN_HOST auto coords(size_t dim) const;
79 ALPAKA_FN_HOST auto coords(size_t dim);
82 ALPAKA_FN_HOST auto weights() const;
85 ALPAKA_FN_HOST auto weights();
88 ALPAKA_FN_HOST auto clusterIndexes() const;
91 ALPAKA_FN_HOST auto clusterIndexes();
94 ALPAKA_FN_HOST auto isSeed() const;
97 ALPAKA_FN_HOST auto isSeed();
100 ALPAKA_FN_HOST const auto& view() const;
103 ALPAKA_FN_HOST auto& view();
104#endif
105
106 ALPAKA_FN_HOST auto rho() const;
107 ALPAKA_FN_HOST auto rho();
108
109 ALPAKA_FN_HOST auto delta() const;
110 ALPAKA_FN_HOST auto delta();
111
112 ALPAKA_FN_HOST auto nearestHigher() const;
113 ALPAKA_FN_HOST auto nearestHigher();
114
115 private:
116 inline static constexpr uint8_t Ndim_ = Ndim;
117
118 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
119 friend void copyToHost(_TQueue& queue,
120 PointsHost<_Ndim>& h_points,
121 const PointsDevice<_Ndim, _TDev>& d_points);
122 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
123 friend void copyToDevice(_TQueue& queue,
125 const PointsHost<_Ndim>& h_points);
126 friend struct internal::points_interface<PointsDevice<Ndim, TDev>>;
127 };
128
129} // namespace clue
130
131#include "CLUEstering/data_structures/detail/PointsDevice.hpp"
ALPAKA_FN_HOST auto coords()
Returns the coordinates of the points as a span.
PointsDevice(TQueue &queue, int32_t n_points, std::span< std::byte > buffer)
Construct a PointsDevice object with a pre-allocated buffer.
ALPAKA_FN_HOST auto & view()
Returns the view of the points.
ALPAKA_FN_HOST auto isSeed() const
Returns the seed status of the points as a const span.
PointsDevice(TQueue &queue, int32_t n_points, TBuffers... buffers)
Construct a PointsDevice object with a pre-allocated buffer.
ALPAKA_FN_HOST auto clusterIndexes() const
Returns the cluster indexes of the points as a const span.
ALPAKA_FN_HOST auto coords() const
Returns the coordinates of the points as a const span.
ALPAKA_FN_HOST int32_t size() const
Returns the number of points.
ALPAKA_FN_HOST auto coords(size_t dim)
Returns the coordinates of the points for a specific dimension as a span.
ALPAKA_FN_HOST auto weights()
Returns the weights of the points as a span.
ALPAKA_FN_HOST auto isSeed()
Returns the seed status of the points as a span.
ALPAKA_FN_HOST auto weights() const
Returns the weights of the points as a const span.
ALPAKA_FN_HOST auto coords(size_t dim) const
Returns the coordinates of the points for a specific dimension as a const span.
ALPAKA_FN_HOST auto clusterIndexes()
Returns the cluster indexes of the points as a span.
ALPAKA_FN_HOST const auto & view() const
Returns the view of the points.
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:22