From e8dae5cbdf5d24936a17cf7eac7365a1b14f59ac Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 3 Jan 2025 15:04:42 +0100 Subject: [PATCH] replace code duplication with macro --- .../t8_default/t8_default_tet/t8_dtet_connectivity.c | 2 -- .../t8_default/t8_default_tet/t8_dtet_connectivity.h | 3 ++- .../t8_default/t8_default_tri/t8_dtri_connectivity.c | 5 ----- .../t8_default/t8_default_tri/t8_dtri_connectivity.h | 3 ++- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.c b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.c index 9262f5cd17..2f854e85ed 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.c +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.c @@ -135,8 +135,6 @@ const int t8_dtet_face_child_id_by_type[6][4][4] = { { { 3, 5, 6, 7 }, { 0, 4, 6, 7 }, { 0, 2, 3, 7 }, { 0, 1, 3, 6 } } /* type 5 */ }; -const int t8_dtet_face_corner[4][3] = { { 1, 3, 2 }, { 0, 2, 3 }, { 0, 3, 1 }, { 0, 1, 2 } }; - const int t8_dtet_parent_type_type_to_face[6][6] = { { -1, 0, 2, -1, 1, 3 }, { 0, -1, 3, 1, -1, 2 }, diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.h b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.h index 271c68059e..66ff27229b 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.h +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_connectivity.h @@ -28,6 +28,7 @@ #define T8_DTET_CONNECTIVITY_H #include +#include T8_EXTERN_C_BEGIN (); @@ -91,7 +92,7 @@ extern const int t8_dtet_face_child_id_by_type[6][4][4]; * The other 2 corner are given in counterclockwise order as seen from * outside of the tet. */ -extern const int t8_dtet_face_corner[4][3]; +#define t8_dtet_face_corner t8_face_vertex_to_tree_vertex[T8_ECLASS_TET] /** For each combination parent_type, type with parent_type != type, * provide the face number of the face of a tet that lies within a face of diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.c b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.c index ba6c7484b0..bfb083de8f 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.c +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.c @@ -79,11 +79,6 @@ const int t8_dtri_parenttype_Iloc_to_cid[2][4] = { { 0, 1, 1, 3 }, { 0, 2, 2, 3 } }; -const int t8_dtri_face_corner[3][2] = { - { 1, 2 }, - { 0, 2 }, - { 0, 1 } }; - const int t8_dtri_corner_face[3][2] = { { 1, 2 }, { 0, 2 }, diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.h b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.h index 1beb2ee62a..06182dda1e 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.h +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.h @@ -27,6 +27,7 @@ #define T8_DTRI_CONNECTIVITY_H #include +#include T8_EXTERN_C_BEGIN (); @@ -69,7 +70,7 @@ extern const int t8_dtri_parenttype_Iloc_to_type[2][4]; extern const int t8_dtri_parenttype_Iloc_to_cid[2][4]; /** Store the indices of the corner of each face of a triangle. */ -extern const int t8_dtri_face_corner[3][2]; +#define t8_dtri_face_corner t8_face_vertex_to_tree_vertex[T8_ECLASS_TRIANGLE] /** Store the indices of the faces of each corner of a triangle. */ extern const int t8_dtri_corner_face[3][2];