15 #include "libmesh/libmesh_config.h" 16 #include "libmesh/libmesh_common.h" 17 #include "libmesh/mesh_base.h" 18 #include "libmesh/point.h" 19 #include "libmesh/elem.h" 20 #ifdef LIBMESH_HAVE_NANOFLANN 21 #include "libmesh/nanoflann.hpp" 40 template <
unsigned int Dim>
66 libmesh_assert_equal_to(size, Dim);
70 Point point1(p1[0], size > 1 ? p1[1] : 0., size > 2 ? p1[2] : 0.);
76 return (point1 - point2).
norm_sq();
84 libmesh_assert_less(
dim, (
int)Dim);
86 libmesh_assert_less(
dim, 3);
105 typedef nanoflann::L2_Simple_Adaptor<Real, NanoflannMeshAdaptor<3>>
adatper_t;
108 typedef nanoflann::KDTreeSingleIndexAdaptor<adatper_t, NanoflannMeshAdaptor<3>, 3>
kd_tree_t;
117 template <
unsigned int Dim>
135 for (
const auto & elem :
_mesh.active_element_ptr_range())
136 if (elem->subdomain_id() ==
_sid)
137 for (MooseIndex(elem->n_vertices()) n = 0; n < elem->n_vertices(); ++n)
157 libmesh_assert_equal_to(size, Dim);
165 Point point1(p1[0], size > 1 ? p1[1] : 0., size > 2 ? p1[2] : 0.);
171 return (point1 - point2).
norm_sq();
179 libmesh_assert_less(
dim, (
int)Dim);
181 libmesh_assert_less(
dim, 3);
194 template <
class BBOX>
208 KDTreeSingleIndexAdaptor<subdomain_adatper_t, NanoflannMeshSubdomainAdaptor<3>, 3>
nanoflann::L2_Simple_Adaptor< Real, NanoflannMeshAdaptor< 3 > > adatper_t
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.
size_t kdtree_get_point_count() const
Must return the number of data points.
TestClass subdomain_id_type
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Special adaptor that works with subdomains of the Mesh.
auto max(const L &left, const R &right)
nanoflann::KDTreeSingleIndexAdaptor< adatper_t, NanoflannMeshAdaptor< 3 >, 3 > kd_tree_t
auto norm_sq() const -> decltype(std::norm(Real()))
bool kdtree_get_bbox(BBOX &) const
Optional bounding-box computation: return false to default to a standard bbox computation loop...
NanoflannMeshSubdomainAdaptor(const MeshBase &mesh, subdomain_id_type s)
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 ...
NanoflannMeshAdaptor(const MeshBase &mesh)
nanoflann::KDTreeSingleIndexAdaptor< subdomain_adatper_t, NanoflannMeshSubdomainAdaptor< 3 >, 3 > subdomain_kd_tree_t
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real coord_t
libMesh Point coordinate type
bool kdtree_get_bbox(BBOX &) const
Optional bounding-box computation: return false to default to a standard bbox computation loop...
This allows us to adapt the MeshBase class for use with nanoflann.
virtual const Point & point(const dof_id_type i) const=0
Real coord_t
libMesh Point coordinate type
nanoflann::L2_Simple_Adaptor< Real, NanoflannMeshSubdomainAdaptor< 3 > > subdomain_adatper_t
virtual dof_id_type n_nodes() const=0
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 ...
size_t kdtree_get_point_count() const
Must return the number of data points.
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.
std::set< dof_id_type > _legal_point_indices