Function t8_forest_bin_search_lower
Defined in File t8_forest_private.h
Function Documentation
-
t8_locidx_t t8_forest_bin_search_lower(const t8_element_array_t *elements, const t8_linearidx_t element_id, const int element_level)
Search for a linear element id in a sorted array of elements.
If the element does not exist, return the largest index i such that the element at position i has a smaller 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 largest index i of an element with linear_id smaller than or equal to element_id in elements if it exists. -1 if no such element was found in elements.