27 #ifndef OOMPH_QUADTREE_HEADER
28 #define OOMPH_QUADTREE_HEADER
33 #include <oomph-lib-config.h>
50 namespace QuadTreeNames
164 bool& in_neighbouring_tree)
const;
174 const int& direction)
const;
193 std::ofstream& neighbours_file,
194 std::ofstream& neighbours_txt_file,
206 "Don't call an empty constructor for a QuadTree object",
207 OOMPH_CURRENT_FUNCTION,
208 OOMPH_EXCEPTION_LOCATION);
241 bool& in_neighbouring_tree,
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";
322 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
326 using namespace QuadTreeNames;
357 using namespace QuadTreeNames;
359 if ((neighbour !=
S) && (neighbour !=
N) && (neighbour !=
W) &&
362 std::ostringstream error_message;
363 error_message <<
"The neighbour can only be N,S,E,W, not"
367 OOMPH_CURRENT_FUNCTION,
368 OOMPH_EXCEPTION_LOCATION);
379 using namespace QuadTreeNames;
416 "Don't call an empty constructor for a QuadTreeForest object",
417 OOMPH_CURRENT_FUNCTION,
418 OOMPH_EXCEPTION_LOCATION);
439 void check_all_neighbours(
DocInfo& doc_info);
443 void open_hanging_node_files(
DocInfo& doc_info,
454 void construct_north_equivalents();
457 void find_neighbours();
473 return dynamic_cast<QuadTreeRoot*
>(Trees_pt[
i]->neighbour_pt(direction));
Information for documentation of results: Directory and file number to enable output in the form RESL...
An OomphLibError object which should be thrown when an run-time error is encountered....
A QuadTreeForest consists of a collection of QuadTreeRoots. Each member tree can have neighbours to i...
QuadTreeForest(const QuadTreeForest &dummy)=delete
Broken copy constructor.
void operator=(const QuadTreeForest &)=delete
Broken assignment operator.
QuadTreeRoot * quadtree_pt(const unsigned &i)
Return pointer to i-th root quadtree in this forest. (Performs a dynamic cast from the TreeRoot to a ...
QuadTreeForest()
Default constructor (empty and broken)
QuadTreeRoot * quad_neigh_pt(const unsigned &i, const int &direction)
Given the number i of the root quadtree in this forest, return pointer to its neighbour in the specif...
virtual ~QuadTreeForest()
Destructor: Delete the constituent quadtrees (and thus the objects associated with its non-leaf nodes...
QuadTreeRoot is a QuadTree that forms the root of a (recursive) quadtree. The "root node" is special ...
void operator=(const QuadTreeRoot &)=delete
Broken assignment operator.
Vector< int > North_equivalent
Vector giving the north equivalent of the neighbours: When viewed from the current quadtree's neighbo...
QuadTreeRoot(RefineableElement *const &object_pt)
Constructor for the (empty) root quadtree: Pass pointer to associated object, a RefineableQElement<2>...
QuadTreeRoot(const QuadTreeRoot &dummy)=delete
Broken copy constructor.
int & north_equivalent(const int &neighbour)
Return north equivalent of the neighbours in specified direction: When viewed from the current quadtr...
int direction_of_neighbour(QuadTreeRoot *quadtree_root_pt)
If quadtree_root_pt is a neighbour, return the direction [N/S/E/W] in which it is found,...
QuadTree class: Recursively defined, generalised quadtree.
void operator=(const QuadTree &)=delete
Broken assignment operator.
static Vector< std::string > Direct_string
Translate (enumerated) directions into strings.
static void doc_neighbours(Vector< Tree * > forest_nodes_pt, std::ofstream &neighbours_file, std::ofstream &neighbours_txt_file, double &max_error)
Doc/check all neighbours of quadtree (nodes) contained in the Vector forest_node_pt....
static DenseMatrix< double > S_step
S_step(i,direction) Increments for coordinate s[i] when progressing along the edge indicated by direc...
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
Traverse Tree: Preorder traverse and stick pointers to neighbouring leaf nodes (only) into Vector.
static Vector< int > Reflect_edge
Get opposite edge, e.g. Reflect_edge[N]=S.
QuadTree(RefineableElement *const &object_pt)
Default constructor for empty (root) tree: no father, no sons; just pass a pointer to its object Prot...
static DenseMatrix< int > Reflect
Reflection scheme: Reflect(direction,quadrant): Get mirror of quadrant in specified direction....
static DenseMatrix< int > Rotate
Rotate coordinates: If North becomes NorthIs then direction becomes Rotate(NorthIs,...
static void setup_static_data()
Setup the static data, rotation and reflection schemes, etc.
QuadTree(const QuadTree &dummy)=delete
Broken copy constructor.
static DenseMatrix< double > S_base
S_base(i,direction): Initial value for coordinate s[i] on the edge indicated by direction (S/E/N/W)
Tree * construct_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 QuadTree and not a general T...
QuadTree()
Default constructor (empty and broken)
static DenseMatrix< int > S_direct
S_direct(direction,son_quadrant): The lower left corner of son_quadrant has an offset of h/2 S_direct...
unsigned self_test()
Self-test: Check all neighbours. Return success (0) if the max. distance between corresponding points...
virtual ~QuadTree()
Destructor. Note: Deleting a quadtree also deletes the objects associated with all non-leaf nodes!
static Vector< std::string > Colour
Colours for neighbours in various directions.
QuadTree * gteq_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
Return pointer to greater or equal-sized edge neighbour in specified direction; also provide info reg...
static DenseMatrix< bool > Is_adjacent
Array of direction/quadrant adjacency scheme: Is_adjacent(i_vertex_or_edge,j_quadrant): Is edge/verte...
QuadTree(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 ...
static bool Static_data_has_been_setup
Bool indicating that static member data has been setup.
static DenseMatrix< int > Rotate_angle
Angle betwen rotated coordinates: If old_direction becomes new_direction then the angle between the a...
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
A TreeForest consists of a collection of TreeRoots. Each member tree can have neighbours in various e...
TreeRoot is a Tree that forms the root of a (recursive) tree. The "root node" is special as it holds ...
std::map< int, TreeRoot * > Neighbour_pt
Map of pointers to the neighbouring TreeRoots: Neighbour_pt[direction] returns the pointer to the Tre...
A generalised tree base class that abstracts the common functionality between the quad- and octrees u...
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
int son_type() const
Return son type.
static const int OMEGA
Default value for an unassigned neighbour.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...