ug4
octahedron_rules.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015: G-CSC, Goethe University Frankfurt
3  * Author: Martin Stepniewski
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__octahedron_rules__
34 #define __H__UG__octahedron_rules__
35 
36 #include "common/math/ugmath.h"
37 
38 namespace ug{
39 namespace oct_rules
40 {
41 
43 // LOOKUP TABLES
44 
45 const int NUM_VERTICES = 6;
46 const int NUM_EDGES = 12;
47 const int NUM_FACES = 8;
48 const int NUM_TRIS = 8;
49 const int NUM_QUADS = 0;
50 
51 /* in case of regular refinement an octahedron is subdivided into 14 elements,
52  * 6 octahedrons and 8 tetrahedrons, resulting in 14 type-info plus
53  * 6*6 octahedral vertex plus 4*8 tetrahedral vertex indices,
54  * thus 82 MAX_NUM_INDS_OUT
55  */
56 const int MAX_NUM_INDS_OUT = 82;//todo: this is just an estimate!
57 
59 const int EDGE_VRT_INDS[][2] = { {0, 1}, {0, 2}, {0, 3}, {0, 4},
60  {1, 2}, {2, 3}, {3, 4}, {4, 1},
61  {1, 5}, {2, 5}, {3, 5}, {4, 5}};
62 
64 const int FACE_VRT_INDS[][4] = { {0, 1, 2, -1}, {0, 2, 3, -1}, {0, 3, 4, -1}, {0, 4, 1, -1},
65  {1, 5, 2, -1}, {2, 5, 3, -1}, {3, 5, 4, -1}, {4, 5, 1, -1}};
66 
68 const int BOTTOM_VERTEX = 0;
69 
71 const int TOP_VERTEX = 5;
72 
76 const int OPPOSED_OBJECT[][NUM_VERTICES] = {{0, 5}, {0, 3}, {0, 4}, {0, 1}, {0, 2}, {0, 0}};
77 
78 
81 // NOTE: The lists below are all generated automatically
82 
84 const int FACE_EDGE_INDS[8][4] = { {0, 4, 1, -1}, {1, 5, 2, -1}, {2, 6, 3, -1}, {3, 7, 0, -1},
85  {8, 9, 4, -1}, {9, 10, 5, -1}, {10, 11, 6, -1}, {11, 8, 7, -1}};
86 
88 const int FACE_CONTAINS_EDGE[][12] = { {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
89  {0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
90  {0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0},
91  {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0},
92  {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0},
93  {0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0},
94  {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1},
95  {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1}};
96 
98 
101 const int EDGE_FROM_VRTS[6][6] = { {-1, 0, 1, 2, 3, -1}, {0, -1, 4, -1, 7, 8}, {1, 4, -1, 5, -1, 9},
102  {2, -1, 5, -1, 6, 10}, {3, 7, -1, 6, -1, 11}, {-1, 8, 9, 10, 11, -1}};
103 
105 
108 const int FACE_FROM_VRTS[6][6][6] = { {{-1, -1, -1, -1, -1, -1}, {-1, -1, 0, -1, 3, -1}, {-1, 0, -1, 1, -1, -1}, {-1, -1, 1, -1, 2, -1}, {-1, 3, -1, 2, -1, -1}, {-1, -1, -1, -1, -1, -1}},
109  {{-1, -1, 0, -1, 3, -1}, {-1, -1, -1, -1, -1, -1}, {0, -1, -1, -1, -1, 4}, {-1, -1, -1, -1, -1, -1}, {3, -1, -1, -1, -1, 7}, {-1, -1, 4, -1, 7, -1}},
110  {{-1, 0, -1, 1, -1, -1}, {0, -1, -1, -1, -1, 4}, {-1, -1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, 5}, {-1, -1, -1, -1, -1, -1}, {-1, 4, -1, 5, -1, -1}},
111  {{-1, -1, 1, -1, 2, -1}, {-1, -1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, 5}, {-1, -1, -1, -1, -1, -1}, {2, -1, -1, -1, -1, 6}, {-1, -1, 5, -1, 6, -1}},
112  {{-1, 3, -1, 2, -1, -1}, {3, -1, -1, -1, -1, 7}, {-1, -1, -1, -1, -1, -1}, {2, -1, -1, -1, -1, 6}, {-1, -1, -1, -1, -1, -1}, {-1, 7, -1, 6, -1, -1}},
113  {{-1, -1, -1, -1, -1, -1}, {-1, -1, 4, -1, 7, -1}, {-1, 4, -1, 5, -1, -1}, {-1, -1, 5, -1, 6, -1}, {-1, 7, -1, 6, -1, -1}, {-1, -1, -1, -1, -1, -1}}};
114 
116 const int FACE_FROM_EDGES[][12] = { {0, 0, -1, 3, 0, -1, -1, 3, -1, -1, -1, -1}, {0, 0, 1, -1, 0, 1, -1, -1, -1, -1, -1, -1},
117  {-1, 1, 1, 2, -1, 1, 2, -1, -1, -1, -1, -1}, {3, -1, 2, 2, -1, -1, 2, 3, -1, -1, -1, -1},
118  {0, 0, -1, -1, 0, -1, -1, -1, 4, 4, -1, -1}, {-1, 1, 1, -1, -1, 1, -1, -1, -1, 5, 5, -1},
119  {-1, -1, 2, 2, -1, -1, 2, -1, -1, -1, 6, 6}, {3, -1, -1, 3, -1, -1, -1, 3, 7, -1, -1, 7},
120  {-1, -1, -1, -1, 4, -1, -1, 7, 4, 4, -1, 7}, {-1, -1, -1, -1, 4, 5, -1, -1, 4, 4, 5, -1},
121  {-1, -1, -1, -1, -1, 5, 6, -1, -1, 5, 5, 6}, {-1, -1, -1, -1, -1, -1, 6, 7, 7, -1, 6, 6}};
122 
123 
126 
170 int Refine(int* newIndsOut, int* newEdgeVrts, bool& newCenterOut,
171  vector3* corners = NULL, bool* isSnapPoint = NULL);
172 
173 
175 
187 bool IsRegularRefRule(const int edgeMarks);
188 
189 }// end of namespace oct_rules
190 }// end of namespace ug
191 
192 #endif
const int NUM_FACES
Definition: octahedron_rules.h:47
const int EDGE_FROM_VRTS[6][6]
Associates the index of the connecting edge with each tuple of vertices.
Definition: octahedron_rules.h:101
const int FACE_EDGE_INDS[8][4]
returns the j-th edge of the i-th face
Definition: octahedron_rules.h:84
const int BOTTOM_VERTEX
the octhedrons bottom
Definition: octahedron_rules.h:68
const int NUM_TRIS
Definition: octahedron_rules.h:48
const int FACE_VRT_INDS[][4]
the local vertex indices of the given face
Definition: octahedron_rules.h:64
const int NUM_VERTICES
Definition: octahedron_rules.h:45
int Refine(int *newIndsOut, int *newEdgeVrts, bool &newCenterOut, vector3 *corners, bool *)
Definition: octahedron_rules.cpp:56
const int FACE_CONTAINS_EDGE[][12]
tells whether the i-th face contains the j-th edge
Definition: octahedron_rules.h:88
const int FACE_FROM_EDGES[][12]
given two edges, the table returns the face, which contains both (or -1)
Definition: octahedron_rules.h:116
const int TOP_VERTEX
the octhedrons top
Definition: octahedron_rules.h:71
bool IsRegularRefRule(const int edgeMarks)
returns true if the specified edgeMarks would lead to a regular refinement
Definition: octahedron_rules.cpp:516
const int OPPOSED_OBJECT[][NUM_VERTICES]
Definition: octahedron_rules.h:76
const int MAX_NUM_INDS_OUT
Definition: octahedron_rules.h:56
const int NUM_QUADS
Definition: octahedron_rules.h:49
const int FACE_FROM_VRTS[6][6][6]
Associates the index of the connecting face with each triple of vertices.
Definition: octahedron_rules.h:108
const int EDGE_VRT_INDS[][2]
the local vertex indices of the given edge
Definition: octahedron_rules.h:59
const int NUM_EDGES
Definition: octahedron_rules.h:46
the ug namespace