ug4
prism_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__prism_rules__
34 #define __H__UG__prism_rules__
35 
36 // only required for dummy-parameter ug::vector3*
38 
39 namespace ug{
40 namespace prism_rules{
41 
43 // LOOKUP TABLES
44 
45 const int NUM_VERTICES = 6;
46 const int NUM_EDGES = 9;
47 const int NUM_FACES = 5;
48 const int NUM_TRIS = 2;
49 const int NUM_QUADS = 3;
50 const int MAX_NUM_INDS_OUT = 128;//todo: this is just an estimate!
53 
55 const int EDGE_VRT_INDS[][2] = { {0, 1}, {1, 2}, {2, 0},
56  {0, 3}, {1, 4}, {2, 5},
57  {3, 4}, {4, 5}, {5, 3}};
58 
60 const int FACE_VRT_INDS[][4] = { {0, 1, 2, -1}, {0, 3, 4, 1},
61 // {1, 4, 5, 2}, {0, 2, 5, 3},
62  {1, 4, 5, 2}, {2, 5, 3, 0},
63  {3, 5, 4, -1}};
64 
66 const int OPPOSED_FACE[NUM_FACES] = {4, -1, -1, -1, 0};
67 
68 
72 const int OPPOSED_OBJECT[][NUM_VERTICES] = {{1, 7}, {1, 8}, {1, 6}, {1, 1}, {1, 2}, {1, 0}};
73 
74 
76 // SOME HELPER TABLES
77 const int TOP_FACE = 4;
78 const int BOTTOM_FACE = 0;
79 
80 const int IS_BOTTOM_EDGE[9] = {1, 1, 1, 0, 0, 0, 0, 0, 0};
81 const int IS_SIDE_EDGE[9] = {0, 0, 0, 1, 1, 1, 0, 0, 0};
82 const int IS_TOP_EDGE[9] = {0, 0, 0, 0, 0, 0, 1, 1, 1};
83 
84 const int TRIS[2] = {0, 4};
85 const int QUADS[3] = {1, 2, 3};
86 
89 // NOTE: The lists below are all generated automatically
90 
92 const int FACE_EDGE_INDS[5][4] = {{0, 1, 2, -1}, {3, 6, 4, 0}, {4, 7, 5, 1},
93  {5, 8, 3, 2}, {8, 7, 6, -1}};
94 //const int FACE_EDGE_INDS[5][4] = {{0, 1, 2, -1}, {3, 6, 4, 0}, {4, 7, 5, 1},
95 // {2, 5, 8, 3}, {8, 7, 6, -1}};
96 
98 const int FACE_CONTAINS_EDGE[][9] =
99  {{1, 1, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 1, 0, 1, 0, 0},
100  {0, 1, 0, 0, 1, 1, 0, 1, 0}, {0, 0, 1, 1, 0, 1, 0, 0, 1},
101  {0, 0, 0, 0, 0, 0, 1, 1, 1}};
102 
104 
107 const int EDGE_FROM_VRTS[6][6] =
108  {{-1, 0, 2, 3, -1, -1}, {0, -1, 1, -1, 4, -1},
109  {2, 1, -1, -1, -1, 5}, {3, -1, -1, -1, 6, 8},
110  {-1, 4, -1, 6, -1, 7}, {-1, -1, 5, 8, 7, -1}};
111 
113 
116 const int FACE_FROM_VRTS[6][6][6] =
117  {{{-1, -1, -1, -1, -1, -1}, {-1, -1, 0, 1, 1, -1},
118  {-1, 0, -1, 3, -1, 3}, {-1, 1, 3, -1, 1, 3},
119  {-1, 1, -1, 1, -1, -1}, {-1, -1, 3, 3, -1, -1}},
120  {{-1, -1, 0, 1, 1, -1}, {-1, -1, -1, -1, -1, -1},
121  {0, -1, -1, -1, 2, 2}, {1, -1, -1, -1, 1, -1},
122  {1, -1, 2, 1, -1, 2}, {-1, -1, 2, -1, 2, -1}},
123  {{-1, 0, -1, 3, -1, 3}, {0, -1, -1, -1, 2, 2},
124  {-1, -1, -1, -1, -1, -1}, {3, -1, -1, -1, -1, 3},
125  {-1, 2, -1, -1, -1, 2}, {3, 2, -1, 3, 2, -1}},
126  {{-1, 1, 3, -1, 1, 3}, {1, -1, -1, -1, 1, -1},
127  {3, -1, -1, -1, -1, 3}, {-1, -1, -1, -1, -1, -1},
128  {1, 1, -1, -1, -1, 4}, {3, -1, 3, -1, 4, -1}},
129  {{-1, 1, -1, 1, -1, -1}, {1, -1, 2, 1, -1, 2},
130  {-1, 2, -1, -1, -1, 2}, {1, 1, -1, -1, -1, 4},
131  {-1, -1, -1, -1, -1, -1}, {-1, 2, 2, 4, -1, -1}},
132  {{-1, -1, 3, 3, -1, -1}, {-1, -1, 2, -1, 2, -1},
133  {3, 2, -1, 3, 2, -1}, {3, -1, 3, -1, 4, -1},
134  {-1, 2, 2, 4, -1, -1}, {-1, -1, -1, -1, -1, -1}}};
135 
137 const int FACE_FROM_EDGES[][9] =
138  {{0, 0, 0, 1, 1, -1, 1, -1, -1}, {0, 0, 0, -1, 2, 2, -1, 2, -1},
139  {0, 0, 0, 3, -1, 3, -1, -1, 3}, {1, -1, 3, 1, 1, 3, 1, -1, 3},
140  {1, 2, -1, 1, 1, 2, 1, 2, -1}, {-1, 2, 3, 3, 2, 2, -1, 2, 3},
141  {1, -1, -1, 1, 1, -1, 1, 4, 4}, {-1, 2, -1, -1, 2, 2, 4, 2, 4},
142  {-1, -1, 3, 3, -1, 3, 4, 4, 3}};
143 
146 
188 int Refine(int* newIndsOut, int* newEdgeVrts, bool& newCenterOut,
189  vector3* corners = NULL, bool* isSnapPoint = NULL);
190 
191 
193 
205 bool IsRegularRefRule(const int edgeMarks);
206 
207 
209 
241 template <class TCmp>
242 int ConvertToTetrahedra(int* newIndsOut, TCmp cmp);
243 
244 
246 
256 int CollapseEdge(int* newIndsOut, int v0, int v1);
257 
258 }// end of namespace
259 }// end of namespace
260 
262 // include implementation
263 #include "prism_rules_impl.h"
264 
265 #endif
const int NUM_VERTICES
Definition: prism_rules.h:45
const int BOTTOM_FACE
Definition: prism_rules.h:78
const int NUM_QUADS
Definition: prism_rules.h:49
const int FACE_CONTAINS_EDGE[][9]
tells whether the i-th face contains the j-th edge
Definition: prism_rules.h:98
const int NUM_EDGES
Definition: prism_rules.h:46
const int NUM_TRIS
Definition: prism_rules.h:48
int CollapseEdge(int *newIndsOut, int v0, int v1)
Creates new volume elements that result from collapsing the edge between v0 and v1 into v0.
Definition: prism_rules.cpp:612
const int MAX_NUM_COLLAPSE_INDS_OUT
Definition: prism_rules.h:52
int Refine(int *newIndsOut, int *newEdgeVrts, bool &newCenterOut, vector3 *, bool *isSnapPoint)
Definition: prism_rules.cpp:66
const int EDGE_VRT_INDS[][2]
the local vertex indices of the given edge
Definition: prism_rules.h:55
const int TRIS[2]
Definition: prism_rules.h:84
const int IS_SIDE_EDGE[9]
Definition: prism_rules.h:81
const int QUADS[3]
Definition: prism_rules.h:85
const int NUM_FACES
Definition: prism_rules.h:47
const int FACE_FROM_EDGES[][9]
given two edges, the table returns the face, which contains both (or -1)
Definition: prism_rules.h:137
int ConvertToTetrahedra(int *newIndsOut, TCmp cmp)
fills an array of integers describing tetrahedra that shall replace the prism
Definition: prism_rules_impl.h:43
const int IS_BOTTOM_EDGE[9]
Definition: prism_rules.h:80
const int OPPOSED_OBJECT[][NUM_VERTICES]
Definition: prism_rules.h:72
const int MAX_NUM_INDS_OUT
Definition: prism_rules.h:50
const int FACE_EDGE_INDS[5][4]
returns the j-th edge of the i-th face
Definition: prism_rules.h:92
const int IS_TOP_EDGE[9]
Definition: prism_rules.h:82
const int FACE_FROM_VRTS[6][6][6]
Associates the index of the connecting face with each triple of vertices.
Definition: prism_rules.h:116
const int EDGE_FROM_VRTS[6][6]
Associates the index of the connecting edge with each tuple of vertices.
Definition: prism_rules.h:107
const int OPPOSED_FACE[NUM_FACES]
the index of the face opposed to the given one. -1 if no face is opposed
Definition: prism_rules.h:66
const int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: prism_rules.h:51
const int FACE_VRT_INDS[][4]
the local vertex indices of the given face
Definition: prism_rules.h:60
const int TOP_FACE
Definition: prism_rules.h:77
bool IsRegularRefRule(const int edgeMarks)
returns true if the specified edgeMarks would lead to a regular refinement
Definition: prism_rules.cpp:642
the ug namespace
typedefs for ugmath