Function t8_forest_bin_search_first_descendant_ancestor
Defined in File t8_forest_private.h
Function Documentation
-
t8_locidx_t t8_forest_bin_search_first_descendant_ancestor(const t8_element_array_t *elements, const t8_element_t *element, const t8_element_t **element_found)
Search for the first descendant or ancestor of an element in a sorted array of elements.
Note
element is ancestor and descendant of itself, so if element is contained in elements then it will be found by this function.
- Parameters:
elements – [in] An array of elements. Must be sorted according to linear id at maximum level. Must correspond to a valid refinement (i.e. contain no duplicate elements or elements and their descendants).
element – [in] The element to search for.
element_found – [in] On return either a descendant or ancestor of element in elements if it exists. NULL if no such element exists in elements.
- Returns:
The smallest index i such that elements[i] (= element_found) is an ancestor or a descendant of element. -1 if no such element was found in elements.