Public Member Functions | Private Attributes | List of all members
oomph::OcTreeRoot Class Reference

#include <octree.h>

+ Inheritance diagram for oomph::OcTreeRoot:

Public Member Functions

 OcTreeRoot (RefineableElement *const &object_pt)
 Constructor for the root octree: Pass pointer to the RefineableQElement<3> that is represented by the OcTree. More...
 
 OcTreeRoot (const OcTreeRoot &dummy)
 Broken copy constructor. More...
 
void operator= (const OcTreeRoot &)
 Broken assignment operator. More...
 
Vector< TreeRoot * > edge_neighbour_pt (const unsigned &edge_direction)
 Return vector of pointers to the edge-neighbouring TreeRoots in the (enumerated) (edge) direction. More...
 
unsigned nedge_neighbour (const unsigned &edge_direction)
 Return number of edge-neighbouring OcTreeRoot in the (enumerated) (edge) direction. More...
 
void add_edge_neighbour_pt (TreeRoot *oc_tree_root_pt, const unsigned &edge_direction)
 Add pointer to the edge-neighbouring [Oc]TreeRoot in the (enumerated) (edge) direction – maintains uniqueness. More...
 
int up_equivalent (TreeRoot *tree_root_pt)
 Return up equivalent of the neighbours specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree (around the back-front axis) say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc. Returns OMEGA if the Octree specified by the pointer argument is not a neighbour. More...
 
void set_up_equivalent (TreeRoot *tree_root_pt, const int &dir)
 Set up equivalent of the neighbours specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree (around the back-front axis) say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc. More...
 
int right_equivalent (TreeRoot *tree_root_pt)
 The same thing as up_equivalent, but for the right direction: When viewed from the current octree neighbour, our right direction is the neighbour's Right_equivalent[neighbour_pt] direction. Returns OMEGA if the Octree specified by the pointer argument is not a neighbour. More...
 
void set_right_equivalent (TreeRoot *tree_root_pt, const int &dir)
 The same thing as up_equivalent, but for the right direction: When viewed from the current octree neighbour, our right direction is the neighbour's Right_equivalent[neighbour_pt] direction. More...
 
int direction_of_neighbour (TreeRoot *octree_root_pt)
 If octree_root_pt is a neighbour, return the direction [faces L/R/F/B/U/D or edges DB/UP/...] in which it is found, otherwise return OMEGA. More...
 
- Public Member Functions inherited from oomph::OcTree
virtual ~OcTree ()
 Destructor. Note: Deleting a octree also deletes the objects associated with all non-leaf nodes! More...
 
 OcTree (const OcTree &dummy)
 Broken copy constructor. More...
 
void operator= (const OcTree &)
 Broken assignment operator. More...
 
Treeconstruct_son (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
 Overload the function construct_son to ensure that the son is a specific OcTree and not a general Tree. More...
 
OcTreegteq_face_neighbour (const int &direction, Vector< unsigned > &translate_s, Vector< double > &s_sw, Vector< double > &s_ne, int &face, int &diff_level) const
 Find (pointer to) `greater-or-equal-sized face neighbour' in given direction (L/R/U/D/F/B). Another way of interpreting this is that we're looking for the neighbour across the present element's face 'direction'. The various arguments return additional information about the size and relative orientation of the neighbouring octree. To interpret these we use the following General convention: More...
 
OcTreegteq_true_edge_neighbour (const int &direction, const unsigned &i_root_edge_neighbour, unsigned &nroot_edge_neighbour, Vector< unsigned > &translate_s, Vector< double > &s_lo, Vector< double > &s_hi, int &edge, int &diff_level) const
 Find (pointer to) `greater-or-equal-sized true edge neighbour' in the given direction (LB,RB,DB,UB [the back edges], LD,RD,LU,RU [the side edges], LF,RF,DF,UF [the front edges]). More...
 
unsigned 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 Tree::Max_neighbour_finding_tolerance. More...
 
- Public Member Functions inherited from oomph::Tree
virtual ~Tree ()
 Destructor. Note: Deleting a tree also deletes the objects associated with its non-leave nodes. More...
 
 Tree (const Tree &dummy)
 Broken copy constructor. More...
 
void operator= (const Tree &)
 Broken assignment operator. More...
 
RefineableElementobject_pt () const
 Return the pointer to the object (RefineableElement) represented by the tree. More...
 
void flush_object ()
 Flush the object represented by the tree. More...
 
Treeson_pt (const int &son_index) const
 Return pointer to the son for a given index. Note that to aid code readability specific enums have been defined for specific trees. However, these are simply aliases for ints and the general interface can be implemented once, here. More...
 
void set_son_pt (const Vector< Tree * > &son_pt)
 Set vector of pointers to sons, indexed by the appropriate enum that identies son types. (To aid code readability specific enums have been defined for specific trees. However, these are simply aliases for ints and the general interface can be implemented once, here). More...
 
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...
 
TreeRootroot_pt () const
 Return pointer to root of the tree (const version) More...
 
template<class ELEMENT >
void split_if_required ()
 If required, split the leaf and create its sons – criterion: bool object_pt()-> to_be_refined() = true. More...
 
template<class ELEMENT >
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 object_pt()-> to_be_p_unrefined() = true. More...
 
void merge_sons_if_required (Mesh *&mesh_pt)
 If required, merge the four sons for unrefinement – criterion: bool object_pt()-> sons_to_be_unrefined() = true. More...
 
void deactivate_object ()
 Call the RefineableElement's deactivate_element() function. More...
 
void traverse_all (Tree::VoidMemberFctPt member_function)
 Traverse the tree and execute void Tree member function member_function() at all its "nodes". More...
 
void traverse_all (Tree::VoidMeshPtArgumentMemberFctPt member_function, Mesh *&mesh_pt)
 Traverse the tree and excute void Tree member function that takes a pointer to a mesh as an argument. More...
 
void traverse_all_but_leaves (Tree::VoidMemberFctPt member_function)
 Traverse the tree and execute void Tree member function. More...
 
void traverse_leaves (Tree::VoidMemberFctPt member_function)
 Traverse the tree and execute void Tree member function member_function() only at its leaves. More...
 
void traverse_leaves (Tree::VoidMeshPtArgumentMemberFctPt member_function, Mesh *&mesh_pt)
 Traverse the tree and execute void Tree member function that takes a pointer to a mesh as an argument only at its leaves. More...
 
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...
 
Treefather_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...
 
- Public Member Functions inherited from oomph::TreeRoot
 TreeRoot (RefineableElement *const &object_pt)
 Constructor for the (empty) root tree. More...
 
 TreeRoot (const TreeRoot &dummy)
 Broken copy constructor. More...
 
void operator= (const TreeRoot &)
 Broken assignment operator. More...
 
TreeRoot *& neighbour_pt (const int &direction)
 Return the pointer to the neighbouring TreeRoots in specified direction. Returns NULL if there's no neighbour in this direction. More...
 
bool is_neighbour_periodic (const int &direction)
 Return whether the neighbour in the particular direction is periodic. More...
 
void set_neighbour_periodic (const int &direction)
 Set the neighbour in particular direction to be periodic. More...
 
void set_neighbour_nonperiodic (const int &direction)
 Set the neighbour in particular direction to be nonperiodic. More...
 
unsigned nneighbour ()
 Return the number of neighbours. More...
 

Private Attributes

std::map< int, Vector
< TreeRoot * > > 
Edge_neighbour_pt
 Map of pointers to the edge-neighbouring [Oc]TreeRoots: Edge_neighbour_pt[direction] is Vector to the pointers to the [Oc]TreeRoot's edge neighbours in the (enumerated) (edge) direction. More...
 
std::map< TreeRoot *, int > Up_equivalent
 Map giving the Up equivalent of the neighbour specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree(around the back-front axis), say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc. More...
 
std::map< TreeRoot *, int > Right_equivalent
 Map giving the Right equivalent of the neighbour specified by pointer: When viewed from the current octree's neighbour, our right direction is the neighbour's right_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Right_equivalent[neighbour_pt]=R (read as: "in my neighbour, my Right is its Right"). More...
 

Additional Inherited Members

- Public Types inherited from oomph::Tree
typedef void(Tree::* VoidMemberFctPt )()
 Function pointer to argument-free void Tree member function. More...
 
typedef void(Tree::* VoidMeshPtArgumentMemberFctPt )(Mesh *&mesh_pt)
 
- Static Public Member Functions inherited from oomph::OcTree
static void setup_static_data ()
 Setup the static data, rotation and reflection schemes, etc. More...
 
static void doc_face_neighbours (Vector< Tree * > forest_nodes_pt, std::ofstream &neighbours_file, std::ofstream &neighbours_txt_file, double &max_error)
 Doc/check all face neighbours of octree (nodes) contained in the Vector forest_node_pt. Output into neighbours_file which can be viewed from tecplot with OcTreeNeighbours.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. More...
 
static void doc_true_edge_neighbours (Vector< Tree * > forest_nodes_pt, std::ofstream &neighbours_file, std::ofstream &no_true_edge_file, std::ofstream &neighbours_txt_file, double &max_error)
 Doc/check all true edge neighbours of octree (nodes) contained in the Vector forest_node_pt. Output into neighbours_file which can be viewed from tecplot with OcTreeNeighbours.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. More...
 
static int get_the_other_face (const unsigned &n1, const unsigned &n2, const unsigned &nnode1d, const int &face)
 If an edge is bordered by the nodes whose local numbers are n1 and n2 in an element with nnode1d nodes along each coordinate direction, then this edge is shared by two faces. This function takes one of these faces as the argument face and returns the other one. (face is a direction in the set U,D,F,B,L,R). More...
 
static unsigned vertex_to_node_number (const int &vertex, const unsigned &nnode1d)
 Return the local node number of given vertex [LDB,RDB,...] in an element with nnode1d nodes in each coordinate direction. More...
 
static int node_number_to_vertex (const unsigned &n, const unsigned &nnode1d)
 Return the vertex [LDB,RDB,...] of local (vertex) node n. More...
 
static Vector< int > rotate (const int &new_up, const int &new_right, const Vector< int > &dir)
 If U[p] becomes new_up and R[ight] becomes new_right then the direction vector dir becomes rotate(new_up, new_right, dir) More...
 
static int rotate (const int &new_up, const int &new_right, const int &dir)
 If U[p] becomes new_up and R[ight] becomes new_right then the direction dir becomes rotate(new_up, new_right, dir) More...
 
- Static Public Member Functions inherited from oomph::Tree
static double & max_neighbour_finding_tolerance ()
 Max. allowed discrepancy in neighbour finding routine (distance between points when identified from two neighbouring elements) More...
 
- Static Public Attributes inherited from oomph::OcTree
static Vector< std::string > Direct_string
 Translate (enumerated) directions into strings. More...
 
static Vector< int > Reflect_face
 Get opposite face, e.g. Reflect_face[L]=R. More...
 
static Vector< int > Reflect_edge
 Get opposite edge, e.g. Reflect_edge[DB]=UF. More...
 
static Vector< int > Reflect_vertex
 Get opposite vertex, e.g. Reflect_vertex[LDB]=RUF. More...
 
static Vector< Vector< int > > Vertex_at_end_of_edge
 Vector of vectors containing the two vertices for each edge, e.g. Vertex_at_end_of_edge[LU][0]=LUB and Vertex_at_end_of_edge[LU][1]=LUF. More...
 
static std::map< Vector< int >
, int > 
Vector_to_direction
 Each vector representing a direction can be translated into a direction, either a son type (vertex), a face or an edge. E.g. : Vector_to_direction[(1,-1,1)]=RDF, Vector_to_direction[(0,1,0)]=U. More...
 
static Vector< Vector< int > > Direction_to_vector
 For each direction, i.e. a son_type (vertex), a face or an edge, this defines a vector that indicates this direction. E.g : Direction_to_vector[RDB]=(1,-1,-1), Direction_to_vector[U]=(0,1,0) More...
 
static std::map< std::pair
< std::pair< int, int >
, std::pair< int, int >
>, std::pair< int, int > > 
Up_and_right_equivalent_for_pairs_of_vertices
 Storage for the up/right-equivalents corresponding to two pairs of vertices along an element edge: More...
 
- Static Public Attributes inherited from oomph::Tree
static const int OMEGA =26
 Default value for an unassigned neighbour. More...
 
- Protected Member Functions inherited from oomph::OcTree
 OcTree ()
 Default constructor (empty and broken) More...
 
 OcTree (RefineableElement *const &object_pt)
 Constructor for empty (root) tree: no father, no sons; just pass a pointer to its object (a RefineableQElement<3>). This is protected because OcTrees can only be created internally, during the split operation. Only OcTreeRoots can be created externally. More...
 
 OcTree (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
 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 (LDB,RDB,...) it is. Protected because OcTrees can only be created internally, during the split operation. Only OcTreeRoots can be created externally. More...
 
- Protected Member Functions inherited from oomph::Tree
 Tree ()
 Default constructor (empty and broken) More...
 
 Tree (RefineableElement *const &object_pt)
 Default constructor for empty (root) tree: no father, no sons; just pass a pointer to its object Protected because Trees can only be created internally, during the split operation. Only TreeRoots can be created externally. More...
 
 Tree (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
 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 it is. Protected because Trees can only be created internally, during the split operation. Only TreeRoots can be created externally. More...
 
- Protected Attributes inherited from oomph::Tree
TreeRootRoot_pt
 Pointer to the root of the tree. More...
 
TreeFather_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...
 
RefineableElementObject_pt
 Pointer to the object represented by the tree. More...
 
- Protected Attributes inherited from oomph::TreeRoot
std::map< int, TreeRoot * > Neighbour_pt
 Map of pointers to the neighbouring TreeRoots: Neighbour_pt[direction] returns the pointer to the TreeRoot's neighbour in the (enumerated) direction. Returns NULL if there's no neighbour in this direction. More...
 
std::map< int, bool > Neighbour_periodic
 Map of booleans used for periodic boundaries: Neighbour_periodic_direction[directon] returns true if the neighbour in that direction is actually a periodic neighbour — shared data values, but independent position. The default return of the map is false. More...
 
- Static Protected Attributes inherited from oomph::OcTree
static bool Static_data_has_been_setup =false
 Bool indicating that static member data has been setup. More...
 
- Static Protected Attributes inherited from oomph::Tree
static double Max_neighbour_finding_tolerance =1.0e-14
 Max. allowed discrepancy in neighbour finding routine (distance between points when identified from two neighbouring elements) More...
 

Detailed Description

OcTreeRoot is a OcTree that forms the root of a (recursive) octree. The "root node" is special as it holds additional information about its neighbours and their relative rotation (inside a OcTreeForest).

Definition at line 603 of file octree.h.

Constructor & Destructor Documentation

oomph::OcTreeRoot::OcTreeRoot ( RefineableElement *const &  object_pt)
inline

Constructor for the root octree: Pass pointer to the RefineableQElement<3> that is represented by the OcTree.

Definition at line 636 of file octree.h.

References oomph::OcTree::Static_data_has_been_setup, and oomph::Global_string_for_annotation::string().

oomph::OcTreeRoot::OcTreeRoot ( const OcTreeRoot dummy)
inline

Broken copy constructor.

Definition at line 660 of file octree.h.

References oomph::BrokenCopy::broken_copy().

Member Function Documentation

void oomph::OcTreeRoot::add_edge_neighbour_pt ( TreeRoot oc_tree_root_pt,
const unsigned &  edge_direction 
)
inline
int oomph::OcTreeRoot::direction_of_neighbour ( TreeRoot octree_root_pt)
inline
Vector<TreeRoot*> oomph::OcTreeRoot::edge_neighbour_pt ( const unsigned &  edge_direction)
inline
unsigned oomph::OcTreeRoot::nedge_neighbour ( const unsigned &  edge_direction)
inline
void oomph::OcTreeRoot::operator= ( const OcTreeRoot )
inline

Broken assignment operator.

Definition at line 666 of file octree.h.

References oomph::BrokenCopy::broken_assign().

int oomph::OcTreeRoot::right_equivalent ( TreeRoot tree_root_pt)
inline

The same thing as up_equivalent, but for the right direction: When viewed from the current octree neighbour, our right direction is the neighbour's Right_equivalent[neighbour_pt] direction. Returns OMEGA if the Octree specified by the pointer argument is not a neighbour.

Definition at line 802 of file octree.h.

References direction_of_neighbour(), oomph::Tree::OMEGA, and Right_equivalent.

void oomph::OcTreeRoot::set_right_equivalent ( TreeRoot tree_root_pt,
const int &  dir 
)
inline

The same thing as up_equivalent, but for the right direction: When viewed from the current octree neighbour, our right direction is the neighbour's Right_equivalent[neighbour_pt] direction.

Definition at line 818 of file octree.h.

References Right_equivalent.

Referenced by oomph::OcTreeForest::construct_up_right_equivalents().

void oomph::OcTreeRoot::set_up_equivalent ( TreeRoot tree_root_pt,
const int &  dir 
)
inline

Set up equivalent of the neighbours specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree (around the back-front axis) say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc.

Definition at line 791 of file octree.h.

References Up_equivalent.

Referenced by oomph::OcTreeForest::construct_up_right_equivalents().

int oomph::OcTreeRoot::up_equivalent ( TreeRoot tree_root_pt)
inline

Return up equivalent of the neighbours specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree (around the back-front axis) say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc. Returns OMEGA if the Octree specified by the pointer argument is not a neighbour.

Definition at line 769 of file octree.h.

References direction_of_neighbour(), oomph::Tree::OMEGA, and Up_equivalent.

Member Data Documentation

std::map<int,Vector<TreeRoot*> > oomph::OcTreeRoot::Edge_neighbour_pt
private

Map of pointers to the edge-neighbouring [Oc]TreeRoots: Edge_neighbour_pt[direction] is Vector to the pointers to the [Oc]TreeRoot's edge neighbours in the (enumerated) (edge) direction.

Definition at line 610 of file octree.h.

Referenced by add_edge_neighbour_pt(), edge_neighbour_pt(), and nedge_neighbour().

std::map<TreeRoot*,int> oomph::OcTreeRoot::Right_equivalent
private

Map giving the Right equivalent of the neighbour specified by pointer: When viewed from the current octree's neighbour, our right direction is the neighbour's right_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Right_equivalent[neighbour_pt]=R (read as: "in my neighbour, my Right is its Right").

Definition at line 629 of file octree.h.

Referenced by right_equivalent(), and set_right_equivalent().

std::map<TreeRoot*,int> oomph::OcTreeRoot::Up_equivalent
private

Map giving the Up equivalent of the neighbour specified by pointer: When viewed from the current octree's neighbour, our up direction is the neighbour's Up_equivalent[neighbour_pt] direction. If there's no rotation, this map contains the identify so that, e.g. Up_equivalent[neighbour_pt]=U (read as: "in my neighbour, my Up is its Up"). If the neighbour is rotated by 180 degrees relative to the current octree(around the back-front axis), say, we have Up_equivalent[neighbour_pt]=D (read as: "in my neighbour, my Up is its Down"); etc.

Definition at line 621 of file octree.h.

Referenced by set_up_equivalent(), and up_equivalent().


The documentation for this class was generated from the following file: