From 314edc655977f45e98b33f0625aba84ecb976079 Mon Sep 17 00:00:00 2001 From: Lukas Dreyer Date: Tue, 21 Oct 2025 12:14:24 +0200 Subject: [PATCH 1/2] improve ancestor_id --- .../t8_standalone_implementation.hxx | 16 ++++++++++++++-- 1 file changed, 14 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 e82be32df7..b9da579edd 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -649,10 +649,22 @@ struct t8_standalone_scheme const t8_standalone_element *el = (const t8_standalone_element *) elem; t8_standalone_element ancestor; + const int length = element_get_len (level); T8_ASSERT (0 <= el->level && el->level <= T8_ELEMENT_MAXLEVEL[TEclass]); - element_get_ancestor (el, level, &ancestor); - return element_get_child_id ((const t8_element_t *) &ancestor); + int cube_id = 0; + for (int idim = 0; idim < T8_ELEMENT_DIM[TEclass]; idim++) { + cube_id |= (el->coords[idim] & length) ? (1 << idim) : 0; + } + int child_id; + if constexpr (T8_ELEMENT_NUM_EQUATIONS[TEclass]) { + u_int8_t type = element_compute_type_at_level (el, level); + child_id = t8_element_type_cubeid_to_Iloc[type][cube_id]; + } + else { + child_id = cube_id; + } + return child_id; } /** Query whether a given set of elements is a family or not. From bb8e4e411d8d1be7aee3b8fb67bc9f85926f027a Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Wed, 22 Oct 2025 13:46:11 +0200 Subject: [PATCH 2/2] remove unneeded variable --- src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx | 1 - 1 file changed, 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 b9da579edd..af81a60b4a 100644 --- a/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx +++ b/src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx @@ -648,7 +648,6 @@ struct t8_standalone_scheme T8_ASSERT (0 <= level && level <= T8_ELEMENT_MAXLEVEL[TEclass]); const t8_standalone_element *el = (const t8_standalone_element *) elem; - t8_standalone_element ancestor; const int length = element_get_len (level); T8_ASSERT (0 <= el->level && el->level <= T8_ELEMENT_MAXLEVEL[TEclass]);