oomph::QuadTreeRoot Class Reference

#include <quadtree.h>

+ Inheritance diagram for oomph::QuadTreeRoot:

Public Member Functions

 QuadTreeRoot (RefineableElement *const &object_pt)
 
 QuadTreeRoot (const QuadTreeRoot &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const QuadTreeRoot &)=delete
 Broken assignment operator. More...
 
intnorth_equivalent (const int &neighbour)
 
int direction_of_neighbour (QuadTreeRoot *quadtree_root_pt)
 
- Public Member Functions inherited from oomph::QuadTree
virtual ~QuadTree ()
 
 QuadTree (const QuadTree &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const QuadTree &)=delete
 Broken assignment operator. More...
 
Treeconstruct_son (RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
 
QuadTreegteq_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 ()
 
- Public Member Functions inherited from oomph::Tree
virtual ~Tree ()
 
 Tree (const Tree &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Tree &)=delete
 Broken assignment operator. More...
 
RefineableElementobject_pt () const
 
void flush_object ()
 Flush the object represented by the tree. More...
 
Treeson_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...
 
TreeRootroot_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...
 
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)=delete
 Broken copy constructor. More...
 
void operator= (const TreeRoot &)=delete
 Broken assignment operator. More...
 
TreeRoot *& neighbour_pt (const int &direction)
 
bool is_neighbour_periodic (const int &direction)
 
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

Vector< intNorth_equivalent
 

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::QuadTree
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 Public Member Functions inherited from oomph::Tree
static doublemax_neighbour_finding_tolerance ()
 
- Static Public Attributes inherited from oomph::QuadTree
static Vector< std::string > Direct_string
 Translate (enumerated) directions into strings. 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::QuadTree
 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)
 
- Protected Member Functions inherited from oomph::Tree
 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)
 
- 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
 
std::map< int, boolNeighbour_periodic
 
- Static Protected Attributes inherited from oomph::QuadTree
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
 

Detailed Description

QuadTreeRoot is a QuadTree that forms the root of a (recursive) quadtree. The "root node" is special as it holds additional information about its neighbours and their relative rotation (inside a QuadTreeForest).

Constructor & Destructor Documentation

◆ QuadTreeRoot() [1/2]

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

Constructor for the (empty) root quadtree: Pass pointer to associated object, a RefineableQElement<2>.

311  {
312 #ifdef PARANOID
313  // Check that static member data has been setup
315  {
316  std::string error_message =
317  "Static member data hasn't been setup yet.\n";
318  error_message += "Call QuadTree::setup_static_data() before creating\n";
319  error_message += "any QuadTreeRoots\n";
320 
321  throw OomphLibError(
323  }
324 #endif
325 
326  using namespace QuadTreeNames;
327 
328  // Initialise the North equivalents of the neighbouring QuadTreeRoots
329  North_equivalent.resize(27);
330 
331  North_equivalent[N] = N;
332  North_equivalent[E] = N;
333  North_equivalent[W] = N;
334  North_equivalent[S] = N;
335  }
Vector< int > North_equivalent
Definition: quadtree.h:304
QuadTree()
Default constructor (empty and broken)
Definition: quadtree.h:203
static bool Static_data_has_been_setup
Bool indicating that static member data has been setup.
Definition: quadtree.h:232
TreeRoot(RefineableElement *const &object_pt)
Constructor for the (empty) root tree.
Definition: tree.h:342
RefineableElement * object_pt() const
Definition: tree.h:88
Tree()
Default constructor (empty and broken)
Definition: tree.h:266
@ N
Definition: constructor.cpp:22
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
@ E
Definition: quadtree.h:61
@ S
Definition: quadtree.h:62
@ W
Definition: quadtree.h:63
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References oomph::QuadTreeNames::E, N, North_equivalent, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::QuadTreeNames::S, oomph::QuadTree::Static_data_has_been_setup, oomph::Global_string_for_annotation::string(), and oomph::QuadTreeNames::W.

◆ QuadTreeRoot() [2/2]

oomph::QuadTreeRoot::QuadTreeRoot ( const QuadTreeRoot dummy)
delete

Broken copy constructor.

Member Function Documentation

◆ direction_of_neighbour()

int oomph::QuadTreeRoot::direction_of_neighbour ( QuadTreeRoot quadtree_root_pt)
inline

If quadtree_root_pt is a neighbour, return the direction [N/S/E/W] in which it is found, otherwise return OMEGA

378  {
379  using namespace QuadTreeNames;
380  if (Neighbour_pt[N] == quadtree_root_pt)
381  {
382  return N;
383  }
384  if (Neighbour_pt[E] == quadtree_root_pt)
385  {
386  return E;
387  }
388  if (Neighbour_pt[S] == quadtree_root_pt)
389  {
390  return S;
391  }
392  if (Neighbour_pt[W] == quadtree_root_pt)
393  {
394  return W;
395  }
396  // If we get here, it's not a neighbour
397  return OMEGA;
398  }
std::map< int, TreeRoot * > Neighbour_pt
Definition: tree.h:330
static const int OMEGA
Default value for an unassigned neighbour.
Definition: tree.h:262

References oomph::QuadTreeNames::E, N, oomph::TreeRoot::Neighbour_pt, oomph::Tree::OMEGA, oomph::QuadTreeNames::S, and oomph::QuadTreeNames::W.

Referenced by oomph::QuadTreeForest::construct_north_equivalents().

◆ north_equivalent()

int& oomph::QuadTreeRoot::north_equivalent ( const int neighbour)
inline

Return north equivalent of the neighbours in specified direction: When viewed from the current quadtree's neighbour neighbour, our northern direction is the neighbour's north_equivalent(neighbour) direction. If there's no rotation, this map contains the identify so that, e.g. north_equivalent(W)=N (read as: "in my Western neighbour, my North is its North"). If the western neighbour is rotated by 180 degrees relative to the current quadtree, say, we have north_equivalent(W)=S (read as: "in my Western neighbour, my North is its South"); etc.

355  {
356 #ifdef PARANOID
357  using namespace QuadTreeNames;
358  // Neighbour can only be located in N/S/E/W direction
359  if ((neighbour != S) && (neighbour != N) && (neighbour != W) &&
360  (neighbour != E))
361  {
362  std::ostringstream error_message;
363  error_message << "The neighbour can only be N,S,E,W, not"
364  << Direct_string[neighbour] << std::endl;
365 
366  throw OomphLibError(error_message.str(),
369  }
370 #endif
371  return North_equivalent[neighbour];
372  }
static Vector< std::string > Direct_string
Translate (enumerated) directions into strings.
Definition: quadtree.h:199

References oomph::QuadTree::Direct_string, oomph::QuadTreeNames::E, N, North_equivalent, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::QuadTreeNames::S, and oomph::QuadTreeNames::W.

Referenced by oomph::QuadTreeForest::construct_north_equivalents(), and oomph::QuadTree::gteq_edge_neighbour().

◆ operator=()

void oomph::QuadTreeRoot::operator= ( const QuadTreeRoot )
delete

Broken assignment operator.

Member Data Documentation

◆ North_equivalent

Vector<int> oomph::QuadTreeRoot::North_equivalent
private

Vector giving the north equivalent of the neighbours: When viewed from the current quadtree's neighbour neighbour, our northern direction is the neighbour's North_equivalent[neighbour] direction. If there's no rotation, this map contains the identify so that, e.g. North_equivalent[W]=N (read as: "in my Western neighbour, my North is its North"). If the western neighbour is rotated by 180 degrees relative to the current quadtree, say, we have North_equivalent[W]=S (read as: "in my Western neighbour, my North is its South"); etc.

Referenced by north_equivalent(), and QuadTreeRoot().


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