23#include "libmesh/tree.h"
24#include "libmesh/mesh_base.h"
25#include "libmesh/mesh_tools.h"
36template <
unsigned int N>
38 unsigned int target_bin_size,
41 root(m,target_bin_size),
52 for (
const auto & node :
mesh.node_ptr_range())
55 bool node_was_inserted =
64 std::unordered_map<dof_id_type, std::vector<const Elem *>> nodes_to_elem;
67 root.transform_nodes_to_elements (nodes_to_elem);
74 for (
const auto & elem :
mesh.active_element_ptr_range())
77 bool elem_was_inserted =
88 for (
const auto & elem :
mesh.active_local_element_ptr_range())
91 bool elem_was_inserted =
99 libmesh_error_msg(
"Unknown build_type = " <<
build_type);
104template <
unsigned int N>
107 my_out <<
"Printing nodes...\n";
108 root.print_nodes(my_out);
113template <
unsigned int N>
116 my_out <<
"Printing elements...\n";
117 root.print_elements(my_out);
122template <
unsigned int N>
125 const std::set<subdomain_id_type> * allowed_subdomains,
126 Real relative_tol)
const
128 return root.find_element(p, allowed_subdomains, relative_tol);
133template <
unsigned int N>
136 std::set<const Elem *> & candidate_elements,
137 const std::set<subdomain_id_type> * allowed_subdomains,
138 Real relative_tol)
const
140 return root.find_elements(p, candidate_elements, allowed_subdomains, relative_tol);
145template <
unsigned int N>
148 const std::set<subdomain_id_type> * allowed_subdomains,
149 Real relative_tol)
const
151 return this->find_element(p, allowed_subdomains, relative_tol);
This is the base class from which all geometric element types are derived.
This is the MeshBase class.
A Point defines a location in LIBMESH_DIM dimensional Real space.
This is the base class for trees, it allows pointer usage of trees.
const MeshBase & mesh
Constant reference to a mesh.
This class defines a tree that may be used for fast point location in space.
Tree(const MeshBase &m, unsigned int target_bin_size, Trees::BuildType bt=Trees::NODES)
Constructor.
virtual void print_elements(std::ostream &my_out=libMesh::out) const override
Prints the nodes.
virtual void print_nodes(std::ostream &my_out=libMesh::out) const override
Prints the nodes.
virtual const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const override
TreeNode< N > root
The tree root.
const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const
virtual void find_elements(const Point &p, std::set< const Elem * > &candidate_elements, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const override
Adds to candidate_elements any elements containing the specified point p, optionally restricted to a ...
const Trees::BuildType build_type
How the tree is built.
BuildType
enum defining how to build the tree.
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real