Points Host

template<std::size_t Ndim>
class PointsHost : public internal::points_interface<PointsHost<Ndim>>

The PointsHost class is a data structure that manages points in host memory. It provides methods to allocate, access, and manipulate points in host memory.

Template Parameters:
std::size_t Ndim

The number of dimensions of the points to manage

Public Functions

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points)

Constructs a container for the points allocated on the host.

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points to allocate

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points, std::span<std::byte> buffer)

Constructs a container for the points allocated on the host using a pre-allocated buffers.

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

std::span<std::byte> buffer

The pre-allocated buffer to use for the points data

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points, std::span<float> input, std::span<int> output)

Constructs a container for the points allocated on the host using interleaved data.

Note

The input buffer must contain the coordinates and weights in an SoA format

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

input_buffer

The pre-allocated buffer containing interleaved coordinates and weights

output_buffer

The pre-allocated buffer to store the cluster indexes

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points, std::span<float> coordinates, std::span<float> weights, std::span<int> output)

Constructs a container for the points allocated on the host using separate coordinate and weight buffers.

Note

The coordinates buffer must have a size of n_points * Ndim

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

std::span<float> coordinates

The pre-allocated buffer containing the coordinates

std::span<float> weights

The pre-allocated buffer containing the weights

std::span<int> output

The pre-allocated buffer to store the cluster indexes

template<concepts::queue TQueue, std::ranges::contiguous_range... TBuffers>
PointsHost(TQueue &queue, int32_t n_points, TBuffers&&... buffers)

Constructs a container for the points allocated on the host using multiple pre-allocated buffers.

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

TBuffers&&... buffers

The pre-allocated buffers to use for the points data

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points, float *input, int *output)

Constructs a container for the points allocated on the host using interleaved data.

Note

The input buffer must contain the coordinates and weights in an SoA format

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

input_buffer

The pre-allocated buffer containing interleaved coordinates and weights

output_buffer

The pre-allocated buffer to store the cluster indexes

template<concepts::queue TQueue>
PointsHost(TQueue &queue, int32_t n_points, float *coordinates, float *weights, int *output)

Constructs a container for the points allocated on the host using separate coordinate and weight buffers.

Note

The coordinates buffer must have a size of n_points * Ndim

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

float *coordinates

The pre-allocated buffer containing the coordinates

float *weights

The pre-allocated buffer containing the weights

int *output

The pre-allocated buffer to store the cluster indexes

template<concepts::queue TQueue, concepts::pointer... TBuffers>
PointsHost(TQueue &queue, int32_t n_points, TBuffers... buffers)

Constructs a container for the points allocated on the host using multiple pre-allocated buffers.

Parameters:
TQueue &queue

The queue to use for memory allocation

int32_t n_points

The number of points

TBuffers... buffers

The pre-allocated buffers to use for the points data

PointsHost(const PointsHost&) = delete
PointsHost &operator=(const PointsHost&) = delete
PointsHost(PointsHost&&) = default
PointsHost &operator=(PointsHost&&) = default
~PointsHost() = default
ALPAKA_FN_HOST int32_t size() const

Returns the number of points.

Returns:

The number of points

ALPAKA_FN_HOST auto coords(size_t dim) const

Returns the coordinates of the points for a specific dimension as a const span.

Parameters:
size_t dim

The dimension for which to get the coordinates

Returns:

A const span of the coordinates for the specified dimension

ALPAKA_FN_HOST auto coords(size_t dim)

Returns the coordinates of the points for a specific dimension as a span.

Parameters:
size_t dim

The dimension for which to get the coordinates

Returns:

A span of the coordinates for the specified dimension

ALPAKA_FN_HOST auto weights() const

Returns the weights of the points as a const span.

Returns:

A const span of the weights of the points

ALPAKA_FN_HOST auto weights()

Returns the weights of the points as a span.

Returns:

A span of the weights of the points

ALPAKA_FN_HOST auto clusterIndexes() const

Returns the cluster indexes of the points as a const span.

Returns:

A const span of the cluster indexes of the points

ALPAKA_FN_HOST auto clusterIndexes()

Returns the cluster indexes of the points as a span.

Returns:

A span of the cluster indexes of the points

ALPAKA_FN_HOST auto clustered() const

Indicates whether the points have been clustered.

Returns:

True if the points have been clustered, false otherwise

ALPAKA_FN_HOST const auto &view() const

Returns the view of the points.

Returns:

A const reference to the PointsView structure containing the points data

ALPAKA_FN_HOST auto &view()

Returns the view of the points.

Returns:

A reference to the PointsView structure containing the points data

Point operator[](std::size_t idx) const

Returns the Point object at the specified index.

Parameters:
std::size_t idx

The index of the point to retrieve

Returns:

The Point object at the specified index

const auto &n_clusters()

Teturns the cluster properties of the points.

Note

This value is lazily evaluated and cached upon the first call

Returns:

The number of clusters reconstructed

const auto &clusters()

Returns the associator mapping clusters to their associated points.

Note

This object is lazily evaluated and cached upon the first call

Returns:

An host_associator mapping clusters to points

const auto &cluster_sizes()

Returns a vector containing the sizes of each cluster.

Note

This vector is lazily evaluated and cached upon the first call

Returns:

A vector of containing the sizes of each cluster

const auto &cluster_properties()

Returns the ClusterProperties object containing the properties of the clusters.

Note

This object is lazily evaluated and cached upon the first call

Returns:

The ClusterProperties object

Friends

friend struct internal::points_interface< PointsHost< Ndim > >
class Point

Public Functions

Point(const std::array<float, Ndim> &coordinates, float weight, int cluster_index)
float operator[](size_t dim) const
float weight() const
float cluster_index() const