21 #include "libmesh/point_locator_base.h" 22 #include "libmesh/point_locator_tree.h" 23 #include "libmesh/elem.h" 24 #include "libmesh/enum_point_locator_type.h" 25 #include "libmesh/mesh_base.h" 26 #include "libmesh/point_locator_nanoflann.h" 42 _use_close_to_point_tol (false),
44 _use_contains_point_tol (false),
75 return std::make_unique<PointLocatorTree>(
mesh, master);
83 #ifdef LIBMESH_HAVE_NANOFLANN 85 return std::make_unique<PointLocatorNanoflann>(
mesh, master);
89 libmesh_error_msg(
"ERROR: Bad PointLocatorType = " << t);
137 const std::set<subdomain_id_type> * allowed_subdomains,
140 std::set<const Elem *> candidate_elements;
141 this->
operator()(p, candidate_elements, allowed_subdomains);
143 for (
const auto & elem : candidate_elements)
145 const int elem_n_nodes = elem->n_nodes();
146 const Real hmax = elem->hmax();
147 const Real dist_tol_sq = (tol * hmax) * (tol * hmax);
149 for (
int n=0; n != elem_n_nodes; ++n)
150 if ((elem->point(n) - p).
norm_sq() < dist_tol_sq)
151 return elem->node_ptr(n);
163 for (
const Elem * elem : this->
_mesh.active_local_element_ptr_range())
169 elem->n_nodes() : elem->n_vertices());
173 const Node & node = elem->node_ref(n);
174 std::set<const Elem *> candidate_elements;
virtual ~PointLocatorBase()
Destructor.
A Node is like a Point, but with more information.
virtual void set_close_to_point_tol(Real close_to_point_tol)
Set a tolerance to use when determining if a point is contained within the mesh.
bool _use_close_to_point_tol
true if we will use a user-specified tolerance for locating the element in an exhaustive search...
static constexpr Real TOLERANCE
Real _close_to_point_tol
The tolerance to use.
virtual Real get_contains_point_tol() const
Get the tolerance for determining element containment in the point locator.
This is the base class from which all geometric element types are derived.
bool _initialized
true when properly initialized, false otherwise.
virtual void set_contains_point_tol(Real contains_point_tol)
Set a tolerance to use when checking if a point is within an element in the mesh. ...
The libMesh namespace provides an interface to certain functionality in the library.
Real get_close_to_point_tol() const
Get the close-to-point tolerance.
void libmesh_assert_valid_point_locator()
Verifies that, for every node of every element, the point locator finds that element when searching a...
This is the MeshBase class.
const MeshBase & _mesh
constant reference to the mesh in which the point is looked for.
This is the base class for point locators.
virtual void unset_contains_point_tol()
Specify that we do not want to use a user-specified tolerance to determine if a point is inside an el...
virtual const Node * locate_node(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real tol=TOLERANCE) const
PointLocatorBase(const MeshBase &mesh, const PointLocatorBase *master)
Constructor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
virtual const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr) const =0
Locates the element in which the point with global coordinates p is located.
const PointLocatorBase * _master
Const pointer to our master, initialized to nullptr if none given.
PointLocatorType
defines an enum for the types of point locators (given a point with global coordinates, locate the corresponding element in space) available in libMesh.
virtual void unset_close_to_point_tol()
Specify that we do not want to use a user-specified tolerance to determine if a point is contained wi...
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.
A Point defines a location in LIBMESH_DIM dimensional Real space.
bool _use_contains_point_tol
true if we will use a user-specified tolerance for locating the element.
const MeshBase & get_mesh() const
Get a const reference to this PointLocator's mesh.
Real _contains_point_tol
The tolerance to use when locating an element in the tree.