#define KEEP_ECLASS_VALUE_DEFINITIONS
#include <t8_eclass.h>
#undef KEEP_ECLASS_VALUE_DEFINITIONS
const int t8_eclass_to_dimension[T8_ECLASS_COUNT] = T8_ECLASS_TO_DIMENSION_VALUES;
const int t8_eclass_num_faces[T8_ECLASS_COUNT] = T8_ECLASS_NUM_FACES_VALUES;
const int t8_eclass_max_num_faces[T8_ECLASS_MAX_DIM + 1] = T8_ECLASS_MAX_NUM_FACES_VALUES;
const int t8_eclass_max_num_children[T8_ECLASS_COUNT] = T8_ECLASS_MAX_NUM_CHILDREN_VALUES;
const int t8_face_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D]
= T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES;
const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_EDGES_2D]
= T8_FACE_EDGE_TO_TREE_EDGE_VALUES;
const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D]
= T8_FACE_TO_EDGE_NEIGHBOR_VALUES;
const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES;
const int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = T8_EDGE_TO_FACE_VALUES;
const int t8_eclass_face_orientation[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES] = T8_ECLASS_FACE_ORIENTATION_VALUES;
const int t8_reference_face_normal_tet[T8_ECLASS_MAX_FACES][3] = T8_REFERENCE_FACE_NORMAL_TET_VALUES;
const int t8_eclass_num_vertices[T8_ECLASS_COUNT] = T8_ECLASS_NUM_VERTICES_VALUES;
const int t8_eclass_num_edges[T8_ECLASS_COUNT] = T8_ECLASS_NUM_EDGES_VALUES;
const int t8_eclass_vtk_type[T8_ECLASS_COUNT] = T8_ECLASS_VTK_TYPE_VALUES;
const int t8_eclass_vtk_to_t8_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS]
= T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES;
const int t8_eclass_t8_to_vtk_corner_number[T8_ECLASS_COUNT][T8_ECLASS_MAX_CORNERS]
= T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES;
const int t8_eclass_face_types[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES] = T8_ECLASS_FACE_TYPES_VALUES;
const int t8_eclass_boundary_count[T8_ECLASS_COUNT][T8_ECLASS_COUNT] = T8_ECLASS_BOUNDARY_COUNT_VALUES;
const char *t8_eclass_to_string[T8_ECLASS_INVALID] = T8_ECLASS_TO_STRING_VALUES;
int
t8_eclass_count_boundary (t8_eclass_t theclass, int min_dim, int *per_eclass)
{
int sum = 0;
for (int t = T8_ECLASS_ZERO; t < T8_ECLASS_COUNT; ++t) {
if (t8_eclass_to_dimension[t] >= min_dim) {
sum += (per_eclass[t] = t8_eclass_boundary_count[theclass][t]);
}
else {
per_eclass[t] = 0;
}
}
return sum;
}
int
t8_eclass_compare (t8_eclass_t eclass1, t8_eclass_t eclass2)
{
int dim = t8_eclass_to_dimension[eclass1];
T8_ASSERT (dim == t8_eclass_to_dimension[eclass2]);
if (eclass1 == eclass2) {
return 0;
}
else if (dim == 2) {
return eclass1 == T8_ECLASS_TRIANGLE ? -1 : 1;
}
else {
T8_ASSERT (dim == 3);
switch (eclass1) {
case T8_ECLASS_TET:
return -1;
case T8_ECLASS_HEX:
return eclass2 == T8_ECLASS_TET ? 1 : -1;
case T8_ECLASS_PRISM:
return eclass2 == T8_ECLASS_PYRAMID ? -1 : 1;
default:
T8_ASSERT (eclass1 == T8_ECLASS_PYRAMID);
return 1;
}
}
}
int
t8_eclass_is_valid (t8_eclass_t eclass)
{
return eclass < T8_ECLASS_COUNT;
}