libMesh
|
This class defines a node on a tree. More...
#include <tree_node.h>
Public Member Functions | |
TreeNode (const MeshBase &m, unsigned int tbs, const TreeNode< N > *p=nullptr) | |
Constructor. More... | |
TreeNode (const TreeNode< N > &)=delete | |
Class contains unique_ptrs and cannot be default copied. More... | |
~TreeNode ()=default | |
Destructor. More... | |
bool | is_root () const |
bool | active () const |
bool | insert (const Node *nd) |
Tries to insert Node nd into the TreeNode. More... | |
bool | insert (const Elem *nd) |
Inserts Elem el into the TreeNode. More... | |
void | refine () |
Refine the tree node into N children if it contains more than tol nodes. More... | |
void | set_bounding_box (const std::pair< Point, Point > &bbox) |
Sets the bounding box;. More... | |
bool | bounds_node (const Node *nd, Real relative_tol=0) const |
bool | bounds_point (const Point &p, Real relative_tol=0) const |
unsigned int | level () const |
void | print_nodes (std::ostream &out_stream=libMesh::out) const |
Prints the contents of the node_numbers vector if we are active. More... | |
void | print_elements (std::ostream &out_stream=libMesh::out) const |
Prints the contents of the elements set if we are active. More... | |
void | transform_nodes_to_elements (std::vector< std::vector< const Elem *>> &nodes_to_elem) |
Transforms node numbers to element pointers. More... | |
void | transform_nodes_to_elements (std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem) |
Transforms node numbers to element pointers. More... | |
unsigned int | n_active_bins () const |
const Elem * | find_element (const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const |
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 |
Fills candidate_elements with any elements containing the specified point p , optionally restricted to a set of allowed subdomains, optionally using a non-default relative tolerance for searches. More... | |
Private Member Functions | |
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. More... | |
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. More... | |
BoundingBox | create_bounding_box (unsigned int c) const |
Constructs the bounding box for child c . More... | |
Private Attributes | |
const MeshBase & | mesh |
Reference to the mesh. More... | |
const TreeNode< N > * | parent |
Pointer to this node's parent. More... | |
std::vector< std::unique_ptr< TreeNode< N > > > | children |
Pointers to our children. More... | |
BoundingBox | bounding_box |
The Cartesian bounding box for the node. More... | |
std::vector< const Elem * > | elements |
Pointers to the elements in this tree node. More... | |
std::vector< const Node * > | nodes |
The node numbers contained in this portion of the tree. More... | |
const unsigned int | tgt_bin_size |
The maximum number of things we should store before refining ourself. More... | |
unsigned int | target_bin_size_increase_level |
This specifies the refinement level beyond which we will scale up the target bin size in child TreeNodes. More... | |
bool | contains_ifems |
Does this node contain any infinite elements. More... | |
This class defines a node on a tree.
A tree node contains a pointer to its parent (nullptr if the node is the root) and pointers to its children (nullptr if the node is active.
Definition at line 54 of file tree_node.h.
|
inline |
Constructor.
Takes a pointer to this node's parent. The pointer should only be nullptr for the top-level (root) node.
Definition at line 264 of file tree_node.h.
References libMesh::TreeNode< N >::active(), libMesh::TreeNode< N >::children, libMesh::TreeNode< N >::elements, libMesh::libmesh_assert(), libMesh::TreeNode< N >::nodes, and libMesh::TreeNode< N >::tgt_bin_size.
|
delete |
Class contains unique_ptrs and cannot be default copied.
|
default |
Destructor.
Deletes all children, if any. Thus to delete a tree it is sufficient to explicitly delete the root node.
|
inline |
true
if this node is active (i.e. has no children), false otherwise. Definition at line 88 of file tree_node.h.
References libMesh::TreeNode< N >::children.
Referenced by libMesh::TreeNode< N >::TreeNode().
bool libMesh::TreeNode< N >::bounds_node | ( | const Node * | nd, |
Real | relative_tol = 0 |
||
) | const |
true
if this TreeNode (or its children) contain node n (within relative tolerance), false otherwise. Definition at line 255 of file tree_node.C.
References libMesh::libmesh_assert().
bool libMesh::TreeNode< N >::bounds_point | ( | const Point & | p, |
Real | relative_tol = 0 |
||
) | const |
true
if this TreeNode (or its children) contain point p (within relative tolerance), false otherwise. Definition at line 265 of file tree_node.C.
References libMesh::TensorTools::norm(), and libMesh::Real.
|
private |
Constructs the bounding box for child c
.
Definition at line 293 of file tree_node.C.
References libMesh::Real.
const Elem * libMesh::TreeNode< N >::find_element | ( | const Point & | p, |
const std::set< subdomain_id_type > * | allowed_subdomains = nullptr , |
||
Real | relative_tol = TOLERANCE |
||
) | const |
Definition at line 577 of file tree_node.C.
References libMesh::TOLERANCE.
|
private |
Look for point p
in our children, optionally restricted to a set of allowed subdomains.
Definition at line 642 of file tree_node.C.
References libMesh::index_range(), and libMesh::libmesh_assert().
void libMesh::TreeNode< N >::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 |
Fills candidate_elements
with any elements containing the specified point p
, optionally restricted to a set of allowed subdomains, optionally using a non-default relative tolerance for searches.
Definition at line 611 of file tree_node.C.
References libMesh::TOLERANCE.
|
private |
Look for points in our children, optionally restricted to a set of allowed subdomains.
Definition at line 698 of file tree_node.C.
References libMesh::libmesh_assert().
bool libMesh::TreeNode< N >::insert | ( | const Node * | nd | ) |
Tries to insert Node
nd
into the TreeNode.
true
iff nd
is inserted into the TreeNode or one of its children. Definition at line 36 of file tree_node.C.
References libMesh::DofObject::id(), libMesh::libmesh_assert(), mesh, and libMesh::MeshBase::n_nodes().
bool libMesh::TreeNode< N >::insert | ( | const Elem * | nd | ) |
Inserts Elem
el
into the TreeNode.
true
iff el
is inserted into the TreeNode or one of its children. Definition at line 71 of file tree_node.C.
References std::abs(), libMesh::MeshBase::elem_dimensions(), libMesh::MeshBase::get_count_lower_dim_elems_in_point_locator(), libMesh::Elem::infinite(), libMesh::BoundingBox::intersects(), libMesh::libmesh_assert(), libMesh::Elem::loose_bounding_box(), mesh, libMesh::Real, and libMesh::TOLERANCE.
|
inline |
true
if this node is the root node, false otherwise. Definition at line 82 of file tree_node.h.
References libMesh::TreeNode< N >::parent.
|
inline |
Definition at line 286 of file tree_node.h.
unsigned int libMesh::TreeNode< N >::n_active_bins | ( | ) | const |
Definition at line 557 of file tree_node.C.
void libMesh::TreeNode< N >::print_elements | ( | std::ostream & | out_stream = libMesh::out | ) | const |
Prints the contents of the elements set if we are active.
Definition at line 429 of file tree_node.C.
void libMesh::TreeNode< N >::print_nodes | ( | std::ostream & | out_stream = libMesh::out | ) | const |
Prints the contents of the node_numbers vector if we are active.
Definition at line 410 of file tree_node.C.
void libMesh::TreeNode< N >::refine | ( | ) |
Refine the tree node into N children if it contains more than tol nodes.
Definition at line 202 of file tree_node.C.
References libMesh::MeshTools::create_bounding_box(), libMesh::libmesh_assert(), and mesh.
void libMesh::TreeNode< N >::set_bounding_box | ( | const std::pair< Point, Point > & | bbox | ) |
Sets the bounding box;.
Definition at line 247 of file tree_node.C.
void libMesh::TreeNode< N >::transform_nodes_to_elements | ( | std::vector< std::vector< const Elem *>> & | nodes_to_elem | ) |
Transforms node numbers to element pointers.
Definition at line 448 of file tree_node.C.
References mesh, and libMesh::MeshBase::n_nodes().
void libMesh::TreeNode< N >::transform_nodes_to_elements | ( | std::unordered_map< dof_id_type, std::vector< const Elem *>> & | nodes_to_elem | ) |
Transforms node numbers to element pointers.
Definition at line 503 of file tree_node.C.
References mesh, and libMesh::MeshBase::n_nodes().
|
private |
The Cartesian bounding box for the node.
Definition at line 223 of file tree_node.h.
|
private |
Pointers to our children.
This vector is empty if the node is active.
Definition at line 218 of file tree_node.h.
Referenced by libMesh::TreeNode< N >::active(), and libMesh::TreeNode< N >::TreeNode().
|
private |
Does this node contain any infinite elements.
Definition at line 253 of file tree_node.h.
|
private |
Pointers to the elements in this tree node.
Definition at line 228 of file tree_node.h.
Referenced by libMesh::TreeNode< N >::TreeNode().
|
private |
Reference to the mesh.
Definition at line 207 of file tree_node.h.
|
private |
The node numbers contained in this portion of the tree.
Definition at line 233 of file tree_node.h.
Referenced by libMesh::TreeNode< N >::TreeNode().
|
private |
Pointer to this node's parent.
Definition at line 212 of file tree_node.h.
Referenced by libMesh::TreeNode< N >::is_root().
|
private |
This specifies the refinement level beyond which we will scale up the target bin size in child TreeNodes.
We set the default to be 10, which should be large enough such that in most cases the target bin size does not need to be increased.
Definition at line 248 of file tree_node.h.
|
private |
The maximum number of things we should store before refining ourself.
Definition at line 239 of file tree_node.h.
Referenced by libMesh::TreeNode< N >::TreeNode().