31 #include <oomph-lib-config.h>
93 Tree*
const& father_pt,
95 : Object_pt(object_pt)
126 for (
unsigned i = 0;
i <
nsons;
i++)
149 (this->*member_function)();
152 unsigned numsons =
Son_pt.size();
153 for (
unsigned i = 0;
i < numsons;
i++)
155 Son_pt[
i]->traverse_all(member_function);
169 (this->*member_function)(mesh_pt);
172 unsigned numsons =
Son_pt.size();
173 for (
unsigned i = 0;
i < numsons;
i++)
175 Son_pt[
i]->traverse_all(member_function, mesh_pt);
187 unsigned n_sons =
Son_pt.size();
192 (this->*member_function)();
194 for (
unsigned i = 0;
i < n_sons;
i++)
196 Son_pt[
i]->traverse_all_but_leaves(member_function);
210 unsigned numsons =
Son_pt.size();
214 for (
unsigned i = 0;
i < numsons;
i++)
216 Son_pt[
i]->traverse_leaves(member_function);
222 (this->*member_function)();
235 unsigned numsons =
Son_pt.size();
239 for (
unsigned i = 0;
i < numsons;
i++)
241 Son_pt[
i]->traverse_leaves(member_function, mesh_pt);
247 (this->*member_function)(mesh_pt);
258 unsigned numsons =
Son_pt.size();
262 for (
unsigned i = 0;
i < numsons;
i++)
264 Son_pt[
i]->stick_leaves_into_vector(tree_nodes);
269 tree_nodes.push_back(
this);
279 all_tree_nodes.push_back(
this);
282 unsigned numsons =
Son_pt.size();
286 for (
unsigned i = 0;
i < numsons;
i++)
288 Son_pt[
i]->stick_all_tree_nodes_into_vector(all_tree_nodes);
311 unsigned n_sons =
nsons();
313 for (
unsigned ison = 0; ison < n_sons; ison++)
366 long int numtrees =
Trees_pt.size();
367 for (
long int i = 0;
i < numtrees;
i++)
381 unsigned numtrees =
ntree();
382 for (
unsigned itree = 0; itree < numtrees; itree++)
388 for (
unsigned i = 0;
i < numsons;
i++)
395 forest_nodes.push_back(
tree_pt(itree));
408 unsigned numtrees =
ntree();
409 for (
unsigned itree = 0; itree < numtrees; itree++)
411 all_forest_nodes.push_back(
tree_pt(itree));
418 for (
unsigned i = 0;
i < numsons;
i++)
436 unsigned n_file = output_stream.size();
440 for (
unsigned n = 0; n < n_file; n++)
442 output_stream[n]->close();
447 for (
unsigned n = n_file; n > 0; n--)
449 delete output_stream[n - 1];
450 output_stream[n - 1] = 0;
454 output_stream.clear();
Information for documentation of results: Directory and file number to enable output in the form RESL...
bool is_doc_enabled() const
Are we documenting?
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
virtual void rebuild_from_sons(Mesh *&mesh_pt)=0
Rebuild the element, e.g. set internal values in line with those of the sons that have now merged.
virtual void unbuild()
Unbuild the element, i.e. mark the nodes that were created during its creation for possible deletion.
virtual void deactivate_element()
Final operations that must be performed when the element is no longer active in the mesh,...
void set_tree_pt(Tree *my_tree_pt)
Set pointer to quadtree representation of this element.
bool sons_to_be_unrefined()
Has the element been selected for unrefinement?
void deselect_sons_for_unrefinement()
No unrefinement will be performed by merging the four sons of this element.
void stick_all_tree_nodes_into_vector(Vector< Tree * > &all_forest_nodes)
Traverse forest and stick pointers to all "nodes" into Vector.
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....
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.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
unsigned nsons() const
Return number of sons (zero if it's a leaf node)
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 * father_pt() const
Return pointer to father: NULL if it's a root node.
TreeRoot * Root_pt
Pointer to the root of the tree.
RefineableElement * Object_pt
Pointer to the object represented by the tree.
void(Tree::* VoidMemberFctPt)()
Function pointer to argument-free void Tree member function.
int son_type() const
Return son type.
int Son_type
Son type (e.g. SW/SE/NW/NE in a quadtree)
int Level
Level of the Tree (level 0 = root)
static const int OMEGA
Default value for an unassigned neighbour.
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...
Vector< Tree * > Son_pt
Vector of pointers to the sons of the Tree.
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...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...