Function t8_forest_bin_search_upper
Defined in File t8_forest_private.h
Function Documentation
-
t8_locidx_t t8_forest_bin_search_upper(const t8_element_array_t *elements, const t8_linearidx_t element_id, const int element_level)
Search for a linear element id (at level element_level) in a sorted array of elements.
If the element does not exist, return the smallest index i such that the element at position i has a larger or equal id than the given one. If no such i exists, return -1.
- 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_id – [in] The linear id of the element to search for.
element_level – [in] The level of the element to search for. Thus, the level at which element_id was computed.
- Returns:
The smallest index i of an element with linear_id larger than or equal to element_id in elements if it exists. -1 if no such element was found in elements.