![]() |
|
#include <quadtree.h>
Public Member Functions | |
virtual | ~QuadTree () |
QuadTree (const QuadTree &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const QuadTree &)=delete |
Broken assignment operator. More... | |
Tree * | construct_son (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type) |
QuadTree * | gteq_edge_neighbour (const int &direction, Vector< unsigned > &translate_s, Vector< double > &s_lo, Vector< double > &s_hi, int &edge, int &diff_level, bool &in_neighbouring_tree) const |
void | stick_neighbouring_leaves_into_vector (Vector< const QuadTree * > &tree_neighbouring_nodes, Vector< Vector< double >> &tree_neighbouring_s_lo, Vector< Vector< double >> &tree_neighbouring_s_hi, Vector< int > &tree_neighbouring_diff_level, const QuadTree *my_neigh_pt, const int &direction) const |
unsigned | self_test () |
![]() | |
virtual | ~Tree () |
Tree (const Tree &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const Tree &)=delete |
Broken assignment operator. More... | |
RefineableElement * | object_pt () const |
void | flush_object () |
Flush the object represented by the tree. More... | |
Tree * | son_pt (const int &son_index) const |
void | set_son_pt (const Vector< Tree * > &son_pt) |
unsigned | nsons () const |
Return number of sons (zero if it's a leaf node) More... | |
void | flush_sons () |
Flush the sons. More... | |
TreeRoot *& | root_pt () |
Return pointer to root of the tree. More... | |
TreeRoot * | root_pt () const |
Return pointer to root of the tree (const version) More... | |
template<class ELEMENT > | |
void | split_if_required () |
template<class ELEMENT > | |
void | p_refine_if_required (Mesh *&mesh_pt) |
void | merge_sons_if_required (Mesh *&mesh_pt) |
void | deactivate_object () |
Call the RefineableElement's deactivate_element() function. More... | |
void | traverse_all (Tree::VoidMemberFctPt member_function) |
void | traverse_all (Tree::VoidMeshPtArgumentMemberFctPt member_function, Mesh *&mesh_pt) |
void | traverse_all_but_leaves (Tree::VoidMemberFctPt member_function) |
void | traverse_leaves (Tree::VoidMemberFctPt member_function) |
void | traverse_leaves (Tree::VoidMeshPtArgumentMemberFctPt member_function, Mesh *&mesh_pt) |
void | stick_leaves_into_vector (Vector< Tree * > &) |
Traverse tree and stick pointers to leaf "nodes" (only) into Vector. More... | |
void | stick_all_tree_nodes_into_vector (Vector< Tree * > &) |
Traverse and stick pointers to all "nodes" into Vector. More... | |
int | son_type () const |
Return son type. More... | |
bool | is_leaf () |
Return true if the tree is a leaf node. More... | |
Tree * | father_pt () const |
Return pointer to father: NULL if it's a root node. More... | |
void | set_father_pt (Tree *const &father_pt) |
Set the father. More... | |
unsigned | level () const |
Return the level of the Tree (root=0) More... | |
Static Public Member Functions | |
static void | setup_static_data () |
Setup the static data, rotation and reflection schemes, etc. More... | |
static void | doc_neighbours (Vector< Tree * > forest_nodes_pt, std::ofstream &neighbours_file, std::ofstream &neighbours_txt_file, double &max_error) |
![]() | |
static double & | max_neighbour_finding_tolerance () |
Static Public Attributes | |
static Vector< std::string > | Direct_string |
Translate (enumerated) directions into strings. More... | |
![]() | |
static const int | OMEGA = 26 |
Default value for an unassigned neighbour. More... | |
Protected Member Functions | |
QuadTree () | |
Default constructor (empty and broken) More... | |
QuadTree (RefineableElement *const &object_pt) | |
QuadTree (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type) | |
![]() | |
Tree () | |
Default constructor (empty and broken) More... | |
Tree (RefineableElement *const &object_pt) | |
Tree (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type) | |
Static Protected Attributes | |
static bool | Static_data_has_been_setup = false |
Bool indicating that static member data has been setup. More... | |
![]() | |
static double | Max_neighbour_finding_tolerance = 1.0e-14 |
Private Member Functions | |
QuadTree * | gteq_edge_neighbour (const int &direction, double &s_diff, int &diff_level, bool &in_neighbouring_tree, int max_level, QuadTreeRoot *const &orig_root_pt) const |
Static Private Attributes | |
static Vector< std::string > | Colour |
Colours for neighbours in various directions. More... | |
static DenseMatrix< double > | S_base |
static DenseMatrix< double > | S_step |
static Vector< int > | Reflect_edge |
Get opposite edge, e.g. Reflect_edge[N]=S. More... | |
static DenseMatrix< bool > | Is_adjacent |
static DenseMatrix< int > | Reflect |
static DenseMatrix< int > | Rotate |
static DenseMatrix< int > | Rotate_angle |
static DenseMatrix< int > | S_direct |
Additional Inherited Members | |
![]() | |
typedef void(Tree::* | VoidMemberFctPt) () |
Function pointer to argument-free void Tree member function. More... | |
typedef void(Tree::* | VoidMeshPtArgumentMemberFctPt) (Mesh *&mesh_pt) |
![]() | |
TreeRoot * | Root_pt |
Pointer to the root of the tree. More... | |
Tree * | Father_pt |
Pointer to the Father of the Tree. More... | |
Vector< Tree * > | Son_pt |
Vector of pointers to the sons of the Tree. More... | |
int | Level |
Level of the Tree (level 0 = root) More... | |
int | Son_type |
Son type (e.g. SW/SE/NW/NE in a quadtree) More... | |
RefineableElement * | Object_pt |
Pointer to the object represented by the tree. More... | |
QuadTree class: Recursively defined, generalised quadtree.
A QuadTree has:
The tree can also be part of a forest. If that is the case, the root will have pointers to the roots of neighbouring quadtrees.
The objects contained in the quadtree are assumed to be (topologically) rectangular elements whose geometry is parametrised by local coordinates \( {\bf s} \in [-1,1]^2 \).
The tree can be traversed and actions performed at all its "nodes" or only at the leaf "nodes" ("nodes" without sons).
Finally, the leaf "nodes" can be split depending on a criteria defined by the object.
Note that QuadTrees are only generated by splitting existing QuadTrees. Therefore, the constructors are protected. The only QuadTree that "Joe User" can create is the (derived) class QuadTreeRoot.
|
inlinevirtual |
|
delete |
Broken copy constructor.
|
inlineprotected |
Default constructor (empty and broken)
References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by construct_son().
|
inlineprotected |
Default constructor for empty (root) tree: no father, no sons; just pass a pointer to its object Protected because QuadTrees can only be created internally, during the split operation. Only QuadTreeRoots can be created externally.
|
inlineprotected |
Constructor for tree that has a father: Pass it the pointer to its object, the pointer to its father and tell it what type of son (SE/SW/NE/NW) it is. Protected because QuadTrees can only be created internally, during the split operation. Only QuadTreeRoots can be created externally.
|
inlinevirtual |
Overload the function construct_son to ensure that the son is a specific QuadTree and not a general Tree.
Implements oomph::Tree.
References oomph::Tree::father_pt(), oomph::Tree::object_pt(), QuadTree(), and oomph::Tree::son_type().
|
static |
Doc/check all neighbours of quadtree (nodes) contained in the Vector forest_node_pt. Output into neighbours_file which can be viewed from tecplot with QuadTreeNeighbours.mcr Neighbour info and errors are displayed on neighbours_txt_file. Finally, compute the max. error between vertices when viewed from neighhbouring element. If the two filestreams are closed, output is suppressed.
Doc/check all neighbours of quadtree ("nodes") contained in the Vector forest_node_pt. Output into neighbours_file which can be viewed from tecplot with QuadTreeNeighbours.mcr Neighbour info and errors are displayed on neighbours_txt_file. Finally, compute the max. error between vertices when viewed from neighhbouring element. Output is suppressed if the output streams are closed.
References calibrate::error, boost::multiprecision::fabs(), oomph::FiniteElement::get_x(), gteq_edge_neighbour(), i, oomph::TreeRoot::is_neighbour_periodic(), MeshRefinement::max_error, N, oomph::RefineableElement::nodes_built(), oomph::RefineableElement::number(), oomph::Tree::object_pt(), oomph::BinaryTreeNames::OMEGA, Eigen::bfloat16_impl::pow(), oomph::Tree::root_pt(), s, sqrt(), oomph::QuadTreeNames::W, and plotDoE::x.
Referenced by oomph::QuadTreeForest::check_all_neighbours(), self_test(), and oomph::QuadTreeForest::self_test().
|
private |
Find greater or equal-sized edge neighbour in direction. Auxiliary internal routine which passes additional information around.
Find ‘greater-or-equal-sized edge neighbour’ in given direction (N/E/S/W).
This is an auxiliary routine which allows neighbour finding in adjacent quadtrees. Needs to keep track of previous son types and the maximum level to which search is performed.
Parameters:
References Global_Physical_Variables::E, oomph::Tree::Father_pt, gteq_edge_neighbour(), Is_adjacent, oomph::Tree::Level, N, oomph::TreeRoot::neighbour_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Eigen::bfloat16_impl::pow(), Reflect, oomph::Tree::Root_pt, Rotate, oomph::QuadTreeNames::S, S_direct, oomph::Tree::Son_pt, oomph::Tree::Son_type, and oomph::QuadTreeNames::W.
QuadTree * oomph::QuadTree::gteq_edge_neighbour | ( | const int & | direction, |
Vector< unsigned > & | translate_s, | ||
Vector< double > & | s_lo, | ||
Vector< double > & | s_hi, | ||
int & | edge, | ||
int & | diff_level, | ||
bool & | in_neighbouring_tree | ||
) | const |
Return pointer to greater or equal-sized edge neighbour in specified direction
; also provide info regarding the relative size and orientation of neighbour:
s_lo
[0], s_lo
[1]) in the neighbouring quadtree.s_hi
[0], s_hi
[1]) in the neighbouring quadtree.direction
. When viewed from the neighbouring quadtree, the edge that separates the present quadtree from its neighbour is the neighbour's edge
edge. If there's no rotation between the two quadtrees, this is a simple reflection: For instance, if we're looking for a neighhbour in the N
[orthern] direction
, edge
will be S
[outh]diff_level
<= 0 indicates the difference in refinement levels between the two neighbours. If diff_level==0
, the neighbour has the same size as the current quadtree.in_neighbouring_tree
indicates whether the neighbour is actually in another tree in the forest. The introduction of this flag was necessitated by periodic problems where a TreeRoot can be its own neighbour.Return pointer to greater or equal-sized edge neighbour in specified direction
; also provide info regarding the relative size and orientation of neighbour:
s_lo
[0], s_lo
[1]) in the neighbouring quadtree.s_hi
[0], s_hi
[1]) in the neighbouring quadtree.direction
. When viewed from the neighbouring quadtree, the edge that separates the present quadtree from its neighbour is the neighbour's edge
edge. If there's no rotation between the two quadtrees, this is a simple reflection: For instance, if we're looking for a neighhbour in the N
[orthern] direction
, edge
will be S
[outh]diff_level
<= 0 indicates the difference in refinement levels between the two neighbours. If diff_level==0
, the neighbour has the same size as the current quadtree.in_neighbouring_tree
returns true is we have had to flip to a different root, even if that root is actually the same as it can be in periodic problems. References Global_Physical_Variables::E, oomph::Tree::Level, N, oomph::QuadTreeRoot::north_equivalent(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Eigen::bfloat16_impl::pow(), Reflect_edge, oomph::Tree::root_pt(), oomph::Tree::Root_pt, Rotate, Rotate_angle, oomph::QuadTreeNames::S, S_base, S_step, swap(), and oomph::QuadTreeNames::W.
Referenced by oomph::PRefineableQElement< 2, INITIAL_NNODE_1D >::check_integrity(), oomph::RefineableQElement< 2 >::check_integrity(), doc_neighbours(), gteq_edge_neighbour(), oomph::PRefineableQElement< 2, INITIAL_NNODE_1D >::node_created_by_neighbour(), oomph::RefineableQElement< 2 >::node_created_by_neighbour(), oomph::PRefineableQElement< 2, INITIAL_NNODE_1D >::node_created_by_son_of_neighbour(), oomph::PRefineableQElement< 2, INITIAL_NNODE_1D >::quad_hang_helper(), oomph::RefineableQElement< 2 >::quad_hang_helper(), and stick_neighbouring_leaves_into_vector().
|
delete |
Broken assignment operator.
unsigned oomph::QuadTree::self_test | ( | ) |
Self-test: Check all neighbours. Return success (0) if the max. distance between corresponding points in the neighbours is less than the tolerance specified in the static value QuadTree::Max_neighbour_finding_tolerance.
Self-test: Check neighbour finding routine. For each element in the tree and for each vertex, determine the distance between the vertex and its position in the neigbour. If the difference is less than Tree::Max_neighbour_finding_tolerance. return success (0), otherwise failure (1)
References doc_neighbours(), i, MeshRefinement::max_error, oomph::Tree::Max_neighbour_finding_tolerance, oomph::oomph_info, and oomph::Tree::stick_all_tree_nodes_into_vector().
|
static |
Setup the static data, rotation and reflection schemes, etc.
Setup the static data stored in the QuadTree – this needs to be called before QuadTrees can be used. Automatically called by RefineableQuadMesh constructor.
References Colour, Direct_string, Global_Physical_Variables::E, Is_adjacent, N, oomph::QuadTreeNames::NE, oomph::QuadTreeNames::NW, oomph::Tree::OMEGA, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Reflect, Reflect_edge, oomph::DenseMatrix< T >::resize(), Rotate, Rotate_angle, oomph::QuadTreeNames::S, S_base, S_direct, S_step, oomph::QuadTreeNames::SE, Static_data_has_been_setup, oomph::QuadTreeNames::SW, and oomph::QuadTreeNames::W.
Referenced by oomph::RefineableQuadMesh< ELEMENT >::RefineableQuadMesh().
void oomph::QuadTree::stick_neighbouring_leaves_into_vector | ( | Vector< const QuadTree * > & | tree_neighbouring_nodes, |
Vector< Vector< double >> & | tree_neighbouring_s_lo, | ||
Vector< Vector< double >> & | tree_neighbouring_s_hi, | ||
Vector< int > & | tree_neighbouring_diff_level, | ||
const QuadTree * | my_neigh_pt, | ||
const int & | direction | ||
) | const |
Traverse Tree: Preorder traverse and stick pointers to neighbouring leaf nodes (only) into Vector
References gteq_edge_neighbour(), i, and oomph::Tree::Son_pt.
|
staticprivate |
Colours for neighbours in various directions.
Colours for neighbours in various directions (static data)
Referenced by setup_static_data().
|
static |
Translate (enumerated) directions into strings.
Translate (enumerated) directions into strings (static data)
Referenced by oomph::QuadTreeRoot::north_equivalent(), and setup_static_data().
|
staticprivate |
Array of direction/quadrant adjacency scheme: Is_adjacent(i_vertex_or_edge,j_quadrant): Is edge/vertex adjacent to quadrant?
Array of direction/quadrant adjacency scheme: Is_adjacent(i_vertex_or_edge,j_quadrant): Is edge/vertex adjacent to quadrant? (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
Reflection scheme: Reflect(direction,quadrant): Get mirror of quadrant in specified direction. E.g. Reflect(S,NE)=SE
Reflection scheme: Reflect(direction,quadrant): Get mirror of quadrant in specified direction. E.g. Reflect(S,NE)=SE (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
Get opposite edge, e.g. Reflect_edge[N]=S.
Get opposite edge, e.g. Reflect_edge[N]=S (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
Rotate coordinates: If North becomes NorthIs then direction becomes Rotate(NorthIs,direction). E.g. Rotate(E,NW)=NE;
Rotate coordinates: If north becomes NorthIs then direction becomes Rotate(NorthIs,direction). E.g. Rotate(E,NW)=NE; (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
Angle betwen rotated coordinates: If old_direction becomes new_direction then the angle between the axes (in anti-clockwise direction is Rotate_angle(old_direction,new_direction); E.g. Rotate_angle(E,N)=90;
Angle betwen rotated coordinates: If old_direction becomes new_direction then the angle between the axes (in anti-clockwise direction is Rotate_angle(old_direction,new_direction); E.g. Rotate_angle(E,N)=90; (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
S_base(i,direction): Initial value for coordinate s[i] on the edge indicated by direction (S/E/N/W)
S_base(i,direction): Initial value for coordinate s[i] on the edge indicated by direction (S/E/N/W) (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
S_direct(direction,son_quadrant): The lower left corner of son_quadrant has an offset of h/2 S_direct(direction,son_quadrant) in the specified direction. E.g. S_direct(S,NE)=1 and S_direct(S,NW)=0
S_direct(direction,son_quadrant): The lower left corner of son_quadrant has an offset of h/2 S_direct(direction,son_quadrant) in the specified direction. E.g. S_direct(S,NE)=1 and S_direct(S,NW)=0 (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprivate |
S_step(i,direction) Increments for coordinate s[i] when progressing along the edge indicated by direction (S/E/N/W); Left/lower vertex: S_base; Right/upper vertex: S_base + S_step
S_step(i,direction) Increments for coordinate s[i] when progressing along the edge indicated by direction (S/E/N/W); Left/lower vertex: S_base; Right/upper vertex: S_base + S_step (static data)
Referenced by gteq_edge_neighbour(), and setup_static_data().
|
staticprotected |
Bool indicating that static member data has been setup.
Referenced by oomph::QuadTreeRoot::QuadTreeRoot(), and setup_static_data().