Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/src/t8_element_shape.c
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) 2015 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
#include <t8_element_shape.h>
24
25
const int t8_element_shape_max_num_corner[T8_ECLASS_MAX_DIM + 1] = { 0, 2, 4, 8 };
26
27
/** The number of codimension-one boundaries of an element class. */
28
int
29
t8_element_shape_num_faces (int element_shape)
30
{
31
return t8_eclass_num_faces[element_shape];
32
}
33
34
/** For each dimension the maximum possible number of faces of an element_shape of that dimension. */
35
int
36
t8_element_shape_max_num_faces (int element_shape)
37
{
38
return t8_eclass_max_num_faces[element_shape];
39
}
40
41
/** The number of vertices of an element class. */
42
int
43
t8_element_shape_num_vertices (int element_shape)
44
{
45
return t8_eclass_num_vertices[element_shape];
46
}
47
48
/** The vtk cell type for the element_shape */
49
int
50
t8_element_shape_vtk_type (int element_shape)
51
{
52
return t8_eclass_vtk_type[element_shape];
53
}
54
55
/** Maps the t8code corner number of the element to the vtk corner number
56
* \param [in] element_shape The shape of the element.
57
* \param [in] index The index of the corner in z-order (t8code numeration).
58
* \return The corresponding vtk index.
59
*/
60
int
61
t8_element_shape_t8_to_vtk_corner_number (int element_shape, int index)
62
{
63
return t8_eclass_t8_to_vtk_corner_number[element_shape][index];
64
}
65
66
/** Maps the vtk corner number of the element to the t8code corner number
67
* \param [in] element_shape The shape of the element.
68
* \param [in] index The index of the corner in vtk ordering.
69
* \return The corresponding t8code index.
70
*/
71
int
72
t8_element_shape_vtk_to_t8_corner_number (int element_shape, int index)
73
{
74
return t8_eclass_vtk_to_t8_corner_number[element_shape][index];
75
}
76
77
/** For each element_shape, the name of this class as a string */
78
const char*
79
t8_element_shape_to_string (int element_shape)
80
{
81
return t8_eclass_to_string[element_shape];
82
}
83
84
/* Currently t8_element_shape equals t8_eclass, if they will differ, this function has to be adapted. */
85
int
86
t8_element_shape_compare (t8_element_shape_t element_shape1, t8_element_shape_t element_shape2)
87
{
88
return t8_eclass_compare ((t8_eclass_t) element_shape1, (t8_eclass_t) element_shape2);
89
}
90
91