26 #ifndef OOMPH_OCTREE_HEADER
27 #define OOMPH_OCTREE_HEADER
31 #include <oomph-lib-config.h>
189 bool& in_neighbouring_tree)
const;
248 const unsigned& i_root_edge_neighbour,
249 unsigned& nroot_edge_neighbour,
254 int& diff_level)
const;
275 std::ofstream& neighbours_file,
276 std::ofstream& neighbours_txt_file,
288 std::ofstream& neighbours_file,
289 std::ofstream& no_true_edge_file,
290 std::ofstream& neighbours_txt_file,
300 const unsigned& nnode1d,
307 const unsigned& nnode1d);
313 const unsigned& nnode1d);
319 const int& new_right,
325 static int rotate(
const int& new_up,
const int& new_right,
const int& dir);
375 static std::map<std::pair<std::pair<int, int>, std::pair<int, int>>,
384 throw OomphLibError(
"Don't call empty constructor for OcTree!",
441 bool& in_neighbouring_tree,
481 const unsigned& i_root_edge_neighbour,
482 unsigned& nroot_edge_neighbour,
492 OcTree* edge_neighb_pt)
const;
516 const unsigned& nnode1d);
649 "Static member data hasn't been setup yet.\n";
650 error_message +=
"Call OcTree::setup_static_data() before creating\n";
651 error_message +=
"any OcTreeRoots\n";
671 using namespace OcTreeNames;
672 if ((edge_direction !=
LB) && (edge_direction !=
RB) &&
673 (edge_direction !=
DB) && (edge_direction !=
UB) &&
674 (edge_direction !=
LD) && (edge_direction !=
RD) &&
675 (edge_direction !=
LU) && (edge_direction !=
RU) &&
676 (edge_direction !=
LF) && (edge_direction !=
RF) &&
677 (edge_direction !=
DF) && (edge_direction !=
UF))
679 std::ostringstream error_stream;
680 error_stream <<
"Wrong edge_direction: "
696 using namespace OcTreeNames;
697 if ((edge_direction !=
LB) && (edge_direction !=
RB) &&
698 (edge_direction !=
DB) && (edge_direction !=
UB) &&
699 (edge_direction !=
LD) && (edge_direction !=
RD) &&
700 (edge_direction !=
LU) && (edge_direction !=
RU) &&
701 (edge_direction !=
LF) && (edge_direction !=
RF) &&
702 (edge_direction !=
DF) && (edge_direction !=
UF))
704 std::ostringstream error_stream;
705 error_stream <<
"Wrong edge_direction: "
717 const unsigned& edge_direction)
720 using namespace OcTreeNames;
721 if ((edge_direction !=
LB) && (edge_direction !=
RB) &&
722 (edge_direction !=
DB) && (edge_direction !=
UB) &&
723 (edge_direction !=
LD) && (edge_direction !=
RD) &&
724 (edge_direction !=
LU) && (edge_direction !=
RU) &&
725 (edge_direction !=
LF) && (edge_direction !=
RF) &&
726 (edge_direction !=
DF) && (edge_direction !=
UF))
728 std::ostringstream error_stream;
729 error_stream <<
"Wrong edge_direction: "
816 using namespace OcTreeNames;
896 for (
int dir =
LB; dir <=
UF; dir++)
899 unsigned n_neigh = edge_neigh_pt.size();
900 for (
unsigned e = 0;
e < n_neigh;
e++)
902 if (edge_neigh_pt[
e] == octree_root_pt)
937 throw OomphLibError(
"Don't call empty constructor for OcTreeForest!",
957 void check_all_neighbours(
DocInfo& doc_info);
961 void open_hanging_node_files(
DocInfo& doc_info,
985 using namespace OcTreeNames;
986 if ((direction !=
U) && (direction !=
D) && (direction !=
F) &&
987 (direction !=
B) && (direction !=
L) && (direction !=
R))
989 std::ostringstream error_stream;
990 error_stream <<
"Wrong edge_direction: "
996 return dynamic_cast<OcTreeRoot*
>(Trees_pt[
i]->neighbour_pt(direction));
1010 void construct_up_right_equivalents();
1014 void find_neighbours();
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
MatrixXd L
Definition: LLT_example.cpp:6
@ R
Definition: StatisticsVector.h:21
MatrixXd mat1(size, size)
Definition: oomph_utilities.h:499
Definition: matrices.h:74
OcTreeForest()
Default constructor (empty and broken)
Definition: octree.h:935
OcTreeForest(const OcTreeForest &dummy)=delete
Broken copy constructor.
Vector< TreeRoot * > oc_edge_neigh_pt(const unsigned &i, const int &direction)
Definition: octree.h:1002
OcTreeRoot * oc_face_neigh_pt(const unsigned &i, const int &direction)
Definition: octree.h:982
OcTreeRoot * octree_pt(const unsigned &i) const
Definition: octree.h:973
virtual ~OcTreeForest()
Definition: octree.h:950
void operator=(const OcTreeForest &)=delete
Broken assignment operator.
std::map< TreeRoot *, int > Up_equivalent
Definition: octree.h:627
OcTreeRoot(const OcTreeRoot &dummy)=delete
Broken copy constructor.
int right_equivalent(TreeRoot *tree_root_pt)
Definition: octree.h:790
OcTreeRoot(RefineableElement *const &object_pt)
Definition: octree.h:641
void operator=(const OcTreeRoot &)=delete
Broken assignment operator.
int direction_of_neighbour(TreeRoot *octree_root_pt)
Definition: octree.h:814
std::map< TreeRoot *, int > Right_equivalent
Definition: octree.h:635
void set_up_equivalent(TreeRoot *tree_root_pt, const int &dir)
Definition: octree.h:779
void add_edge_neighbour_pt(TreeRoot *oc_tree_root_pt, const unsigned &edge_direction)
Definition: octree.h:716
int up_equivalent(TreeRoot *tree_root_pt)
Definition: octree.h:757
void set_right_equivalent(TreeRoot *tree_root_pt, const int &dir)
Definition: octree.h:806
Vector< TreeRoot * > edge_neighbour_pt(const unsigned &edge_direction)
Definition: octree.h:668
unsigned nedge_neighbour(const unsigned &edge_direction)
Definition: octree.h:693
std::map< int, Vector< TreeRoot * > > Edge_neighbour_pt
Definition: octree.h:616
static DenseMatrix< double > S_step_edge
Definition: octree.h:593
static Vector< std::string > Colour
Colours for neighbours in various directions.
Definition: octree.h:540
static DenseMatrix< double > S_base
Definition: octree.h:544
static DenseMatrix< double > S_directhi
Definition: octree.h:581
void operator=(const OcTree &)=delete
Broken assignment operator.
static DenseMatrix< bool > Is_adjacent
Definition: octree.h:529
static Vector< int > rotate(const int &new_up, const int &new_right, const Vector< int > &dir)
Definition: octree.cc:750
static Vector< int > faces_of_common_edge(const int &edge)
Function that, given an edge, returns the two faces on which it.
Definition: octree.cc:268
OcTree(RefineableElement *const &object_pt)
Definition: octree.h:395
OcTree(const OcTree &dummy)=delete
Broken copy constructor.
static Vector< std::string > Direct_string
Translate (enumerated) directions into strings.
Definition: octree.h:329
static DenseMatrix< double > S_directlo
Definition: octree.h:573
Tree * construct_son(RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
Definition: octree.h:129
static int node_number_to_vertex(const unsigned &n, const unsigned &nnode1d)
Definition: octree.cc:491
static void mult_mat_vect(const DenseMatrix< int > &mat, const Vector< int > &vect1, Vector< int > &vect2)
Helper function: Performs the operation : vect2 = mat*vect1.
Definition: octree.cc:687
static DenseMatrix< int > Common_face
Definition: octree.h:537
static Vector< int > Reflect_face
Get opposite face, e.g. Reflect_face[L]=R.
Definition: octree.h:332
static Vector< int > Sini
Entry in rotation matrix sin(i*90)
Definition: octree.h:523
virtual ~OcTree()
Definition: octree.h:118
static void setup_static_data()
Setup the static data, rotation and reflection schemes, etc.
Definition: octree.cc:1040
unsigned self_test()
Definition: octree.cc:4200
OcTree * gteq_face_neighbour(const int &direction, Vector< unsigned > &translate_s, Vector< double > &s_sw, Vector< double > &s_ne, int &face, int &diff_level, bool &in_neighbouring_tree) const
Definition: octree.cc:3373
static Vector< int > vertex_node_to_vector(const unsigned &n, const unsigned &nnode1d)
Definition: octree.cc:232
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)
Definition: octree.cc:4552
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
Definition: octree.h:377
static DenseMatrix< double > S_base_edge
Definition: octree.h:585
static Vector< int > Cosi
Entry in rotation matrix: cos(i*90)
Definition: octree.h:520
static DenseMatrix< int > Reflect
Definition: octree.h:533
static int get_the_other_face(const unsigned &n1, const unsigned &n2, const unsigned &nnode1d, const int &face)
Definition: octree.cc:565
OcTree * gteq_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
Definition: octree.cc:3618
bool edge_neighbour_is_face_neighbour(const int &edge, OcTree *edge_neighb_pt) const
Definition: octree.cc:2769
OcTree * gteq_edge_neighbour(const int &direction, const unsigned &i_root_edge_neighbour, unsigned &nroot_edge_neighbour, double &s_diff, int &diff_level, int max_level, OcTreeRoot *orig_root_pt) const
Definition: octree.cc:4015
OcTree()
Default constructor (empty and broken)
Definition: octree.h:382
static DenseMatrix< double > S_direct_edge
Definition: octree.h:600
static Vector< int > Reflect_vertex
Get opposite vertex, e.g. Reflect_vertex[LDB]=RUF.
Definition: octree.h:338
static Vector< Vector< int > > Vertex_at_end_of_edge
Map of vectors containing the two vertices for each edge.
Definition: octree.h:343
static void construct_rotation_matrix(int &axis, int &angle, DenseMatrix< int > &mat)
Definition: octree.cc:609
static void mult_mat_mat(const DenseMatrix< int > &mat1, const DenseMatrix< int > &mat2, DenseMatrix< int > &mat3)
Helper function: Performs the operation : mat3=mat1*mat2.
Definition: octree.cc:664
static bool Static_data_has_been_setup
Bool indicating that static member data has been setup.
Definition: octree.h:412
static DenseMatrix< double > S_stephi
Definition: octree.h:565
static Vector< Vector< int > > Direction_to_vector
Definition: octree.h:353
static Vector< int > Reflect_edge
Get opposite edge, e.g. Reflect_edge[DB]=UF.
Definition: octree.h:335
static std::map< Vector< int >, int > Vector_to_direction
Definition: octree.h:348
static DenseMatrix< double > S_steplo
Definition: octree.h:558
static unsigned vertex_to_node_number(const int &vertex, const unsigned &nnode1d)
Definition: octree.cc:414
OcTree(RefineableElement *const &object_pt, Tree *const &father_pt, const int &son_type)
Definition: octree.h:404
static void doc_face_neighbours(Vector< Tree * > forest_nodes_pt, std::ofstream &neighbours_file, std::ofstream &neighbours_txt_file, double &max_error)
Definition: octree.cc:4275
Definition: oomph_definitions.h:222
Definition: refineable_elements.h:97
std::map< int, TreeRoot * > Neighbour_pt
Definition: tree.h:330
RefineableElement * object_pt() const
Definition: tree.h:88
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
Definition: tree.h:235
int son_type() const
Return son type.
Definition: tree.h:214
static const int OMEGA
Default value for an unassigned neighbour.
Definition: tree.h:262
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
double angle(const double &t)
Angular position as a function of time t.
Definition: jeffery_orbit.cc:98
double max_error
Definition: MortaringCantileverCompareToNonMortaring.cpp:188
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
@ RDF
Definition: octree.h:54
@ DF
Definition: octree.h:67
@ RD
Definition: octree.h:62
@ B
Definition: octree.h:73
@ RUB
Definition: octree.h:52
@ D
Definition: octree.h:71
@ L
Definition: octree.h:69
@ RB
Definition: octree.h:58
@ R
Definition: octree.h:70
@ UF
Definition: octree.h:68
@ LUF
Definition: octree.h:55
@ RU
Definition: octree.h:64
@ F
Definition: octree.h:74
@ LDF
Definition: octree.h:53
@ LF
Definition: octree.h:65
@ RDB
Definition: octree.h:50
@ LD
Definition: octree.h:61
@ LUB
Definition: octree.h:51
@ U
Definition: octree.h:72
@ RUF
Definition: octree.h:56
@ RF
Definition: octree.h:66
@ LDB
Definition: octree.h:49
@ OMEGA
Definition: octree.h:75
@ LU
Definition: octree.h:63
@ DB
Definition: octree.h:59
@ UB
Definition: octree.h:60
@ LB
Definition: octree.h:57
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86