ug4
hexahedron_rules.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
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__hexahedron_rules__
34 #define __H__UG__hexahedron_rules__
35 
36 // only required for dummy-parameter ug::vector3*
38 
39 namespace ug{
40 namespace hex_rules{
41 
43 // LOOKUP TABLES
44 
45 const int NUM_VERTICES = 8;
46 const int NUM_EDGES = 12;
47 const int NUM_FACES = 6;
48 const int NUM_TRIS = 0;
49 const int NUM_QUADS = 6;
50 const int MAX_NUM_INDS_OUT = 256;//todo: this is just an estimate!
52 
54 const int EDGE_VRT_INDS[][2] = { {0, 1}, {1, 2}, {2, 3}, {3, 0},
55  {0, 4}, {1, 5}, {2, 6}, {3, 7},
56  {4, 5}, {5, 6}, {6, 7}, {7, 4}};
57 
59 const int FACE_VRT_INDS[][4] = { {0, 1, 2, 3}, {0, 4, 5, 1},
60  {1, 5, 6, 2}, {2, 6, 7, 3},
61  {3, 7, 4, 0}, {4, 7, 6, 5}};
62 // {0, 3, 7, 4}, {4, 7, 6, 5}};
63 
65 const int OPPOSED_FACE[NUM_FACES] = {5, 3, 4, 1, 2, 0};
66 
68 
72 const int OPPOSED_FACE_VRT_INDS[][4] = {{4, 5, 6, 7}, {3, 7, 6, 2},
73  {0, 4, 7, 3}, {1, 5, 4, 0},
74  {2, 6, 5, 1}, {0, 3, 2, 1}};
75 // {1, 2, 6, 5}, {0, 3, 2, 1}};
76 
77 
81 const int OPPOSED_OBJECT[][NUM_VERTICES] = {{0, 6}, {0, 7}, {0, 4}, {0, 5},
82  {0, 2}, {0, 3}, {0, 0}, {0, 1}};
83 
84 
87 // NOTE: The lists below are all generated automatically
88 
90 const int FACE_EDGE_INDS[6][4] =
91  {{0, 1, 2, 3}, {4, 8, 5, 0}, {5, 9, 6, 1},
92  {6, 10, 7, 2}, {7, 11, 4, 3}, {11, 10, 9, 8}};
93 //const int FACE_EDGE_INDS[6][4] =
94 // {{0, 1, 2, 3}, {4, 8, 5, 0}, {5, 9, 6, 1},
95 // {6, 10, 7, 2}, {3, 7, 11, 4}, {11, 10, 9, 8}};
96 
98 const int FACE_CONTAINS_EDGE[][12] = {{1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
99  {1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0},
100  {0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0},
101  {0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
102  {0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1},
103  {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}};
104 
106 
109 const int EDGE_FROM_VRTS[8][8] =
110  {{-1, 0, -1, 3, 4, -1, -1, -1}, {0, -1, 1, -1, -1, 5, -1, -1},
111  {-1, 1, -1, 2, -1, -1, 6, -1}, {3, -1, 2, -1, -1, -1, -1, 7},
112  {4, -1, -1, -1, -1, 8, -1, 11}, {-1, 5, -1, -1, 8, -1, 9, -1},
113  {-1, -1, 6, -1, -1, 9, -1, 10}, {-1, -1, -1, 7, 11, -1, 10, -1}};
114 
116 
119 const int FACE_FROM_VRTS[8][8][8] =
120  {{{-1, -1, -1, -1, -1, -1, -1, -1}, {-1, -1, 0, 0, 1, 1, -1, -1},
121  {-1, 0, -1, 0, -1, -1, -1, -1}, {-1, 0, 0, -1, 4, -1, -1, 4},
122  {-1, 1, -1, 4, -1, 1, -1, 4}, {-1, 1, -1, -1, 1, -1, -1, -1},
123  {-1, -1, -1, -1, -1, -1, -1, -1}, {-1, -1, -1, 4, 4, -1, -1, -1}},
124  {{-1, -1, 0, 0, 1, 1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1, -1},
125  {0, -1, -1, 0, -1, 2, 2, -1}, {0, -1, 0, -1, -1, -1, -1, -1},
126  {1, -1, -1, -1, -1, 1, -1, -1}, {1, -1, 2, -1, 1, -1, 2, -1},
127  {-1, -1, 2, -1, -1, 2, -1, -1}, {-1, -1, -1, -1, -1, -1, -1, -1}},
128  {{-1, 0, -1, 0, -1, -1, -1, -1}, {0, -1, -1, 0, -1, 2, 2, -1},
129  {-1, -1, -1, -1, -1, -1, -1, -1}, {0, 0, -1, -1, -1, -1, 3, 3},
130  {-1, -1, -1, -1, -1, -1, -1, -1}, {-1, 2, -1, -1, -1, -1, 2, -1},
131  {-1, 2, -1, 3, -1, 2, -1, 3}, {-1, -1, -1, 3, -1, -1, 3, -1}},
132  {{-1, 0, 0, -1, 4, -1, -1, 4}, {0, -1, 0, -1, -1, -1, -1, -1},
133  {0, 0, -1, -1, -1, -1, 3, 3}, {-1, -1, -1, -1, -1, -1, -1, -1},
134  {4, -1, -1, -1, -1, -1, -1, 4}, {-1, -1, -1, -1, -1, -1, -1, -1},
135  {-1, -1, 3, -1, -1, -1, -1, 3}, {4, -1, 3, -1, 4, -1, 3, -1}},
136  {{-1, 1, -1, 4, -1, 1, -1, 4}, {1, -1, -1, -1, -1, 1, -1, -1},
137  {-1, -1, -1, -1, -1, -1, -1, -1}, {4, -1, -1, -1, -1, -1, -1, 4},
138  {-1, -1, -1, -1, -1, -1, -1, -1}, {1, 1, -1, -1, -1, -1, 5, 5},
139  {-1, -1, -1, -1, -1, 5, -1, 5}, {4, -1, -1, 4, -1, 5, 5, -1}},
140  {{-1, 1, -1, -1, 1, -1, -1, -1}, {1, -1, 2, -1, 1, -1, 2, -1},
141  {-1, 2, -1, -1, -1, -1, 2, -1}, {-1, -1, -1, -1, -1, -1, -1, -1},
142  {1, 1, -1, -1, -1, -1, 5, 5}, {-1, -1, -1, -1, -1, -1, -1, -1},
143  {-1, 2, 2, -1, 5, -1, -1, 5}, {-1, -1, -1, -1, 5, -1, 5, -1}},
144  {{-1, -1, -1, -1, -1, -1, -1, -1}, {-1, -1, 2, -1, -1, 2, -1, -1},
145  {-1, 2, -1, 3, -1, 2, -1, 3}, {-1, -1, 3, -1, -1, -1, -1, 3},
146  {-1, -1, -1, -1, -1, 5, -1, 5}, {-1, 2, 2, -1, 5, -1, -1, 5},
147  {-1, -1, -1, -1, -1, -1, -1, -1}, {-1, -1, 3, 3, 5, 5, -1, -1}},
148  {{-1, -1, -1, 4, 4, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1, -1},
149  {-1, -1, -1, 3, -1, -1, 3, -1}, {4, -1, 3, -1, 4, -1, 3, -1},
150  {4, -1, -1, 4, -1, 5, 5, -1}, {-1, -1, -1, -1, 5, -1, 5, -1},
151  {-1, -1, 3, 3, 5, 5, -1, -1}, {-1, -1, -1, -1, -1, -1, -1, -1}}};
152 
154 const int FACE_FROM_EDGES[][12] = {{0, 0, 0, 0, 1, 1, -1, -1, 1, -1, -1, -1},
155  {0, 0, 0, 0, -1, 2, 2, -1, -1, 2, -1, -1},
156  {0, 0, 0, 0, -1, -1, 3, 3, -1, -1, 3, -1},
157  {0, 0, 0, 0, 4, -1, -1, 4, -1, -1, -1, 4},
158  {1, -1, -1, 4, 1, 1, -1, 4, 1, -1, -1, 4},
159  {1, 2, -1, -1, 1, 1, 2, -1, 1, 2, -1, -1},
160  {-1, 2, 3, -1, -1, 2, 2, 3, -1, 2, 3, -1},
161  {-1, -1, 3, 4, 4, -1, 3, 3, -1, -1, 3, 4},
162  {1, -1, -1, -1, 1, 1, -1, -1, 1, 5, 5, 5},
163  {-1, 2, -1, -1, -1, 2, 2, -1, 5, 2, 5, 5},
164  {-1, -1, 3, -1, -1, -1, 3, 3, 5, 5, 3, 5},
165  {-1, -1, -1, 4, 4, -1, -1, 4, 5, 5, 5, 4}};
166 
167 
170 
212 int Refine(int* newIndsOut, int* newEdgeVrts, bool& newCenterOut,
213  vector3* corners = NULL, bool* isSnapPoint = NULL);
214 
215 
217 
229 bool IsRegularRefRule(const int edgeMarks);
230 
231 }// end of namespace
232 }// end of namespace
233 
234 #endif
const int FACE_EDGE_INDS[6][4]
returns the j-th edge of the i-th face
Definition: hexahedron_rules.h:90
const int NUM_QUADS
Definition: hexahedron_rules.h:49
const int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: hexahedron_rules.h:51
const int EDGE_FROM_VRTS[8][8]
Associates the index of the connecting edge with each tuple of vertices.
Definition: hexahedron_rules.h:109
const int NUM_FACES
Definition: hexahedron_rules.h:47
const int MAX_NUM_INDS_OUT
Definition: hexahedron_rules.h:50
const int FACE_CONTAINS_EDGE[][12]
tells whether the i-th face contains the j-th edge
Definition: hexahedron_rules.h:98
const int FACE_FROM_VRTS[8][8][8]
Associates the index of the connecting face with each triple of vertices.
Definition: hexahedron_rules.h:119
int Refine(int *newIndsOut, int *newEdgeVrts, bool &newCenterOut, vector3 *, bool *isSnapPoint)
Definition: hexahedron_rules.cpp:51
const int FACE_VRT_INDS[][4]
the local vertex indices of the given face
Definition: hexahedron_rules.h:59
const int OPPOSED_FACE[NUM_FACES]
contains the index of the opposed face of each face
Definition: hexahedron_rules.h:65
bool IsRegularRefRule(const int edgeMarks)
returns true if the specified edgeMarks would lead to a regular refinement
Definition: hexahedron_rules.cpp:460
const int NUM_TRIS
Definition: hexahedron_rules.h:48
const int NUM_EDGES
Definition: hexahedron_rules.h:46
const int OPPOSED_FACE_VRT_INDS[][4]
vertex indices of the face on the opposite side of the i-th face.
Definition: hexahedron_rules.h:72
const int OPPOSED_OBJECT[][NUM_VERTICES]
Definition: hexahedron_rules.h:81
const int EDGE_VRT_INDS[][2]
the local vertex indices of the given edge
Definition: hexahedron_rules.h:54
const int NUM_VERTICES
Definition: hexahedron_rules.h:45
const int FACE_FROM_EDGES[][12]
given two edges, the table returns the face, which contains both (or -1)
Definition: hexahedron_rules.h:154
the ug namespace
typedefs for ugmath