Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/src/t8_eclass.h
898 views
1
/*
2
This file is part of t8code.
3
t8code is a C library to manage a collection (a forest) of multiple
4
connected adaptive space-trees of general element classes in parallel.
5
6
Copyright (C) 2025 the developers
7
8
t8code is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
13
t8code is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with t8code; if not, write to the Free Software Foundation, Inc.,
20
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*/
22
23
/** \file t8_eclass.h
24
* We define all possible element classes that occur in hybrid meshes.
25
*
26
* Notable examples are triangles, tetrahedra, quadrilaterals and hexahedra.
27
* We cover all dimensions between zero and three, so it is in principal
28
* possible to build a topological complex out of these element classes.
29
*
30
* This file contains C and CPP definitions. Since C does not support constexpr
31
* everything is defined once and then declared twice.
32
*/
33
34
#ifndef T8_ECLASS_H
35
#define T8_ECLASS_H
36
37
#include <t8.h>
38
39
/** We want to export the whole implementation to be callable from "C". */
40
T8_EXTERN_C_BEGIN ();
41
42
/** This enumeration contains all possible element classes. */
43
typedef enum t8_eclass {
44
/** Zero-dimensional element class. */
45
T8_ECLASS_ZERO = 0,
46
/** The vertex is the only zero-dimensional element class. */
47
T8_ECLASS_VERTEX = T8_ECLASS_ZERO,
48
/** The line is the only one-dimensional element class. */
49
T8_ECLASS_LINE,
50
/** The quadrilateral is one of two element classes in two dimensions. */
51
T8_ECLASS_QUAD,
52
/** The element class for a triangle. */
53
T8_ECLASS_TRIANGLE,
54
/** The hexahedron is one three-dimensional element class. */
55
T8_ECLASS_HEX,
56
/** The tetrahedron is another three-dimensional element class. */
57
T8_ECLASS_TET,
58
/** The prism has five sides: two opposing triangles joined by three quadrilaterals. */
59
T8_ECLASS_PRISM,
60
/** The pyramid has a quadrilateral as base and four triangles as sides. */
61
T8_ECLASS_PYRAMID,
62
/** This is no element class but can be used as the number of element classes. */
63
T8_ECLASS_COUNT,
64
/** This is no element class but can be used for the case a class of a third party library is not supported by t8code*/
65
T8_ECLASS_INVALID
66
} t8_eclass_t;
67
68
/** The MPI datatype used for t8_eclass_t */
69
#define T8_MPI_ECLASS_TYPE (T8_ASSERT (sizeof (int) == sizeof (t8_eclass_t)), sc_MPI_INT)
70
71
/** The maximum number of boundary faces an element class can have. */
72
#define T8_ECLASS_MAX_FACES 6
73
/** The maximum number of boundary edges an element class can have. */
74
#define T8_ECLASS_MAX_EDGES 12
75
/** The maximum number of boundary edges a 2D element class can have. */
76
#define T8_ECLASS_MAX_EDGES_2D 4
77
/** The maximum number of corners a 2-dimensional element class can have. */
78
#define T8_ECLASS_MAX_CORNERS_2D 4
79
/** The maximum number of corners an element class can have. */
80
#define T8_ECLASS_MAX_CORNERS 8
81
/** The maximal possible dimension for an eclass */
82
#define T8_ECLASS_MAX_DIM 3
83
/** The maximal number of children any element may have.*/
84
#define T8_ECLASS_MAX_CHILDREN 10
85
86
/* clang-format off */
87
88
/** Define eclass values at a single point to use them for c and cpp. */
89
/** Dimension of each eclass. */
90
#define T8_ECLASS_TO_DIMENSION_VALUES { 0, 1, 2, 2, 3, 3, 3, 3 }
91
/** Number of faces of each eclass. */
92
#define T8_ECLASS_NUM_FACES_VALUES { 0, 2, 4, 3, 6, 4, 5, 5 }
93
/** Maximum number of faces of each eclass. */
94
#define T8_ECLASS_MAX_NUM_FACES_VALUES { 0, 2, 4, 6 }
95
/** Maximum number of children of each eclass. */
96
#define T8_ECLASS_MAX_NUM_CHILDREN_VALUES { 1, 2, 4, 4, 8, 8, 8, 10 }
97
/** Mapping of face vertex to tree vertex for each eclass. */
98
#define T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES {\
99
{ { -1 } }, /* vertex */ \
100
{ { 0 }, { 1 } }, /* line */ \
101
{ { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 } }, /* quad */ \
102
{ { 1, 2 }, { 0, 2 }, { 0, 1 } }, /* triangle */ \
103
{ { 0, 2, 4, 6 }, { 1, 3, 5, 7 }, { 0, 1, 4, 5 }, { 2, 3, 6, 7 }, { 0, 1, 2, 3 }, { 4, 5, 6, 7 } }, /* hex */ \
104
{ { 1, 2, 3 }, { 0, 2, 3 }, { 0, 1, 3 }, { 0, 1, 2 } }, /* tet */ \
105
{ { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ \
106
{ { 0, 2, 4 }, { 1, 3, 4 }, { 0, 1, 4 }, { 2, 3, 4 }, { 0, 1, 2, 3 } } /* pyramid */ \
107
}
108
/** Mapping of face edge to tree edge for each eclass. */
109
#define T8_FACE_EDGE_TO_TREE_EDGE_VALUES {\
110
{ { -1 } }, /* vertex */ \
111
{ { 0 } }, /* line */ \
112
{ { 0 }, { 1 }, { 2 }, { 3 } }, /* quad */ \
113
{ { 0 }, { 1 }, { 2 } }, /* triangle */ \
114
{ { 8, 10, 4, 6 }, { 9, 11, 5, 7 }, { 8, 9, 0, 2 }, { 10, 11, 1, 3 }, { 4, 5, 0, 1 }, { 6, 7, 2, 3 } }, /* hex */ \
115
{ { 3, 4, 5 }, { 1, 2, 5 }, { 0, 2, 4 }, { 0, 1, 3 } }, /* tet */ \
116
{ { 0, 7, 3, 6 }, { 1, 8, 4, 7 }, { 2, 6, 5, 8 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ \
117
{ { -1 } }, /* pyramid */ \
118
}
119
/** Mapping of face to edge neighbor for each eclass. */
120
#define T8_FACE_TO_EDGE_NEIGHBOR_VALUES {\
121
{ { -1 } }, /* vertex */ \
122
{ { -1 } }, /* line */ \
123
{ { 2, 3 }, { 2, 3 }, { 0, 1 }, { 0, 1 } }, /* quad */ \
124
{ { 2, 1 }, { 2, 0 }, { 1, 0 } }, /* triangle */ \
125
{ { 0, 1, 2, 3 }, { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 8, 9, 10, 11 } }, /* hex */ \
126
{ { 0, 1, 2 }, { 0, 3, 4 }, { 1, 3, 5 }, { 2, 4, 5 } }, /* tet */ \
127
{ { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ \
128
{ { -1 } }, /* pyramid */ \
129
}
130
/** Mapping of edge vertex to tree vertex for each eclass. */
131
#define T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES {\
132
{ { -1 } }, /* vertex */ \
133
{ { 0 }, { 1 } }, /* line */ \
134
{ { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 } }, /* quad */ \
135
{ { 1, 2 }, { 0, 2 }, { 0, 1 } }, /* triangle */ \
136
{ { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 0, 2 }, { 1, 3 }, { 4, 6 }, { 5, 7 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }, /* hex */ \
137
{ { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ \
138
{ { 1, 2 }, { 0, 2 }, { 0, 1 }, { 4, 5 }, { 3, 5 }, { 3, 4 }, { 1, 4 }, { 2, 5 }, { 0, 3 } }, /* prism */ \
139
{ { -1 } }, /* pyramid */ \
140
}
141
/** Mapping of edge to face for each eclass. */
142
#define T8_EDGE_TO_FACE_VALUES {\
143
{ { -1 } }, /* vertex */ \
144
{ { 0 } }, /* line */ \
145
{ { 0 }, { 1 }, { 2 }, { 3 } }, /* quad */ \
146
{ { 0 }, { 1 }, { 2 } }, /* triangle */ \
147
{ { 2, 4 }, { 3, 4 }, { 2, 5 }, { 3, 5 }, { 0, 4 }, { 1, 4 }, { 0, 5 }, { 1, 5 }, { 0, 2 }, { 1, 2 }, { 0, 3 }, { 1, 3 } }, /* hex */ \
148
{ { 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 } }, /* tet */ \
149
{ { 0, 3 }, { 1, 3 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 2, 4 }, { 0, 2 }, { 0, 1 }, { 1, 2 } }, /* prism */ \
150
{ { -1 } }, /* pyramid */ \
151
}
152
/** Face orientation values for each eclass. */
153
#define T8_ECLASS_FACE_ORIENTATION_VALUES {\
154
{ 0, -1, -1, -1, -1, -1 }, /* vertex */ \
155
{ 0, 0, -1, -1, -1, -1 }, /* line */ \
156
{ 0, 0, 0, 0, -1, -1 }, /* quad */ \
157
{ 0, 0, 0, -1, -1, -1 }, /* triangle */ \
158
{ 0, 1, 1, 0, 0, 1 }, /* hex */ \
159
{ 0, 1, 0, 1, -1, -1 }, /* tet */ \
160
{ 1, 0, 1, 0, 1, -1 }, /* prism */ \
161
{ 0, 1, 1, 0, 0, -1 } /* pyramid */ \
162
}
163
/** The reference faces of normal tets. */
164
#define T8_REFERENCE_FACE_NORMAL_TET_VALUES { { -1, 0, 0 }, { 1, 0, -1 }, { 0, -1, 1 }, { 0, 1, 0 } }
165
166
/** Number of vertices for each eclass. */
167
#define T8_ECLASS_NUM_VERTICES_VALUES { 1, 2, 4, 3, 8, 4, 6, 5 }
168
/** Number of edges for each eclass. */
169
#define T8_ECLASS_NUM_EDGES_VALUES { 0, 1, 4, 3, 12, 6, 9, 8 }
170
/** VTK type for each eclass. */
171
#define T8_ECLASS_VTK_TYPE_VALUES { 1, 3, 9, 5, 12, 10, 13, 14 }
172
/** Mapping of vtk to t8code corner numbers for each eclass. */
173
#define T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES {\
174
{ 0, -1, -1, -1, -1, -1, -1, -1 }, /* vertex */ \
175
{ 0, 1, -1, -1, -1, -1, -1, -1 }, /* line */ \
176
{ 0, 1, 3, 2, -1, -1, -1, -1 }, /* quad */ \
177
{ 0, 1, 2, -1, -1, -1, -1, -1 }, /* triangle */ \
178
{ 0, 1, 3, 2, 4, 5, 7, 6 }, /* hex */ \
179
{ 0, 2, 1, 3, -1, -1, -1, -1 }, /* tet */ \
180
{ 0, 2, 1, 3, 5, 4, -1, -1 }, /* prism */ \
181
{ 0, 1, 3, 2, 4, -1, -1, -1 } /* pyramid */ \
182
}
183
/** Mapping of t8code to vtk corner numbers for each eclass. */
184
#define T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES {\
185
{ 0, -1, -1, -1, -1, -1, -1, -1 }, /* vertex */ \
186
{ 0, 1, -1, -1, -1, -1, -1, -1 }, /* line */ \
187
{ 0, 1, 3, 2, -1, -1, -1, -1 }, /* quad */ \
188
{ 0, 1, 2, -1, -1, -1, -1, -1 }, /* triangle */ \
189
{ 0, 1, 3, 2, 4, 5, 7, 6 }, /* hex */ \
190
{ 0, 2, 1, 3, -1, -1, -1, -1 }, /* tet */ \
191
{ 0, 2, 1, 3, 5, 4, -1, -1 }, /* prism */ \
192
{ 0, 1, 3, 2, 4, -1, -1, -1 } /* pyramid */ \
193
}
194
/** The face type for each eclass. */
195
#define T8_ECLASS_FACE_TYPES_VALUES {\
196
{ -1, -1, -1, -1, -1, -1 }, /* vertex */ \
197
{ 0, 0, -1, -1, -1, -1 }, /* line */ \
198
{ 1, 1, 1, 1, -1, -1 }, /* quad */ \
199
{ 1, 1, 1, -1, -1, -1 }, /* triangle */ \
200
{ 2, 2, 2, 2, 2, 2 }, /* hex */ \
201
{ 3, 3, 3, 3, -1, -1 }, /* tet */ \
202
{ 2, 2, 2, 3, 3, -1 }, /* prism */ \
203
{ 3, 3, 3, 3, 2, -1 } /* pyramid */ \
204
}
205
/** Number of boundaries for each eclass. */
206
#define T8_ECLASS_BOUNDARY_COUNT_VALUES {\
207
{ 0, 0, 0, 0, 0, 0, 0, 0 }, /* vertex */ \
208
{ 2, 0, 0, 0, 0, 0, 0, 0 }, /* line */ \
209
{ 4, 4, 0, 0, 0, 0, 0, 0 }, /* quad */ \
210
{ 3, 3, 0, 0, 0, 0, 0, 0 }, /* triangle */ \
211
{ 8, 12, 6, 0, 0, 0, 0, 0 }, /* hex */ \
212
{ 4, 6, 0, 4, 0, 0, 0, 0 }, /* tet */ \
213
{ 6, 9, 3, 2, 0, 0, 0, 0 }, /* prism */ \
214
{ 5, 8, 1, 4, 0, 0, 0, 0 } /* pyramid */ \
215
}
216
/** String for each eclass. */
217
#define T8_ECLASS_TO_STRING_VALUES { "Vertex", "Line", "Quad", "Triangle", "Hex", "Tet", "Prism", "Pyramid", "Invalid" }
218
219
/* clang-format on */
220
221
#ifdef __cplusplus
222
/* constexpr variables for cpp. They are wrapped in a namespace to have a different symbol
223
* as the C variables. The namespace also gets activated for all files which are compiled
224
* by a cpp compiler. This is necessary, because this header will be compiled by a C and CPP
225
* compiler and will be linked into the same library. And the same library cannot contain
226
* the same symbol twice. T8_EXTERN_C is disabled, because it disables the namespace.*/
227
228
T8_EXTERN_C_END ();
229
230
namespace t8cpp
231
{
232
/** Map each of the element classes to its dimension. */
233
inline constexpr int t8_eclass_to_dimension[T8_ECLASS_COUNT] = T8_ECLASS_TO_DIMENSION_VALUES;
234
235
/** The number of codimension-one boundaries of an element class. */
236
inline constexpr int t8_eclass_num_faces[T8_ECLASS_COUNT] = T8_ECLASS_NUM_FACES_VALUES;
237
238
/** For each dimension the maximum possible number of faces of an eclass of that dimension. */
239
inline constexpr int t8_eclass_max_num_faces[T8_ECLASS_MAX_DIM + 1] = T8_ECLASS_MAX_NUM_FACES_VALUES;
240
241
/** The max number of children for each eclass */
242
inline constexpr int t8_eclass_max_num_children[T8_ECLASS_COUNT] = T8_ECLASS_MAX_NUM_CHILDREN_VALUES;
243
244
/** For each eclass and each face f the entry i gives the vertex number
245
* of f's i-th vertex within all vertices of the tree. */
246
inline constexpr int t8_face_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D]
247
= T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES;
248
249
/** For each eclass and each face f the entry i gives the edge number
250
* of f's i-th edge within all edges of the tree. */
251
inline constexpr int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_EDGES_2D]
252
= T8_FACE_EDGE_TO_TREE_EDGE_VALUES;
253
254
/** For each eclass, each face f and the face vertex v, we get the edge number
255
* of the tree which is incident to vertex v but not part of f. */
256
inline constexpr int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D]
257
= T8_FACE_TO_EDGE_NEIGHBOR_VALUES;
258
259
/** For each eclass and each edge e the entry i gives the vertex number
260
* of e's i-th vertex within all vertices of the tree. */
261
inline constexpr int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2]
262
= T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES;
263
264
/** For each eclass and each edge e the entry i gives the face number
265
* of e's i-th incident face within all faces of the tree. */
266
inline constexpr int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = T8_EDGE_TO_FACE_VALUES;
267
268
/** Each face is either 0 or 1 oriented, depending on the order of its vertices.
269
* We say a face is 0 oriented, if its normal vector points inwards,
270
* 1 oriented otherwise.
271
* The normal vector is computed as the cross product of v_1 - v_0 and v_2 - v_0.
272
* v_i being the i-th vertex.
273
* The faces of an eclass of dimension 2 or lower are all 0 oriented.
274
* Invalid values return -1.
275
*/
276
inline constexpr int t8_eclass_face_orientation[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES]
277
= T8_ECLASS_FACE_ORIENTATION_VALUES;
278
279
/** The direction of the normal of each face of a tetrahedron. */
280
inline constexpr int t8_reference_face_normal_tet[T8_ECLASS_MAX_FACES][3] = T8_REFERENCE_FACE_NORMAL_TET_VALUES;
281
282
/** The number of vertices of an element class. */
283
inline constexpr int t8_eclass_num_vertices[T8_ECLASS_COUNT] = T8_ECLASS_NUM_VERTICES_VALUES;
284
285
/** The number of edges of an element class. */
286
inline constexpr int t8_eclass_num_edges[T8_ECLASS_COUNT] = T8_ECLASS_NUM_EDGES_VALUES;
287
288
/** The vtk cell type for the eclass */
289
inline constexpr int t8_eclass_vtk_type[T8_ECLASS_COUNT] = T8_ECLASS_VTK_TYPE_VALUES;
290
291
/** Map the vtk corner number to the t8 corner number.
292
* Invalid values return -1. */
293
inline constexpr int t8_eclass_vtk_to_t8_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS]
294
= T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES;
295
296
/** Map the t8code corner number to the vtk corner number.
297
* Invalid values return -1.
298
*/
299
inline constexpr int t8_eclass_t8_to_vtk_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS]
300
= T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES;
301
302
/** For each of the element classes, list the type of the faces.
303
* Invalid values return -1. */
304
inline constexpr int t8_eclass_face_types[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES] = T8_ECLASS_FACE_TYPES_VALUES;
305
306
/** For each of the element classes, count the boundary points. */
307
inline constexpr int t8_eclass_boundary_count[T8_ECLASS_COUNT][T8_ECLASS_COUNT] = T8_ECLASS_BOUNDARY_COUNT_VALUES;
308
309
/** For each eclass, the name of this class as a string */
310
inline constexpr const char *t8_eclass_to_string[T8_ECLASS_INVALID] = T8_ECLASS_TO_STRING_VALUES;
311
} /* namespace t8cpp */
312
313
using namespace t8cpp;
314
315
T8_EXTERN_C_BEGIN ();
316
317
#else /*!__cplusplus*/
318
319
/* extern variables for c. */
320
321
/** Map each of the element classes to its dimension. */
322
extern const int t8_eclass_to_dimension[T8_ECLASS_COUNT];
323
324
/** The number of codimension-one boundaries of an element class. */
325
extern const int t8_eclass_num_faces[T8_ECLASS_COUNT];
326
327
/** For each dimension the maximum possible number of faces of an eclass of that dimension. */
328
extern const int t8_eclass_max_num_faces[T8_ECLASS_MAX_DIM + 1];
329
330
/** The max number of children for each eclass */
331
extern const int t8_eclass_max_num_children[T8_ECLASS_COUNT];
332
333
/** For each eclass and each face f the entry i gives the vertex number
334
* of f's i-th vertex within all vertices of the tree. */
335
extern const int t8_face_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D];
336
337
/** For each eclass and each face f the entry i gives the edge number
338
* of f's i-th edge within all edges of the tree. */
339
extern const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_EDGES_2D];
340
341
/** For each eclass, each face f and the face vertex v, we get the edge number
342
* of the tree which is incident to vertex v but not part of f. */
343
extern const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D];
344
345
/** For each eclass and each edge e the entry i gives the vertex number
346
* of e's i-th vertex within all vertices of the tree. */
347
extern const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2];
348
349
/** For each eclass and each edge e the entry i gives the face number
350
* of e's i-th incident face within all faces of the tree. */
351
extern const int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2];
352
353
/** Each face is either 0 or 1 oriented, depending on the order of its vertices.
354
* We say a face is 0 oriented, if its normal vector points inwards,
355
* 1 oriented otherwise.
356
* The normal vector is computed as the cross product of v_1 - v_0 and v_2 - v_0.
357
* v_i being the i-th vertex.
358
* The faces of an eclass of dimension 2 or lower are all 0 oriented.
359
* Invalid values return -1.
360
*/
361
extern const int t8_eclass_face_orientation[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES];
362
363
/** The direction of the normal of each face of a tetrahedron. */
364
extern const int t8_reference_face_normal_tet[T8_ECLASS_MAX_FACES][3];
365
366
/** The number of vertices of an element class. */
367
extern const int t8_eclass_num_vertices[T8_ECLASS_COUNT];
368
369
/** The number of edges of an element class. */
370
extern const int t8_eclass_num_edges[T8_ECLASS_COUNT];
371
372
/** The vtk cell type for the eclass */
373
extern const int t8_eclass_vtk_type[T8_ECLASS_COUNT];
374
375
/** Map the vtk corner number to the t8 corner number.
376
* Invalid values return -1. */
377
extern const int t8_eclass_vtk_to_t8_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS];
378
379
/** Map the t8code corner number to the vtk corner number.
380
* Invalid values return -1. */
381
extern const int t8_eclass_t8_to_vtk_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS];
382
383
/** For each of the element classes, list the type of the faces.
384
* Invalid values return -1. */
385
extern const int t8_eclass_face_types[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES];
386
387
/** For each of the element classes, count the boundary points. */
388
extern const int t8_eclass_boundary_count[T8_ECLASS_COUNT][T8_ECLASS_COUNT];
389
390
/** For each eclass, the name of this class as a string */
391
extern const char *t8_eclass_to_string[T8_ECLASS_INVALID];
392
393
#endif /* !__cplusplus */
394
395
/* Undefine values so that they do not leak into other files.
396
* They can be kept using KEEP_ECLASS_VALUE_DEFINITIONS. This is needed
397
* to use them in the eclass.c file. */
398
#ifndef KEEP_ECLASS_VALUE_DEFINITIONS
399
400
#undef T8_ECLASS_TO_DIMENSION_VALUES
401
#undef T8_ECLASS_NUM_FACES_VALUES
402
#undef T8_ECLASS_MAX_NUM_FACES_VALUES
403
#undef T8_ECLASS_MAX_NUM_CHILDREN_VALUES
404
#undef T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES
405
#undef T8_FACE_EDGE_TO_TREE_EDGE_VALUES
406
#undef T8_FACE_TO_EDGE_NEIGHBOR_VALUES
407
#undef T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES
408
#undef T8_EDGE_TO_FACE_VALUES
409
#undef T8_ECLASS_FACE_ORIENTATION_VALUES
410
#undef T8_REFERENCE_FACE_NORMAL_TET_VALUES
411
#undef T8_ECLASS_NUM_VERTICES_VALUES
412
#undef T8_ECLASS_NUM_EDGES_VALUES
413
#undef T8_ECLASS_VTK_TYPE_VALUES
414
#undef T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES
415
#undef T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES
416
#undef T8_ECLASS_FACE_TYPES_VALUES
417
#undef T8_ECLASS_BOUNDARY_COUNT_VALUES
418
#undef T8_ECLASS_TO_STRING_VALUES
419
420
#endif
421
422
/** Query the element class and count of boundary points.
423
* \param [in] theclass We query a point of this element class.
424
* \param [in] min_dim Ignore boundary points of lesser dimension.
425
* The ignored points get a count value of 0.
426
* \param [out] per_eclass Array of length T8_ECLASS_COUNT to be filled
427
* with the count of the boundary objects,
428
* counted per each of the element classes.
429
* \return The count over all boundary points.
430
*/
431
int
432
t8_eclass_count_boundary (t8_eclass_t theclass, int min_dim, int *per_eclass);
433
434
/** Compare two eclasses of the same dimension
435
* as necessary for face neighbor orientation.
436
* The implemented order is Triangle < Square in 2D and
437
* Tet < Hex < Prism < Pyramid in 3D.
438
* \param [in] eclass1 The first eclass to compare.
439
* \param [in] eclass2 The second eclass to compare.
440
* \return 0 if the eclasses are equal, 1 if eclass1 > eclass2
441
* and -1 if eclass1 < eclass2
442
*/
443
int
444
t8_eclass_compare (t8_eclass_t eclass1, t8_eclass_t eclass2);
445
446
/** Check whether a class is a valid class. Returns non-zero if it is a valid class,
447
* returns zero, if the class is equal to T8_ECLASS_INVALID.
448
*
449
* \param [in] eclass The eclass to check.
450
* \return Non-zero if \a eclass is valid, zero otherwise.
451
*/
452
int
453
t8_eclass_is_valid (t8_eclass_t eclass);
454
455
/** End of code that is callable from "C".*/
456
T8_EXTERN_C_END ();
457
458
#endif /* !T8_ELEMENT_H */
459
460