From e653fc3a43fb7bda78a72d0be3bc7cc2aca778c7 Mon Sep 17 00:00:00 2001 From: Lukas Dreyer Date: Tue, 21 Oct 2025 10:09:29 +0200 Subject: [PATCH 1/5] change type to uint8, compute ancestorid correctly --- .../t8_standalone/t8_standalone_elements.hxx | 7 +- .../t8_standalone_implementation.hxx | 115 ++++++++++-------- 2 files changed, 70 insertions(+), 52 deletions(-) diff --git a/src/t8_schemes/t8_standalone/t8_standalone_elements.hxx b/src/t8_schemes/t8_standalone/t8_standalone_elements.hxx index 8a86c8418a..d9aa9632dd 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_elements.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_elements.hxx @@ -153,8 +153,9 @@ typedef uint8_t t8_element_level; typedef uint8_t t8_cube_id; typedef uint8_t t8_child_id; -template -using t8_element_type = std::bitset; +//template +//using t8_element_type = std::bitset; +//using t8_element_type = u_int8_t; template using t8_element_coords = std::array; @@ -168,7 +169,7 @@ struct t8_standalone_element /** The refinement level of the element relative to the root at level 0. */ t8_element_level level; /** Bit array: which inequality is fulfilled at which level. */ - t8_element_type type; + u_int8_t type; }; #endif /* T8_STANDALONE_ELEMENTS_HXX */ diff --git a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx index 0a9a0d16a0..9c75ff1b08 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -141,6 +141,23 @@ struct t8_standalone_scheme return T8_ELEMENT_MAXLEVEL[TEclass]; } + static constexpr u_int8_t + get_typebit (u_int8_t type, int pos) + { + return (type & (1 << pos)) >> pos; + } + static constexpr void + set_typebit_from_zero (u_int8_t *type, u_int8_t pos, u_int8_t bit) + { + *type |= ((bit && 1) << pos); + } + static constexpr void + set_typebit (u_int8_t *type, u_int8_t pos, u_int8_t bit) + { + *type &= !(1 << pos); + set_typebit_from_zero (type, pos, bit); + } + // ################################################____SHAPE INFORMATION____################################################ /** Compute the number of corners of a given element. @@ -242,7 +259,7 @@ struct t8_standalone_scheme } else { t8_standalone_element *el = (t8_standalone_element *) element; - return t8_standalone_lut_facecorner[el->type.to_ulong ()][face][corner]; + return t8_standalone_lut_facecorner[el->type][face][corner]; } } @@ -271,7 +288,7 @@ struct t8_standalone_scheme } else { t8_standalone_element *el = (t8_standalone_element *) element; - return t8_standalone_lut_cornerface[el->type.to_ulong ()][corner][face]; + return t8_standalone_lut_cornerface[el->type][corner][face]; } } @@ -310,7 +327,7 @@ struct t8_standalone_scheme return T8_ECLASS_TRIANGLE; } case T8_ECLASS_PYRAMID: - if (el->type[0] != el->type[1]) { + if (get_typebit (el->type, 0) != get_typebit (el->type, 1)) { return T8_ECLASS_TRIANGLE; } else { @@ -419,7 +436,7 @@ struct t8_standalone_scheme if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { const t8_cube_id cube_id = compute_cubeid (el, el->level); - parent_elem->type = t8_element_type_cubeid_to_parenttype[el->type.to_ulong ()][cube_id]; + parent_elem->type = t8_element_type_cubeid_to_parenttype[el->type][cube_id]; } const t8_element_coord length = element_get_len ((el->level)); @@ -504,8 +521,8 @@ struct t8_standalone_scheme /* Compute the cube id and shift the coordinates accordingly */ t8_cube_id cube_id; if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - cube_id = t8_element_type_Iloc_to_childcubeid[el->type.to_ulong ()][childid]; - c->type = t8_element_type_Iloc_to_childtype[el->type.to_ulong ()][childid]; + cube_id = t8_element_type_Iloc_to_childcubeid[el->type][childid]; + c->type = t8_element_type_Iloc_to_childtype[el->type][childid]; } else { cube_id = childid; @@ -605,7 +622,7 @@ struct t8_standalone_scheme const t8_cube_id cube_id = compute_cubeid (el, el->level); t8_child_id child_id; if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - child_id = t8_element_type_cubeid_to_Iloc[el->type.to_ulong ()][cube_id]; + child_id = t8_element_type_cubeid_to_Iloc[el->type][cube_id]; } else { child_id = cube_id; @@ -678,7 +695,7 @@ struct t8_standalone_scheme const int cube_ancestor_level = element_get_cube_nca_level (el1, el2); int real_level = cube_ancestor_level; if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - t8_element_type ancestor_type, ancestor2_type; + u_int8_t ancestor_type, ancestor2_type; do { ancestor_type = element_compute_type_at_level (el1, real_level); ancestor2_type = element_compute_type_at_level (el2, real_level); @@ -799,7 +816,7 @@ struct t8_standalone_scheme else { for (int ifacechild = 0; ifacechild < num_children; ifacechild++) { child_indices[ifacechild] - = t8_standalone_lut_type_face_facechildid_to_childid[el->type.to_ulong ()][face][ifacechild]; + = t8_standalone_lut_type_face_facechildid_to_childid[el->type][face][ifacechild]; } } for (int ifacechild = num_children - 1; ifacechild >= 0; ifacechild--) { @@ -837,9 +854,8 @@ struct t8_standalone_scheme } else { const t8_standalone_element *el = (const t8_standalone_element *) elem; - const int child_id - = t8_standalone_lut_type_face_facechildid_to_childid[el->type.to_ulong ()][face][face_child]; - return t8_standalone_lut_type_childid_face_to_childface[el->type.to_ulong ()][child_id][face]; + const int child_id = t8_standalone_lut_type_face_facechildid_to_childid[el->type][face][face_child]; + return t8_standalone_lut_type_childid_face_to_childface[el->type][child_id][face]; } } @@ -872,7 +888,7 @@ struct t8_standalone_scheme } else { t8_cube_id cube_id = compute_cubeid (el, el->level); - return t8_standalone_lut_type_cubeid_face_to_parentface[el->type.to_ulong ()][cube_id][face]; + return t8_standalone_lut_type_cubeid_face_to_parentface[el->type][cube_id][face]; } } @@ -906,7 +922,7 @@ struct t8_standalone_scheme face_is_1_boundary = face % 2; } else { - face_is_1_boundary = t8_standalone_lut_type_face_to_is_1_boundary[el->type.to_ulong ()][face]; + face_is_1_boundary = t8_standalone_lut_type_face_to_is_1_boundary[el->type][face]; } if (face_is_1_boundary) { //the face is a xi=1 boundary @@ -915,7 +931,7 @@ struct t8_standalone_scheme facenormal_dim = face / 2; } else { - facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[el->type.to_ulong ()][face]; + facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[el->type][face]; T8_ASSERT (facenormal_dim != -1); } t8_element_coord coord_offset = element_get_len (el->level) - element_get_len (level); @@ -955,7 +971,7 @@ struct t8_standalone_scheme multiplier = (idim == face / 2) ? face % 2 : 1; } else { - t8_cube_id cube_id = t8_standalone_lut_type_face_to_last_facechilds_cubeid[el->type.to_ulong ()][face]; + t8_cube_id cube_id = t8_standalone_lut_type_face_to_last_facechilds_cubeid[el->type][face]; multiplier = (cube_id & (1 << idim)) >> idim; // = cubeid[idim]; } last_descendant->coords[idim] = el->coords[idim] + multiplier * coord_offset; @@ -988,8 +1004,8 @@ struct t8_standalone_scheme // all edges containing dim must be fulfilled with x_d-a_d >= x_j-a_j or x_j-a_j <= x_d-a_d if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ++ieq) { - if ((t8_type_edge_equations[ieq][0] == dim && el->type[ieq]) - || (t8_type_edge_equations[ieq][1] == dim && !el->type[ieq])) { + if ((t8_type_edge_equations[ieq][0] == dim && get_typebit (el->type, ieq)) + || (t8_type_edge_equations[ieq][1] == dim && !get_typebit (el->type, ieq))) { return 0; } } @@ -1004,8 +1020,8 @@ struct t8_standalone_scheme // all edges containing dimid must be fulfilled with x_d-a_d <= x_j-a_j or x_j-a_j >= x_d-a_d if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { - if ((t8_type_edge_equations[ieq][0] == dim && !el->type[ieq]) - || (t8_type_edge_equations[ieq][1] == dim && el->type[ieq])) { + if ((t8_type_edge_equations[ieq][0] == dim && !get_typebit (el->type, ieq)) + || (t8_type_edge_equations[ieq][1] == dim && get_typebit (el->type, ieq))) { return 0; } } @@ -1017,7 +1033,7 @@ struct t8_standalone_scheme // get graph edge e (or ieq) = (xi,xj) // ai = aj is necessary and sufficient if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - const int ieq = t8_standalone_lut_type_face_to_typebit[el->type.to_ulong ()][face]; + const int ieq = t8_standalone_lut_type_face_to_typebit[el->type][face]; if (el->coords[t8_type_edge_equations[ieq][0]] != el->coords[t8_type_edge_equations[ieq][1]]) { return 0; @@ -1053,7 +1069,7 @@ struct t8_standalone_scheme } else { const t8_standalone_element *el = (const t8_standalone_element *) elem; - return t8_standalone_lut_type_face_to_tree_face[el->type.to_ulong ()][face]; + return t8_standalone_lut_type_face_to_tree_face[el->type][face]; } } @@ -1085,13 +1101,13 @@ struct t8_standalone_scheme t8_standalone_element *neighbor = (t8_standalone_element *) neigh; if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - const int internal_face = t8_standalone_lut_face_internal[el->type.to_ulong ()][face]; + const int internal_face = t8_standalone_lut_face_internal[el->type][face]; if (internal_face) { /**Determine typebit*/ - int typebit = t8_standalone_lut_type_face_to_typebit[el->type.to_ulong ()][face]; + int typebit = t8_standalone_lut_type_face_to_typebit[el->type][face]; /**Change typebit*/ - neighbor->type.flip (typebit); - *neigh_face = t8_standalone_lut_type_face_to_neighface[el->type.to_ulong ()][face]; + neighbor->type ^= (1 << typebit); + *neigh_face = t8_standalone_lut_type_face_to_neighface[el->type][face]; return element_is_inside_root (neighbor); } } @@ -1099,8 +1115,8 @@ struct t8_standalone_scheme int facenormal_dim, sign; if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { - sign = t8_standalone_lut_type_face_to_sign[el->type.to_ulong ()][face]; - facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[el->type.to_ulong ()][face]; + sign = t8_standalone_lut_type_face_to_sign[el->type][face]; + facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[el->type][face]; T8_ASSERT (facenormal_dim != -1); } else { @@ -1118,10 +1134,10 @@ struct t8_standalone_scheme /**For all neighboring typebits, change typebit*/ if (t8_type_edge_equations[ieq][0] == facenormal_dim || t8_type_edge_equations[ieq][1] == facenormal_dim) { - neighbor->type.flip (ieq); /*ASSERT that flip is in correct direction */ + neighbor->type ^= (1 << ieq); /*ASSERT that flip is in correct direction */ } } - *neigh_face = t8_standalone_lut_type_face_to_neighface[el->type.to_ulong ()][face]; + *neigh_face = t8_standalone_lut_type_face_to_neighface[el->type][face]; } else { *neigh_face = face ^ 1; @@ -1513,7 +1529,7 @@ struct t8_standalone_scheme for (int idim = 0; idim < T8_ELEMENT_DIM[TEclass]; ++idim) { for (int jdim = 0; jdim < T8_ELEMENT_DIM[TEclass]; ++jdim) { tmp_coords[idim] - += t8_standalone_lut_transform_coords[el->type.to_ulong ()][idim][jdim] * current_ref_coords[jdim]; + += t8_standalone_lut_transform_coords[el->type][idim][jdim] * current_ref_coords[jdim]; } if (TEclass == T8_ECLASS_PYRAMID && el->type == T8_DPYRAMID_SECOND_PYRA_TYPE) { tmp_coords[idim] += 1.0; @@ -1710,7 +1726,7 @@ struct t8_standalone_scheme t8_debugf ("x_%i: %i \n", idim, el->coords[idim]); } for (int e_num = 0; e_num < T8_ELEMENT_NUM_EQUATIONS[TEclass]; e_num++) { - t8_debugf ("t_%i: %i \n", e_num, el->type[e_num]); + t8_debugf ("t_%i: %i \n", e_num, get_typebit (el->type, e_num)); } } @@ -1759,7 +1775,7 @@ struct t8_standalone_scheme mpiret = sc_MPI_Pack (&els[ielem]->level, 1, sc_MPI_INT8_T, send_buffer, buffer_size, position, comm); SC_CHECK_MPI (mpiret); - int8_t type = els[ielem]->type.to_ulong (); + int8_t type = els[ielem]->type; mpiret = sc_MPI_Pack (&type, 1, sc_MPI_INT8_T, send_buffer, buffer_size, position, comm); SC_CHECK_MPI (mpiret); } @@ -2021,7 +2037,7 @@ struct t8_standalone_scheme if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { t8_standalone_element *el = (t8_standalone_element *) elem; - const int8_t type = el->type.to_ulong (); + const int8_t type = el->type; int tmp_out_coords[T8_ELEMENT_DIM[TEclass]] = {}; for (int idim = 0; idim < T8_ELEMENT_DIM[TEclass]; idim++) { coords[idim] @@ -2082,7 +2098,7 @@ struct t8_standalone_scheme return 0; } else { - return t8_standalone_lut_face_internal[elem->type.to_ulong ()][face]; + return t8_standalone_lut_face_internal[elem->type][face]; } } @@ -2100,7 +2116,7 @@ struct t8_standalone_scheme return face / 2; } else { - return t8_standalone_lut_type_face_to_facenormal_dim[elem->type.to_ulong ()][face]; + return t8_standalone_lut_type_face_to_facenormal_dim[elem->type][face]; } } /** Given a face of an element that is also a hypercube face, determine if it is the boundary x_i == 1. @@ -2117,7 +2133,7 @@ struct t8_standalone_scheme return face % 2; } else { - return t8_standalone_lut_type_face_to_is_1_boundary[elem->type.to_ulong ()][face]; + return t8_standalone_lut_type_face_to_is_1_boundary[elem->type][face]; } } @@ -2209,7 +2225,7 @@ struct t8_standalone_scheme for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { const int ifaceeq = t8_standalone_lut_rootface_eq_to_faceeq[root_face][ieq]; if (ifaceeq != -1) { - boundary->type[ifaceeq] = el->type[ieq]; + set_typebit_from_zero (&boundary->type, ifaceeq, get_typebit (el->type, ieq)); } } T8_ASSERT (t8_standalone_scheme::element_is_valid ((t8_element_t *) boundary)); @@ -2277,26 +2293,27 @@ struct t8_standalone_scheme return root_face; } else { - t8_element_type root_type = 0; + u_int8_t root_type = 0; el->type = root_type; for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { const int ifaceeq = t8_standalone_lut_rootface_eq_to_faceeq[root_face][ieq]; if (ifaceeq != -1) { - el->type[ieq] = face->type[ifaceeq]; + set_typebit_from_zero (&el->type, ieq, get_typebit (face->type, ifaceeq)); } } /** Set those typebits, that are connected to the face_normaldim of root_face*/ for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { - const int facenormal_dim - = t8_standalone_lut_type_face_to_facenormal_dim[root_type.to_ulong ()][root_face]; + const int facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[root_type][root_face]; if (t8_type_edge_equations[ieq][0] == facenormal_dim) { - el->type[ieq] = !t8_standalone_lut_type_face_to_is_1_boundary[root_type.to_ulong ()][root_face]; + set_typebit_from_zero (&el->type, ieq, + !t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); } else if (t8_type_edge_equations[ieq][1] == facenormal_dim) { - el->type[ieq] = t8_standalone_lut_type_face_to_is_1_boundary[root_type.to_ulong ()][root_face]; + set_typebit_from_zero (&el->type, ieq, + t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); } } - return t8_standalone_lut_type_rootface_to_face[el->type.to_ulong ()][root_face]; + return t8_standalone_lut_type_rootface_to_face[el->type][root_face]; } } @@ -2346,10 +2363,10 @@ struct t8_standalone_scheme /* For each typebit, consider the coordinate information between level and p->level |10...11|xxxx|0...0| * of both inequality defining dimensions */ - static inline t8_element_type + static inline u_int8_t element_compute_type_at_level (const t8_standalone_element *el, const int level) { - t8_element_type type = 0; + u_int8_t type = 0; T8_ASSERT (0 <= el->level && el->level <= T8_ELEMENT_MAXLEVEL[TEclass]); for (int e = 0; e < T8_ELEMENT_NUM_EQUATIONS[TEclass]; e++) { @@ -2360,14 +2377,14 @@ struct t8_standalone_scheme coord_v1 = (coord_v1 << level) & ((1 << T8_ELEMENT_MAXLEVEL[TEclass]) - 1); if (coord_v0 == coord_v1) { - type[e] = el->type[e] | type[e]; + set_typebit_from_zero (&type, e, get_typebit (el->type, e) | get_typebit (type, e)); } else if (coord_v0 < coord_v1) { type |= (1 << e); } else { T8_ASSERT (coord_v0 > coord_v1); - T8_ASSERT (!(type & (t8_element_type) (1 << e)).all ()); + T8_ASSERT (!(type & (u_int8_t) (1 << e)).all ()); } } return type; From a7640c2a40eb741657320a7fed50b3cdcbad6b19 Mon Sep 17 00:00:00 2001 From: Lukas Dreyer Date: Tue, 21 Oct 2025 16:44:06 +0200 Subject: [PATCH 2/5] fix assertion --- src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx index 9c75ff1b08..6763d491db 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -2384,7 +2384,7 @@ struct t8_standalone_scheme } else { T8_ASSERT (coord_v0 > coord_v1); - T8_ASSERT (!(type & (u_int8_t) (1 << e)).all ()); + T8_ASSERT (!(type & (u_int8_t) (1 << e))); } } return type; From d0ad7010007d5f031d8f8a9153aac2df276c9d95 Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Wed, 22 Oct 2025 09:27:14 +0200 Subject: [PATCH 3/5] Only look at type when it is allowed to --- .../t8_standalone/t8_standalone_implementation.hxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx index 6763d491db..6f07809969 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -380,7 +380,12 @@ struct t8_standalone_scheme if (el1->coords[idim] != el2->coords[idim]) return 0; } - return el1->type == el2->type; + if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { + return el1->type == el2->type; + } + else { + return 1; + } } // ################################################____ACCESSOR____################################################ From 2fd0b6a260d893704a39336bdf3d7d40723e985f Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Wed, 22 Oct 2025 13:08:40 +0200 Subject: [PATCH 4/5] fix type access --- .../t8_standalone_implementation.hxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx index 6f07809969..2713b5d5fa 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -154,7 +154,7 @@ struct t8_standalone_scheme static constexpr void set_typebit (u_int8_t *type, u_int8_t pos, u_int8_t bit) { - *type &= !(1 << pos); + *type &= ~(1 << pos); set_typebit_from_zero (type, pos, bit); } @@ -2204,8 +2204,8 @@ struct t8_standalone_scheme if constexpr (T8_ELEMENT_DIM[TFaceEclass] >= T8_ELEMENT_DIM[TEclass]) { return; } - else { + boundary->type = 0; boundary->level = el->level; /* Delete the coordinate orthogonal to the given face and combine the remaining coordinates*/ for (int idim = 0; idim < T8_ELEMENT_DIM[TEclass]; idim++) { @@ -2230,7 +2230,7 @@ struct t8_standalone_scheme for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { const int ifaceeq = t8_standalone_lut_rootface_eq_to_faceeq[root_face][ieq]; if (ifaceeq != -1) { - set_typebit_from_zero (&boundary->type, ifaceeq, get_typebit (el->type, ieq)); + set_typebit (&boundary->type, ifaceeq, get_typebit (el->type, ieq)); } } T8_ASSERT (t8_standalone_scheme::element_is_valid ((t8_element_t *) boundary)); @@ -2303,19 +2303,17 @@ struct t8_standalone_scheme for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { const int ifaceeq = t8_standalone_lut_rootface_eq_to_faceeq[root_face][ieq]; if (ifaceeq != -1) { - set_typebit_from_zero (&el->type, ieq, get_typebit (face->type, ifaceeq)); + set_typebit (&el->type, ieq, get_typebit (face->type, ifaceeq)); } } /** Set those typebits, that are connected to the face_normaldim of root_face*/ for (int ieq = 0; ieq < T8_ELEMENT_NUM_EQUATIONS[TEclass]; ieq++) { const int facenormal_dim = t8_standalone_lut_type_face_to_facenormal_dim[root_type][root_face]; if (t8_type_edge_equations[ieq][0] == facenormal_dim) { - set_typebit_from_zero (&el->type, ieq, - !t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); + set_typebit (&el->type, ieq, !t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); } else if (t8_type_edge_equations[ieq][1] == facenormal_dim) { - set_typebit_from_zero (&el->type, ieq, - t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); + set_typebit (&el->type, ieq, t8_standalone_lut_type_face_to_is_1_boundary[root_type][root_face]); } } return t8_standalone_lut_type_rootface_to_face[el->type][root_face]; @@ -2382,7 +2380,7 @@ struct t8_standalone_scheme coord_v1 = (coord_v1 << level) & ((1 << T8_ELEMENT_MAXLEVEL[TEclass]) - 1); if (coord_v0 == coord_v1) { - set_typebit_from_zero (&type, e, get_typebit (el->type, e) | get_typebit (type, e)); + set_typebit (&type, e, get_typebit (el->type, e) | get_typebit (type, e)); } else if (coord_v0 < coord_v1) { type |= (1 << e); From c5e26768211f82d389ab3d7846c23df3b2f76404 Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Wed, 22 Oct 2025 15:43:39 +0200 Subject: [PATCH 5/5] Do not use type for hypercubes --- .../t8_standalone/t8_standalone_implementation.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx index 2713b5d5fa..e82be32df7 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -2080,8 +2080,10 @@ struct t8_standalone_scheme /**Check that we are in the correct cube*/ if (std::all_of (ancestor.coords.begin (), ancestor.coords.end (), [] (int coord) { return coord == 0; })) { - return ancestor.type == 0; - //TODO: root type + if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { + return ancestor.type == 0; + } + return 1; } else { return 0;