CLUEstering
High-performance density-based weighted clustering library developed at CERN
Loading...
Searching...
No Matches
PointsHost.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
7#include "CLUEstering/data_structures/internal/PointsCommon.hpp"
8#include "CLUEstering/internal/alpaka/memory.hpp"
9
10#include <optional>
11#include <ranges>
12#include <span>
13#include <alpaka/alpaka.hpp>
14
15namespace clue {
16
17 namespace concepts = detail::concepts;
18
23 template <uint8_t Ndim>
24 class PointsHost {
25 public:
26 template <concepts::queue TQueue>
27 PointsHost(TQueue& queue, int32_t n_points);
28
29 template <concepts::queue TQueue>
30 PointsHost(TQueue& queue, int32_t n_points, std::span<std::byte> buffer);
31
32 template <concepts::queue TQueue, std::ranges::contiguous_range... TBuffers>
33 requires(sizeof...(TBuffers) == 2 || sizeof...(TBuffers) == 4)
34 PointsHost(TQueue& queue, int32_t n_points, TBuffers&&... buffers);
35
36 template <concepts::queue TQueue, concepts::contiguous_raw_data... TBuffers>
37 requires(sizeof...(TBuffers) == 2 || sizeof...(TBuffers) == 4)
38 PointsHost(TQueue& queue, int32_t n_points, TBuffers... buffers);
39
40 PointsHost(const PointsHost&) = delete;
41 PointsHost& operator=(const PointsHost&) = delete;
42 PointsHost(PointsHost&&) = default;
43 PointsHost& operator=(PointsHost&&) = default;
44 ~PointsHost() = default;
45
46 ALPAKA_FN_HOST int32_t size() const;
47
48 ALPAKA_FN_HOST std::span<const float> coords() const;
49 ALPAKA_FN_HOST std::span<float> coords();
50
51 ALPAKA_FN_HOST std::span<const float> coords(size_t dim) const;
52 ALPAKA_FN_HOST std::span<float> coords(size_t dim);
53
54 ALPAKA_FN_HOST std::span<const float> weights() const;
55 ALPAKA_FN_HOST std::span<float> weights();
56
57 ALPAKA_FN_HOST std::span<const int> clusterIndexes() const;
58 ALPAKA_FN_HOST std::span<int> clusterIndexes();
59
60 ALPAKA_FN_HOST std::span<const int> isSeed() const;
61 ALPAKA_FN_HOST std::span<int> isSeed();
62
63 ALPAKA_FN_HOST const PointsView* view() const;
64 ALPAKA_FN_HOST PointsView* view();
65
66 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
67 friend void copyToHost(_TQueue& queue,
68 PointsHost<_Ndim>& h_points,
69 const PointsDevice<_Ndim, _TDev>& d_points);
70 template <concepts::queue _TQueue, uint8_t _Ndim, concepts::device _TDev>
71 friend void copyToDevice(_TQueue& queue,
73 const PointsHost<_Ndim>& h_points);
74
75 private:
76 std::optional<host_buffer<std::byte[]>> m_buffer;
77 host_buffer<PointsView> m_view;
78 int32_t m_size;
79 };
80
81} // namespace clue
82
83#include "CLUEstering/data_structures/detail/PointsHost.hpp"
The PointsDevice class is a data structure that manages points on a device. It provides methods to al...
Definition PointsDevice.hpp:27