31 #ifndef OOMPH_TREE_HEADER 32 #define OOMPH_TREE_HEADER 36 #include <oomph-lib-config.h> 54 class RefineableElement;
117 if(
Son_pt.size()==0) {
return 0;}
119 else {
return Son_pt[son_index];}
150 template<
class ELEMENT>
156 template<
class ELEMENT>
215 if (
Son_pt.size()==0) {
return true;}
249 throw OomphLibError(
"Don't call an empty constructor for a Tree object",
250 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
267 Tree*
const &father_pt,
const int& son_type);
346 {
return Neighbour_pt[direction];}
351 {
return Neighbour_periodic[direction];}
355 {Neighbour_periodic[direction] =
true;}
359 {Neighbour_periodic[direction] =
false;}
366 for(std::map<int,TreeRoot*>::iterator it=Neighbour_pt.begin();
367 it!=Neighbour_pt.end();it++)
369 if(Neighbour_pt[it->first]!=0) {count++;}
398 "Don't call an empty constructor for a TreeForest object",
399 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
427 virtual void check_all_neighbours(
DocInfo &doc_info)=0;
434 virtual void open_hanging_node_files(
DocInfo &doc_info,
441 void close_hanging_node_files(
DocInfo &doc_info,
446 unsigned ntree() {
return Trees_pt.size();}
Vector< Tree * > Son_pt
Vector of pointers to the sons of the Tree.
unsigned nsons() const
Return number of sons (zero if it's a leaf node)
void(Tree::* VoidMemberFctPt)()
Function pointer to argument-free void Tree member function.
RefineableElement * Object_pt
Pointer to the object represented by the tree.
Vector< TreeRoot * > Trees_pt
Vector containing the pointers to the trees.
static double & max_neighbour_finding_tolerance()
Max. allowed discrepancy in neighbour finding routine (distance between points when identified from t...
unsigned ntree()
Number of trees in forest.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
TreeRoot(RefineableElement *const &object_pt)
Constructor for the (empty) root tree.
TreeRoot *& neighbour_pt(const int &direction)
Return the pointer to the neighbouring TreeRoots in specified direction. Returns NULL if there's no n...
virtual ~Tree()
Destructor. Note: Deleting a tree also deletes the objects associated with its non-leave nodes...
void deactivate_object()
Call the RefineableElement's deactivate_element() function.
TreeRoot * tree_pt(const unsigned &i) const
Return pointer to i-th tree in forest.
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...
Information for documentation of results: Directory and file number to enable output in the form RESL...
TreeRoot * root_pt() const
Return pointer to root of the tree (const version)
void flush_sons()
Flush the sons.
TreeForest()
Default constructor (empty and broken)
void flush_trees()
Flush trees from forest.
bool is_neighbour_periodic(const int &direction)
Return whether the neighbour in the particular direction is periodic.
static double Max_neighbour_finding_tolerance
Max. allowed discrepancy in neighbour finding routine (distance between points when identified from t...
void operator=(const TreeRoot &)
Broken assignment operator.
TreeRoot * Root_pt
Pointer to the root of the tree.
void merge_sons_if_required(Mesh *&mesh_pt)
If required, merge the four sons for unrefinement – criterion: bool object_pt()-> sons_to_be_unrefin...
void set_father_pt(Tree *const &father_pt)
Set the father.
void traverse_all_but_leaves(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function.
void(Tree::* VoidMeshPtArgumentMemberFctPt)(Mesh *&mesh_pt)
TreeRoot(const TreeRoot &dummy)
Broken copy constructor.
int Level
Level of the Tree (level 0 = root)
void traverse_leaves(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function member_function() only at its leaves...
void set_neighbour_periodic(const int &direction)
Set the neighbour in particular direction to be periodic.
unsigned nneighbour()
Return the number of neighbours.
Tree(const Tree &dummy)
Broken copy constructor.
void set_neighbour_nonperiodic(const int &direction)
Set the neighbour in particular direction to be nonperiodic.
unsigned level() const
Return the level of the Tree (root=0)
std::map< int, TreeRoot * > Neighbour_pt
Map of pointers to the neighbouring TreeRoots: Neighbour_pt[direction] returns the pointer to the Tre...
Tree * Father_pt
Pointer to the Father of the Tree.
static const int OMEGA
Default value for an unassigned neighbour.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
void operator=(const Tree &)
Broken assignment operator.
void stick_all_tree_nodes_into_vector(Vector< Tree * > &)
Traverse and stick pointers to all "nodes" into Vector.
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 traverse_all(Tree::VoidMemberFctPt member_function)
Traverse the tree and execute void Tree member function member_function() at all its "nodes"...
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...
void operator=(const TreeForest &)
Broken assignment operator.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
TreeForest(const TreeForest &dummy)
Broken copy constructor.
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 obje...
int son_type() const
Return son type.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
void stick_leaves_into_vector(Vector< Tree * > &)
Traverse tree and stick pointers to leaf "nodes" (only) into Vector.
bool is_leaf()
Return true if the tree is a leaf node.
Tree()
Default constructor (empty and broken)
void split_if_required()
If required, split the leaf and create its sons – criterion: bool object_pt()-> to_be_refined() = tr...
std::map< int, bool > Neighbour_periodic
Map of booleans used for periodic boundaries: Neighbour_periodic_direction[directon] returns true if ...
int Son_type
Son type (e.g. SW/SE/NW/NE in a quadtree)
TreeRoot *& root_pt()
Return pointer to root of the tree.
void flush_object()
Flush the object represented by the tree.