From c5293c046df6a1f45ebc4438a88ef27848febc5a Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 17 Apr 2026 11:43:49 +0200 Subject: [PATCH 1/2] Copy root element instead of returning a pointer to the root element when the pfc message is filled --- src/t8_forest/t8_forest_pfc_message.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t8_forest/t8_forest_pfc_message.hxx b/src/t8_forest/t8_forest_pfc_message.hxx index 868aae6d24..8238d0e071 100644 --- a/src/t8_forest/t8_forest_pfc_message.hxx +++ b/src/t8_forest/t8_forest_pfc_message.hxx @@ -214,7 +214,8 @@ struct t8_forest_pfc_message // If we are already the root element, we cannot be part of a split family, so we send any(the root) element and no num_siblings. if (scheme->element_get_level (eclass, element_closest_to_receiver) == 0) { - parent = element_closest_to_receiver; + t8_element_new (scheme, eclass, 1, &parent); + scheme->element_copy (eclass, element_closest_to_receiver, parent); num_siblings = 0; } else { From 591bc9e6a153bfffdae440a079a94d367bfa7985 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 17 Apr 2026 13:15:20 +0200 Subject: [PATCH 2/2] Added comments --- src/t8_forest/t8_forest_pfc_message.hxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/t8_forest/t8_forest_pfc_message.hxx b/src/t8_forest/t8_forest_pfc_message.hxx index 8238d0e071..198b43214b 100644 --- a/src/t8_forest/t8_forest_pfc_message.hxx +++ b/src/t8_forest/t8_forest_pfc_message.hxx @@ -214,8 +214,11 @@ struct t8_forest_pfc_message // If we are already the root element, we cannot be part of a split family, so we send any(the root) element and no num_siblings. if (scheme->element_get_level (eclass, element_closest_to_receiver) == 0) { + // Allocate memory for the parent element. t8_element_new (scheme, eclass, 1, &parent); + // Copy the root element to the allocated parent element. scheme->element_copy (eclass, element_closest_to_receiver, parent); + // Set the number of siblings to zero, since there are none on the root level. num_siblings = 0; } else {