https://mooseframework.inl.gov
Public Types | Public Member Functions | Private Attributes | List of all members
NanoflannMeshAdaptor< Dim > Class Template Reference

This allows us to adapt the MeshBase class for use with nanoflann. More...

#include <NanoflannMeshAdaptor.h>

Public Types

typedef Real coord_t
 libMesh Point coordinate type More...
 

Public Member Functions

 NanoflannMeshAdaptor (const MeshBase &mesh)
 
size_t kdtree_get_point_count () const
 Must return the number of data points. More...
 
coord_t kdtree_distance (const coord_t *p1, const size_t idx_p2, size_t size) const
 Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in _mesh. More...
 
coord_t kdtree_get_pt (const size_t idx, int dim) const
 Returns the dim'th component of the idx'th point in the class. More...
 
template<class BBOX >
bool kdtree_get_bbox (BBOX &) const
 Optional bounding-box computation: return false to default to a standard bbox computation loop. More...
 

Private Attributes

const MeshBase_mesh
 

Detailed Description

template<unsigned int Dim>
class NanoflannMeshAdaptor< Dim >

This allows us to adapt the MeshBase class for use with nanoflann.

Taken from detect_slit.cc

Definition at line 41 of file NanoflannMeshAdaptor.h.

Member Typedef Documentation

◆ coord_t

template<unsigned int Dim>
typedef Real NanoflannMeshAdaptor< Dim >::coord_t

libMesh Point coordinate type

Definition at line 53 of file NanoflannMeshAdaptor.h.

Constructor & Destructor Documentation

◆ NanoflannMeshAdaptor()

template<unsigned int Dim>
NanoflannMeshAdaptor< Dim >::NanoflannMeshAdaptor ( const MeshBase mesh)
inline

Definition at line 48 of file NanoflannMeshAdaptor.h.

48 : _mesh(mesh) {}

Member Function Documentation

◆ kdtree_distance()

template<unsigned int Dim>
coord_t NanoflannMeshAdaptor< Dim >::kdtree_distance ( const coord_t p1,
const size_t  idx_p2,
size_t  size 
) const
inline

Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in _mesh.

Definition at line 64 of file NanoflannMeshAdaptor.h.

65  {
66  libmesh_assert_equal_to(size, Dim);
67 
68  // Construct a libmesh Point object from the input coord_t. This
69  // assumes LIBMESH_DIM==3.
70  Point point1(p1[0], size > 1 ? p1[1] : 0., size > 2 ? p1[2] : 0.);
71 
72  // Get the referred-to point from the Mesh
73  const Point & point2 = _mesh.point(idx_p2);
74 
75  // Compute Euclidean distance, squared
76  return (point1 - point2).norm_sq();
77  }
auto norm_sq() const -> decltype(std::norm(Real()))
virtual const Point & point(const dof_id_type i) const=0

◆ kdtree_get_bbox()

template<unsigned int Dim>
template<class BBOX >
bool NanoflannMeshAdaptor< Dim >::kdtree_get_bbox ( BBOX &  ) const
inline

Optional bounding-box computation: return false to default to a standard bbox computation loop.

Definition at line 96 of file NanoflannMeshAdaptor.h.

97  {
98  return false;
99  }

◆ kdtree_get_point_count()

template<unsigned int Dim>
size_t NanoflannMeshAdaptor< Dim >::kdtree_get_point_count ( ) const
inline

Must return the number of data points.

Definition at line 58 of file NanoflannMeshAdaptor.h.

58 { return _mesh.n_nodes(); }
virtual dof_id_type n_nodes() const=0

◆ kdtree_get_pt()

template<unsigned int Dim>
coord_t NanoflannMeshAdaptor< Dim >::kdtree_get_pt ( const size_t  idx,
int  dim 
) const
inline

Returns the dim'th component of the idx'th point in the class.

Definition at line 82 of file NanoflannMeshAdaptor.h.

83  {
84  libmesh_assert_less(dim, (int)Dim);
85  libmesh_assert_less(idx, _mesh.n_nodes());
86  libmesh_assert_less(dim, 3);
87 
88  return _mesh.point(idx)(dim);
89  }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
virtual const Point & point(const dof_id_type i) const=0
virtual dof_id_type n_nodes() const=0

Member Data Documentation

◆ _mesh

template<unsigned int Dim>
const MeshBase& NanoflannMeshAdaptor< Dim >::_mesh
private

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