ug4
pyramid_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__pyramid_rules__
34 #define __H__UG__pyramid_rules__
35 
36 // only required for dummy-parameter ug::vector3*
38 
39 namespace ug{
40 namespace pyra_rules
41 {
42 
44 // LOOKUP TABLES
45 
46 const int NUM_VERTICES = 5;
47 const int NUM_EDGES = 8;
48 const int NUM_FACES = 5;
49 const int NUM_TRIS = 4;
50 const int NUM_QUADS = 1;
51 const int MAX_NUM_INDS_OUT = 128;//todo: this is just an estimate!
54 
56 const int EDGE_VRT_INDS[][2] = { {0, 1}, {1, 2}, {2, 3}, {3, 0},
57  {4, 0}, {4, 1}, {4, 2}, {4, 3}};
58 
60 const int FACE_VRT_INDS[][4] = { {0, 1, 2, 3}, {0, 4, 1, -1},
61  {1, 4, 2, -1}, {2, 4, 3, -1},
62  {0, 3, 4, -1}};
63 
65 const int TOP_VERTEX = 4;
66 
67 
71 const int OPPOSED_OBJECT[][NUM_VERTICES] = {{1, 6}, {1, 7}, {1, 4}, {1, 5}, {2, 0}};
72 
73 const int NUM_BOTTOM_EDGES = 4;
74 const int BOTTOM_EDGE_INDS[NUM_BOTTOM_EDGES] = {0, 1, 2, 3};
75 
76 const int NUM_TOP_EDGES = 4;
77 const int TOP_EDGE_INDS[NUM_BOTTOM_EDGES] = {4, 5, 6, 7};
78 
81 // NOTE: The lists below are all generated automatically
82 
84 const int FACE_EDGE_INDS[5][4] = {{0, 1, 2, 3}, {4, 5, 0, -1}, {5, 6, 1, -1},
85  {6, 7, 2, -1}, {3, 7, 4, -1}};
86 
88 const int FACE_CONTAINS_EDGE[][8] =
89  {{1, 1, 1, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 1, 1, 0, 0},
90  {0, 1, 0, 0, 0, 1, 1, 0}, {0, 0, 1, 0, 0, 0, 1, 1},
91  {0, 0, 0, 1, 1, 0, 0, 1}};
92 
94 
97 const int EDGE_FROM_VRTS[5][5] = {{-1, 0, -1, 3, 4}, {0, -1, 1, -1, 5},
98  {-1, 1, -1, 2, 6}, {3, -1, 2, -1, 7},
99  {4, 5, 6, 7, -1}};
100 
102 
105 const int FACE_FROM_VRTS[5][5][5] =
106  {{{-1, -1, -1, -1, -1}, {-1, -1, 0, 0, 1}, {-1, 0, -1, 0, -1},
107  {-1, 0, 0, -1, 4}, {-1, 1, -1, 4, -1}},
108  {{-1, -1, 0, 0, 1}, {-1, -1, -1, -1, -1}, {0, -1, -1, 0, 2},
109  {0, -1, 0, -1, -1}, {1, -1, 2, -1, -1}},
110  {{-1, 0, -1, 0, -1}, {0, -1, -1, 0, 2}, {-1, -1, -1, -1, -1},
111  {0, 0, -1, -1, 3}, {-1, 2, -1, 3, -1}},
112  {{-1, 0, 0, -1, 4}, {0, -1, 0, -1, -1}, {0, 0, -1, -1, 3},
113  {-1, -1, -1, -1, -1}, {4, -1, 3, -1, -1}},
114  {{-1, 1, -1, 4, -1}, {1, -1, 2, -1, -1}, {-1, 2, -1, 3, -1},
115  {4, -1, 3, -1, -1}, {-1, -1, -1, -1, -1}}};
116 
118 const int FACE_FROM_EDGES[][8] =
119  {{0, 0, 0, 0, 1, 1, -1, -1}, {0, 0, 0, 0, -1, 2, 2, -1},
120  {0, 0, 0, 0, -1, -1, 3, 3}, {0, 0, 0, 0, 4, -1, -1, 4},
121  {1, -1, -1, 4, 1, 1, -1, 4}, {1, 2, -1, -1, 1, 1, 2, -1},
122  {-1, 2, 3, -1, -1, 2, 2, 3}, {-1, -1, 3, 4, 4, -1, 3, 3}};
123 
124 
127 
169 int Refine(int* newIndsOut, int* newEdgeVrts, bool& newCenterOut,
170  vector3* corners = NULL, bool* isSnapPoint = NULL);
171 
172 
174 
186 bool IsRegularRefRule(const int edgeMarks);
187 
188 
190 
222 template <class TCmp>
223 int ConvertToTetrahedra(int* newIndsOut, TCmp cmp);
224 
225 
227 
237 int CollapseEdge(int* newIndsOut, int v0, int v1);
238 
239 }// end of namespace pyra_rules
240 }// end of namespace ug
241 
242 
244 // include implementation
245 #include "pyramid_rules_impl.h"
246 
247 #endif
const int NUM_EDGES
Definition: pyramid_rules.h:47
bool IsRegularRefRule(const int edgeMarks)
returns true if the specified edgeMarks would lead to a regular refinement
Definition: pyramid_rules.cpp:492
const int EDGE_FROM_VRTS[5][5]
Associates the index of the connecting edge with each tuple of vertices.
Definition: pyramid_rules.h:97
const int EDGE_VRT_INDS[][2]
the local vertex indices of the given edge
Definition: pyramid_rules.h:56
const int FACE_EDGE_INDS[5][4]
returns the j-th edge of the i-th face
Definition: pyramid_rules.h:84
const int NUM_TRIS
Definition: pyramid_rules.h:49
const int FACE_CONTAINS_EDGE[][8]
tells whether the i-th face contains the j-th edge
Definition: pyramid_rules.h:88
const int NUM_QUADS
Definition: pyramid_rules.h:50
const int NUM_BOTTOM_EDGES
Definition: pyramid_rules.h:73
const int FACE_FROM_VRTS[5][5][5]
Associates the index of the connecting face with each triple of vertices.
Definition: pyramid_rules.h:105
const int NUM_FACES
Definition: pyramid_rules.h:48
const int FACE_FROM_EDGES[][8]
given two edges, the table returns the face, which contains both (or -1)
Definition: pyramid_rules.h:118
const int MAX_NUM_COLLAPSE_INDS_OUT
Definition: pyramid_rules.h:53
const int NUM_VERTICES
Definition: pyramid_rules.h:46
const int OPPOSED_OBJECT[][NUM_VERTICES]
Definition: pyramid_rules.h:71
int ConvertToTetrahedra(int *newIndsOut, TCmp cmp)
fills an array of integers describing tetrahedra that shall replace the pyramid
Definition: pyramid_rules_impl.h:43
const int TOP_EDGE_INDS[NUM_BOTTOM_EDGES]
Definition: pyramid_rules.h:77
const int TOP_VERTEX
the pyramids top
Definition: pyramid_rules.h:65
const int NUM_TOP_EDGES
Definition: pyramid_rules.h:76
const int BOTTOM_EDGE_INDS[NUM_BOTTOM_EDGES]
Definition: pyramid_rules.h:74
int Refine(int *newIndsOut, int *newEdgeVrts, bool &newCenterOut, vector3 *, bool *isSnapPoint)
Definition: pyramid_rules.cpp:56
const int MAX_NUM_INDS_OUT
Definition: pyramid_rules.h:51
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: pyramid_rules.cpp:498
const int FACE_VRT_INDS[][4]
the local vertex indices of the given face
Definition: pyramid_rules.h:60
const int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: pyramid_rules.h:52
the ug namespace
typedefs for ugmath