27#ifndef OOMPH_TREE_HEADER
28#define OOMPH_TREE_HEADER
32#include <oomph-lib-config.h>
48 class RefineableElement;
154 template<
class ELEMENT>
160 template<
class ELEMENT>
269 throw OomphLibError(
"Don't call an empty constructor for a Tree object",
386 for (std::map<int, TreeRoot*>::iterator
it =
Neighbour_pt.begin();
420 "Don't call an empty constructor for a TreeForest object",
Information for documentation of results: Directory and file number to enable output in the form RESL...
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
An OomphLibError object which should be thrown when an run-time error is encountered....
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
A TreeForest consists of a collection of TreeRoots. Each member tree can have neighbours in various e...
void operator=(const TreeForest &)=delete
Broken assignment operator.
virtual void check_all_neighbours(DocInfo &doc_info)=0
Document/check the neighbours of all the nodes in the forest. This must be overloaded for different t...
TreeForest(const TreeForest &dummy)=delete
Broken copy constructor.
void flush_trees()
Flush trees from forest.
void stick_all_tree_nodes_into_vector(Vector< Tree * > &all_forest_nodes)
Traverse forest and stick pointers to all "nodes" into Vector.
virtual void open_hanging_node_files(DocInfo &doc_info, Vector< std::ofstream * > &output_stream)=0
Open output files that will store any hanging nodes in the forest. Return a vector of the output stre...
unsigned ntree()
Number of trees in forest.
void stick_leaves_into_vector(Vector< Tree * > &forest_nodes)
Traverse forst and stick pointers to leaf "nodes" into Vector.
Vector< TreeRoot * > Trees_pt
Vector containing the pointers to the trees.
TreeRoot * tree_pt(const unsigned &i) const
Return pointer to i-th tree in forest.
virtual ~TreeForest()
Destructor: Delete the constituent trees (and thus the objects associated with its non-leaf nodes!...
TreeForest()
Default constructor (empty and broken)
void close_hanging_node_files(DocInfo &doc_info, Vector< std::ofstream * > &output_stream)
Close output files that will store any hanging nodes in the forest and delete any associated storage....
TreeRoot is a Tree that forms the root of a (recursive) tree. The "root node" is special as it holds ...
std::map< int, bool > Neighbour_periodic
Map of booleans used for periodic boundaries: Neighbour_periodic_direction[directon] returns true if ...
void operator=(const TreeRoot &)=delete
Broken assignment operator.
bool is_neighbour_periodic(const int &direction)
Return whether the neighbour in the particular direction is periodic.
TreeRoot(const TreeRoot &dummy)=delete
Broken copy constructor.
unsigned nneighbour()
Return the number of neighbours.
std::map< int, TreeRoot * > Neighbour_pt
Map of pointers to the neighbouring TreeRoots: Neighbour_pt[direction] returns the pointer to the Tre...
TreeRoot(RefineableElement *const &object_pt)
Constructor for the (empty) root tree.
void set_neighbour_nonperiodic(const int &direction)
Set the neighbour in particular direction to be nonperiodic.
void set_neighbour_periodic(const int &direction)
Set the neighbour in particular direction to be periodic.
TreeRoot *& neighbour_pt(const int &direction)
Return the pointer to the neighbouring TreeRoots in specified direction. Returns NULL if there's no n...
A generalised tree base class that abstracts the common functionality between the quad- and octrees u...
Tree * Father_pt
Pointer to the Father of the Tree.
void traverse_leaves(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function member_function() only at its leaves.
void stick_all_tree_nodes_into_vector(Vector< Tree * > &)
Traverse and stick pointers to all "nodes" into Vector.
unsigned nsons() const
Return number of sons (zero if it's a leaf node)
TreeRoot *& root_pt()
Return pointer to root of the tree.
void flush_sons()
Flush the sons.
void traverse_all(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function member_function() at all its "nodes".
void(Tree::* VoidMeshPtArgumentMemberFctPt)(Mesh *&mesh_pt)
Function pointer to a void Tree member function that takes a pointer to a mesh as its argument.
Tree(const Tree &dummy)=delete
Broken copy constructor.
TreeRoot * Root_pt
Pointer to the root of the tree.
RefineableElement * Object_pt
Pointer to the object represented by the tree.
void p_refine_if_required(Mesh *&mesh_pt)
If required, p-refine the leaf – criterion: bool object_pt()-> to_be_p_refined() = true or bool objec...
void(Tree::* VoidMemberFctPt)()
Function pointer to argument-free void Tree member function.
void operator=(const Tree &)=delete
Broken assignment operator.
bool is_leaf()
Return true if the tree is a leaf node.
int son_type() const
Return son type.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
int Son_type
Son type (e.g. SW/SE/NW/NE in a quadtree)
static double & max_neighbour_finding_tolerance()
Max. allowed discrepancy in neighbour finding routine (distance between points when identified from t...
void flush_object()
Flush the object represented by the tree.
void split_if_required()
If required, split the leaf and create its sons – criterion: bool object_pt()-> to_be_refined() = tru...
Tree * son_pt(const int &son_index) const
Return pointer to the son for a given index. Note that to aid code readability specific enums have be...
int Level
Level of the Tree (level 0 = root)
static const int OMEGA
Default value for an unassigned neighbour.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
TreeRoot * root_pt() const
Return pointer to root of the tree (const version)
unsigned level() const
Return the level of the Tree (root=0)
void set_son_pt(const Vector< Tree * > &son_pt)
Set vector of pointers to sons, indexed by the appropriate enum that identies son types....
void set_father_pt(Tree *const &father_pt)
Set the father.
Vector< Tree * > Son_pt
Vector of pointers to the sons of the Tree.
virtual Tree * construct_son(RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)=0
A function that constructs a specific type of tree. This MUST be overloaded for each specific tree ty...
void stick_leaves_into_vector(Vector< Tree * > &)
Traverse tree and stick pointers to leaf "nodes" (only) into Vector.
virtual ~Tree()
Destructor. Note: Deleting a tree also deletes the objects associated with its non-leave nodes.
Tree()
Default constructor (empty and broken)
void deactivate_object()
Call the RefineableElement's deactivate_element() function.
void traverse_all_but_leaves(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function member_function() at all its "nodes" aparat f...
static double Max_neighbour_finding_tolerance
Max. allowed discrepancy in neighbour finding routine (distance between points when identified from t...
void merge_sons_if_required(Mesh *&mesh_pt)
If required, merge the four sons for unrefinement – criterion: bool object_pt()-> sons_to_be_unrefine...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).