pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
Model::BodiesAdaptor Class Reference

An adapter to allow nanoflann to work directly with our Bodies SoA container. More...

#include <kdtree.hpp>

Collaboration diagram for Model::BodiesAdaptor:
Collaboration graph

Public Member Functions

 BodiesAdaptor (const Bodies &in_bodies)
 Construct a new Bodies Adaptor object. More...
 
std::size_t kdtree_get_point_count () const
 Returns the number of bodies (points) in the dataset. More...
 
double kdtree_get_pt (const std::size_t idx, const std::size_t dim) const
 Returns the value of a single dimension of a point. More...
 
template<class BBOX >
bool kdtree_get_bbox (BBOX &) const
 Optional bounding box calculation (not used here). More...
 

Private Attributes

const Bodiesbodies_
 A const reference to the bodies container. More...
 

Detailed Description

An adapter to allow nanoflann to work directly with our Bodies SoA container.

Note: The method names in this class follow the snake_case convention required by the nanoflann library's adapter interface, rather than the project's standard camelCase.

Definition at line 29 of file kdtree.hpp.

Constructor & Destructor Documentation

◆ BodiesAdaptor()

Model::BodiesAdaptor::BodiesAdaptor ( const Bodies in_bodies)
inlineexplicit

Construct a new Bodies Adaptor object.

Parameters
in_bodiesThe Bodies container.

Definition at line 35 of file kdtree.hpp.

Member Function Documentation

◆ kdtree_get_bbox()

template<class BBOX >
bool Model::BodiesAdaptor::kdtree_get_bbox ( BBOX &  ) const
inline

Optional bounding box calculation (not used here).

Template Parameters
BBOXThe type of the bounding box.
Returns
Always false.

Definition at line 62 of file kdtree.hpp.

◆ kdtree_get_point_count()

std::size_t Model::BodiesAdaptor::kdtree_get_point_count ( ) const
inline

Returns the number of bodies (points) in the dataset.

Returns
The number of bodies.

Definition at line 41 of file kdtree.hpp.

Here is the call graph for this function:

◆ kdtree_get_pt()

double Model::BodiesAdaptor::kdtree_get_pt ( const std::size_t  idx,
const std::size_t  dim 
) const
inline

Returns the value of a single dimension of a point.

Parameters
idxThe index of the point.
dimThe dimension (0 for x, 1 for y, 2 for z).
Returns
The coordinate value.

Definition at line 51 of file kdtree.hpp.

Member Data Documentation

◆ bodies_

const Bodies& Model::BodiesAdaptor::bodies_
private

A const reference to the bodies container.

Definition at line 68 of file kdtree.hpp.


The documentation for this class was generated from the following file: