27#ifndef OOMPH_QUADTREE_HEADER
28#define OOMPH_QUADTREE_HEADER
33#include <oomph-lib-config.h>
50 namespace QuadTreeNames
206 "Don't call an empty constructor for a QuadTree object",
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";
326 using namespace QuadTreeNames;
357 using namespace QuadTreeNames;
362 std::ostringstream error_message;
363 error_message <<
"The neighbour can only be N,S,E,W, not"
379 using namespace QuadTreeNames;
416 "Don't call an empty constructor for a QuadTreeForest object",
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.
QuadTreeForest()
Default constructor (empty and broken)
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 ...
void check_all_neighbours(DocInfo &doc_info)
Document and check all the neighbours of all the nodes in the forest. DocInfo object specifies the ou...
void find_neighbours()
Construct the neighbour lookup scheme.
unsigned self_test()
Self-test: Check all neighbours. Return success (0) if the max. distance between corresponding points...
void construct_north_equivalents()
Construct the rotation schemes.
void open_hanging_node_files(DocInfo &doc_info, Vector< std::ofstream * > &output_stream)
Open output files that will store any hanging nodes in the forest and return a vector of the streams.
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 ...
int & north_equivalent(const int &neighbour)
Return north equivalent of the neighbours in specified direction: When viewed from the current quadtr...
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 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...
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...
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.
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 ...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
A TreeForest consists of a collection of TreeRoots. Each member tree can have neighbours in various e...
Vector< TreeRoot * > Trees_pt
Vector containing the pointers to the trees.
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...
int son_type() const
Return son type.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
static const int OMEGA
Default value for an unassigned neighbour.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).