31 #ifndef OOMPH_QUADTREE_HEADER 32 #define OOMPH_QUADTREE_HEADER 37 #include <oomph-lib-config.h> 56 namespace QuadTreeNames
121 Tree*
const &father_pt,
const int &son_type)
158 QuadTree* gteq_edge_neighbour(
const int& direction,
161 int& edge,
int& diff_level,
162 bool &in_neighbouring_tree)
const;
166 void stick_neighbouring_leaves_into_vector(
172 const int& direction)
const;
181 static void setup_static_data();
191 std::ofstream& neighbours_file,
192 std::ofstream& neighbours_txt_file,
205 throw OomphLibError(
"Don't call an empty constructor for a QuadTree object",
206 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
223 Tree*
const &father_pt,
const int& son_type)
224 :
Tree(object_pt,father_pt,son_type) {}
234 QuadTree* gteq_edge_neighbour(
const int& direction,
237 bool& in_neighbouring_tree,
315 if (!Static_data_has_been_setup)
318 "Static member data hasn't been setup yet.\n";
320 "Call QuadTree::setup_static_data() before creating\n";
321 error_message +=
"any QuadTreeRoots\n";
324 OOMPH_CURRENT_FUNCTION,
325 OOMPH_EXCEPTION_LOCATION);
329 using namespace QuadTreeNames;
332 North_equivalent.resize(27);
334 North_equivalent[
N] =
N;
335 North_equivalent[
E] =
N;
336 North_equivalent[
W] =
N;
337 North_equivalent[
S] =
N;
366 using namespace QuadTreeNames;
368 if((neighbour!=
S)&&(neighbour!=
N)&&(neighbour!=
W)&&(neighbour!=
E))
370 std::ostringstream error_message;
371 error_message <<
"The neighbour can only be N,S,E,W, not" 372 << Direct_string[neighbour] << std::endl;
375 OOMPH_CURRENT_FUNCTION,
376 OOMPH_EXCEPTION_LOCATION);
379 return North_equivalent[neighbour];
387 using namespace QuadTreeNames;
388 if(Neighbour_pt[
N]==quadtree_root_pt) {
return N;}
389 if(Neighbour_pt[
E]==quadtree_root_pt) {
return E;}
390 if(Neighbour_pt[
S]==quadtree_root_pt) {
return S;}
391 if(Neighbour_pt[
W]==quadtree_root_pt) {
return W;}
415 "Don't call an empty constructor for a QuadTreeForest object",
416 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
443 void check_all_neighbours(
DocInfo &doc_info);
447 void open_hanging_node_files(
DocInfo &doc_info,
459 void construct_north_equivalents();
462 void find_neighbours();
475 {
return dynamic_cast<QuadTreeRoot*
>(Trees_pt[
i]->neighbour_pt(direction));}
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Vector< int > North_equivalent
Vector giving the north equivalent of the neighbours: When viewed from the current quadtree's neighbo...
static bool Static_data_has_been_setup
Bool indicating that static member data has been setup.
void operator=(const QuadTree &)
Broken assignment operator.
Information for documentation of results: Directory and file number to enable output in the form RESL...
static Vector< std::string > Direct_string
Translate (enumerated) directions into strings.
QuadTree()
Default constructor (empty and broken)
virtual ~QuadTreeForest()
Destructor: Delete the constituent quadtrees (and thus the objects associated with its non-leaf nodes...
QuadTreeForest(const QuadTreeForest &dummy)
Broken copy constructor.
static DenseMatrix< int > Rotate
Rotate coordinates: If North becomes NorthIs then direction becomes Rotate(NorthIs,direction). E.g. Rotate(E,NW)=NE;.
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: Return 0 for OK.
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...
static DenseMatrix< int > Reflect
Reflection scheme: Reflect(direction,quadrant): Get mirror of quadrant in specified direction...
static DenseMatrix< int > Rotate_angle
Angle betwen rotated coordinates: If old_direction becomes new_direction then the angle between the a...
QuadTreeForest()
Default constructor (empty and broken)
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) ...
QuadTree(RefineableElement *const &object_pt)
Default constructor for empty (root) tree: no father, no sons; just pass a pointer to its object Prot...
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 ...
void operator=(const QuadTreeForest &)
Broken assignment operator.
QuadTreeRoot * quadtree_pt(const unsigned &i)
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...
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...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
int & north_equivalent(const int &neighbour)
Return north equivalent of the neighbours in specified direction: When viewed from the current quadtr...
static DenseMatrix< double > S_step
S_step(i,direction) Increments for coordinate s[i] when progressing along the edge indicated by direc...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
QuadTreeRoot(RefineableElement *const &object_pt)
QuadTreeRoot(const QuadTreeRoot &dummy)
Broken copy constructor.
static Vector< std::string > Colour
Colours for neighbours in various directions.
static DenseMatrix< bool > Is_adjacent
Array of direction/quadrant adjacency scheme: Is_adjacent(i_vertex_or_edge,j_quadrant): Is edge/verte...
void operator=(const QuadTreeRoot &)
Broken assignment operator.
virtual ~QuadTree()
Destructor. Note: Deleting a quadtree also deletes the objects associated with all non-leaf nodes! ...
static Vector< int > Reflect_edge
Get opposite edge, e.g. Reflect_edge[N]=S.
QuadTree(const QuadTree &dummy)
Broken copy constructor.