20#ifndef LIBMESH_TREE_NODE_H
21#define LIBMESH_TREE_NODE_H
24#include "libmesh/libmesh_common.h"
25#include "libmesh/bounding_box.h"
26#include "libmesh/point.h"
31#include <unordered_map>
53template <
unsigned int N>
120 Real relative_tol = 0)
const;
127 Real relative_tol = 0)
const;
132 unsigned int level ()
const;
167 const std::set<subdomain_id_type> * allowed_subdomains =
nullptr,
177 std::set<const Elem *> & candidate_elements,
178 const std::set<subdomain_id_type> * allowed_subdomains =
nullptr,
187 const std::set<subdomain_id_type> * allowed_subdomains,
188 Real relative_tol)
const;
195 std::set<const Elem *> & candidate_elements,
196 const std::set<subdomain_id_type> * allowed_subdomains,
197 Real relative_tol)
const;
218 std::vector<std::unique_ptr<TreeNode<N>>>
children;
262template <
unsigned int N>
270 target_bin_size_increase_level(10),
271 contains_ifems (false)
284template <
unsigned int N>
288 if (parent !=
nullptr)
289 return parent->level()+1;
Defines a Cartesian bounding box by the two corner extremum.
This is the base class from which all geometric element types are derived.
This is the MeshBase class.
A Node is like a Point, but with more information.
A Point defines a location in LIBMESH_DIM dimensional Real space.
This class defines a node on a tree.
std::vector< std::unique_ptr< TreeNode< N > > > children
Pointers to our children.
void print_nodes(std::ostream &out_stream=libMesh::out) const
Prints the contents of the node_numbers vector if we are active.
bool bounds_node(const Node *nd, Real relative_tol=0) const
BoundingBox create_bounding_box(unsigned int c) const
Constructs the bounding box for child c.
const MeshBase & mesh
Reference to the mesh.
TreeNode(const MeshBase &m, unsigned int tbs, const TreeNode< N > *p=nullptr)
Constructor.
void print_elements(std::ostream &out_stream=libMesh::out) const
Prints the contents of the elements set if we are active.
void transform_nodes_to_elements(std::vector< std::vector< const Elem * > > &nodes_to_elem)
Transforms node numbers to element pointers.
BoundingBox bounding_box
The Cartesian bounding box for the node.
bool bounds_point(const Point &p, Real relative_tol=0) const
void find_elements_in_children(const Point &p, std::set< const Elem * > &candidate_elements, const std::set< subdomain_id_type > *allowed_subdomains, Real relative_tol) const
Look for points in our children, optionally restricted to a set of allowed subdomains.
std::vector< const Node * > nodes
The node numbers contained in this portion of the tree.
const TreeNode< N > * parent
Pointer to this node's parent.
std::vector< const Elem * > elements
Pointers to the elements in this tree node.
void refine()
Refine the tree node into N children if it contains more than tol nodes.
void set_bounding_box(const std::pair< Point, Point > &bbox)
Sets the bounding box;.
TreeNode(const TreeNode< N > &)=delete
Class contains unique_ptrs and cannot be default copied.
bool contains_ifems
Does this node contain any infinite elements.
const Elem * find_element_in_children(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains, Real relative_tol) const
Look for point p in our children, optionally restricted to a set of allowed subdomains.
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
Adds to candidate_elements any elements containing the specified point p, optionally restricted to a ...
unsigned int n_active_bins() const
unsigned int level() const
~TreeNode()=default
Destructor.
bool insert(const Node *nd)
Tries to insert Node nd into the TreeNode.
const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const
const unsigned int tgt_bin_size
The maximum number of things we should store before refining ourself.
unsigned int target_bin_size_increase_level
This specifies the refinement level beyond which we will scale up the target bin size in child TreeNo...
The libMesh namespace provides an interface to certain functionality in the library.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real