p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
Typedefs | Functions
p4est_search.h File Reference

Search through quadrants, the local part of a forest, or the partition. More...

#include <p4est.h>
Include dependency graph for p4est_search.h:

Go to the source code of this file.

Typedefs

typedef int(* p4est_search_local_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, p4est_locidx_t local_num, void *point)
 Callback function to query the match of a "point" with a quadrant. More...
 
typedef p4est_search_local_t p4est_search_query_t
 This typedef is provided for backwards compatibility.
 
typedef int(* p4est_search_reorder_t) (p4est_t *p4est, sc_array_t *quadrants, sc_array_t *indices)
 Callback function to query, reorder, and reduce a set of quadrants. More...
 
typedef int(* p4est_search_partition_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, int pfirst, int plast, void *point)
 Callback function for the partition recursion. More...
 
typedef int(* p4est_search_all_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, int pfirst, int plast, p4est_locidx_t local_num, void *point)
 Callback function for the top-down search through the whole forest. More...
 

Functions

void p4est_find_partition (const int num_procs, p4est_gloidx_t *search_in, p4est_gloidx_t my_begin, p4est_gloidx_t my_end, p4est_gloidx_t *begin, p4est_gloidx_t *end)
 Binary search in partition array. More...
 
ssize_t p4est_find_lower_bound (sc_array_t *array, const p4est_quadrant_t *q, size_t guess)
 Find the lowest position tq in a quadrant array such that tq >= q. More...
 
ssize_t p4est_find_higher_bound (sc_array_t *array, const p4est_quadrant_t *q, size_t guess)
 Find the highest position tq in a quadrant array such that tq <= q. More...
 
p4est_quadrant_tp4est_find_quadrant_cumulative (p4est_t *p4est, p4est_locidx_t cumulative_id, p4est_topidx_t *which_tree, p4est_locidx_t *quadrant_id)
 Search a local quadrant by its cumulative number in the forest. More...
 
void p4est_split_array (sc_array_t *array, int level, size_t indices[])
 Split an array of quadrants by the children of an ancestor. More...
 
int32_t p4est_find_range_boundaries (p4est_quadrant_t *lq, p4est_quadrant_t *uq, int level, int faces[], int corners[])
 Find the boundary points touched by a range of quadrants. More...
 
void p4est_search_local (p4est_t *p4est, int call_post, p4est_search_local_t quadrant_fn, p4est_search_local_t point_fn, sc_array_t *points)
 Search through the local part of a forest. More...
 
void p4est_search (p4est_t *p4est, p4est_search_query_t quadrant_fn, p4est_search_query_t point_fn, sc_array_t *points)
 This function is provided for backwards compatibility. More...
 
void p4est_search_reorder (p4est_t *p4est, int skip_levels, p4est_search_reorder_t reorder_fn, p4est_search_local_t pre_quadrant_fn, p4est_search_local_t post_quadrant_fn, p4est_search_local_t point_fn, sc_array_t *points)
 Run a depth-first traversal, optionally filtering search points. More...
 
void p4est_search_partition (p4est_t *p4est, int call_post, p4est_search_partition_t quadrant_fn, p4est_search_partition_t point_fn, sc_array_t *points)
 Traverse the global partition top-down. More...
 
void p4est_search_partition_gfx (const p4est_gloidx_t *gfq, const p4est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees, int call_post, void *user, p4est_search_partition_t quadrant_fn, p4est_search_partition_t point_fn, sc_array_t *points)
 Traverse some given global partition top-down. More...
 
void p4est_search_partition_gfp (const p4est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees, int call_post, void *user, p4est_search_partition_t quadrant_fn, p4est_search_partition_t point_fn, sc_array_t *points)
 Traverse some given global partition top-down. More...
 
void p4est_search_all (p4est_t *p4est, int call_post, p4est_search_all_t quadrant_fn, p4est_search_all_t point_fn, sc_array_t *points)
 Perform a top-down search on the whole forest. More...
 

Detailed Description

Search through quadrants, the local part of a forest, or the partition.

This file provides several helper functions and a couple highlevel recursive search algorithms. These can be used to search for a collection of user-defined "points" through the forest. There are three flavors of the main search algorithm:

  1. p4est_search_local

    This function examines the processor-local part of the refinement tree. It proceeds top-down along all subtrees that have at least one local leaf. Non-local subtrees are ignored in an optimized way. Use this function to compare points against the local branches and leaves.

  2. p4est_search_partition

    This function examines the parallel partition that is known to all processors without knowing about actual leaves on remote processors. Use this to find the processors relevant for a collection of points, which can then be used to send each point to its assigned processor.

  3. p4est_search_all

    This function combines the first two into one algorithm. Note that when the parallel partition is not of interest, p4est_search_local is recommended instead since it employs optimizations that are only possible on the local processor.

Typedef Documentation

◆ p4est_search_all_t

typedef int(* p4est_search_all_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, int pfirst, int plast, p4est_locidx_t local_num, void *point)

Callback function for the top-down search through the whole forest.

Parameters
[in]p4estThe forest to search. We recurse through the trees one after another.
[in]which_treeThe current tree number.
[in]quadrantThe current quadrant in the recursion. This quadrant is either a non-leaf tree branch or a leaf. If the quadrant is contained in the local partition, we know which, otherwise we don't. Let us first consider the situation when quadrant is local, which is indicated by both pfirst and plast being equal to p4est->mpirank. Then the parameter local_num is negative for non-leaves and the number of the quadrant as a leaf in local storage otherwise. Only if the quadrant is a local leaf, it points to the actual local storage and can be used to access user data etc., and the recursion terminates. The other possibility is that pfirst < plast, in which case we proceed with the recursion, or both are equal to the same remote rank, in which case the recursion terminates. Either way, the quadrant is not from local forest storage.
[in]pfirstThe lowest processor that owns part of quadrant. Guaranteed to be non-empty.
[in]plastThe highest processor that owns part of quadrant. Guaranteed to be non-empty.
[in]local_numIf quadrant is a local leaf, this number is the index of the leaf in local quadrant storage. Else, this is a negative value.
[in,out]pointUser-defined representation of a point. This parameter distinguishes two uses of the callback. For each quadrant, the callback is first called with a NULL point, and if this callback returns true, once for each point tracked in this branch. The return value for a point determines whether it shall be tracked further down the branch or not, and has no effect on a local leaf. The call with a NULL point is intended to prepare quadrant-related search meta data that is common to all points, and/or to efficiently terminate the recursion for all points in the branch in one call.
Returns
If false, the recursion at quadrant terminates. If true, it continues if pfirst < plast or if they are both equal to p4est->mpirank and the recursion has not reached a leaf yet.

◆ p4est_search_local_t

typedef int(* p4est_search_local_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, p4est_locidx_t local_num, void *point)

Callback function to query the match of a "point" with a quadrant.

This function can be called in two roles: Per-quadrant, in which case the parameter point is NULL, or per-point, possibly many times per quadrant.

Parameters
[in]p4estThe forest to be queried.
[in]which_treeThe tree id under consideration.
[in]quadrantThe quadrant under consideration. This quadrant may be coarser than the quadrants that are contained in the forest (an ancestor), in which case it is a temporary variable and not part of the forest storage. Otherwise, it is a leaf and points directly into the forest storage.
[in]local_numIf the quadrant is not a leaf, this is < 0. Otherwise it is the (non-negative) index of the quadrant relative to the processor-local storage.
[in]pointRepresentation of a "point"; user-defined. If point is NULL, the callback may be used to prepare quadrant-related search meta data.
Returns
If point is NULL, true if the search confined to quadrant should be executed, false to skip it. Else, true if point may be contained in the quadrant and false otherwise; the return value has no effect on a leaf.

◆ p4est_search_partition_t

typedef int(* p4est_search_partition_t) (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant, int pfirst, int plast, void *point)

Callback function for the partition recursion.

Parameters
[in]p4estThe forest to traverse. Its local quadrants are never accessed.
[in]which_treeThe tree number under consideration.
[in]quadrantThis quadrant is not from local forest storage, and its user data is undefined. It represents the branch of the forest in the top-down recursion.
[in]pfirstThe lowest processor that owns part of quadrant. Guaranteed to be non-empty.
[in]plastThe highest processor that owns part of quadrant. Guaranteed to be non-empty. If this is equal to pfirst, then the recursion will stop for quadrant's branch after this function returns.
[in,out]pointPointer to a user-defined point object. If called per-quadrant, this is NULL.
Returns
If false, the recursion at quadrant is terminated. If true, it continues if pfirst < plast.

◆ p4est_search_reorder_t

typedef int(* p4est_search_reorder_t) (p4est_t *p4est, sc_array_t *quadrants, sc_array_t *indices)

Callback function to query, reorder, and reduce a set of quadrants.

It receives an array of quadrants and an array of array indices on input. On output, the array of quadrants is unmodified but the indices may be. This function may permute the indices and/or choose a subset. Subsetting is effected by resizing the index array. Note to resize only before or after, but not during eventual sorting, since resizing may reallocate and thus move the array memory. Indices must remain a permutation.

Parameters
[in]p4estThe forest to be queried.
[in]quadrantsThe quadrant array under consideration, each with valid coordinates and level. The user data piggy1 field of each quadrant contains its tree number. Sorted ascending.
[in,out]indicesThis array holds p4est_topidx_t types. Sorted ascending on input. May be permuted and subset by this function. It is explicitly allowed to sc_array_resize to smaller length. An output length of zero stops recursion.
Returns
Return false to break the search recursion.

Function Documentation

◆ p4est_find_higher_bound()

ssize_t p4est_find_higher_bound ( sc_array_t *  array,
const p4est_quadrant_t q,
size_t  guess 
)

Find the highest position tq in a quadrant array such that tq <= q.

Returns
Returns the id of the matching quadrant or -1 if array > q or the array is empty.

◆ p4est_find_lower_bound()

ssize_t p4est_find_lower_bound ( sc_array_t *  array,
const p4est_quadrant_t q,
size_t  guess 
)

Find the lowest position tq in a quadrant array such that tq >= q.

Returns
Returns the id of the matching quadrant or -1 if array < q or the array is empty.

◆ p4est_find_partition()

void p4est_find_partition ( const int  num_procs,
p4est_gloidx_t search_in,
p4est_gloidx_t  my_begin,
p4est_gloidx_t  my_end,
p4est_gloidx_t begin,
p4est_gloidx_t end 
)

Binary search in partition array.

Given two targets my_begin and my_end, find offsets such that search_in[begin] >= my_begin, my_end <= search_in[end]. If more than one index satisfies the conditions, then the minimal index is the result. If there is no index that satisfies the conditions, then begin and end are tried to set equal such that search_in[begin] >= my_end. If my_begin is less or equal than the smallest value of search_in begin is set to 0 and if my_end is bigger or equal than the largest value of search_in end is set to num_procs - 1. If none of the above conditions is satisfied, the output is not well defined. We require ‘my_begin <= my_begin’.

Parameters
[in]num_procsNumber of processes to get the length of search_in.
[in]search_inThe sorted array (ascending) in that the function will search. If k indexes search_in, then 0 <= k < num_procs.
[in]my_beginThe first target that defines the start of the search window.
[in]my_endThe second target that defines the end of the search window.
[in,out]beginThe first offset such that search_in[begin] >= my_begin.
[in,out]endThe second offset such that my_end <= search_in[end].

◆ p4est_find_quadrant_cumulative()

p4est_quadrant_t * p4est_find_quadrant_cumulative ( p4est_t p4est,
p4est_locidx_t  cumulative_id,
p4est_topidx_t which_tree,
p4est_locidx_t quadrant_id 
)

Search a local quadrant by its cumulative number in the forest.

We perform a binary search over the processor-local trees, which means that it is advisable NOT to use this function if possible, and to try to maintain O(1) tree context information in the calling code.

Parameters
[in]p4estForest to work with.
[in]cumulative_idCumulative index over all trees of quadrant.
[in,out]which_treeIf not NULL, the input value can be -1 or an initial guess for the quadrant's tree. An initial guess must be the index of a nonempty local tree. Output is the tree of returned quadrant.
[out]quadrant_idIf not NULL, the number of quadrant in tree.
Returns
The identified quadrant.

◆ p4est_find_range_boundaries()

int32_t p4est_find_range_boundaries ( p4est_quadrant_t lq,
p4est_quadrant_t uq,
int  level,
int  faces[],
int  corners[] 
)

Find the boundary points touched by a range of quadrants.

Given two smallest quadrants, lq and uq, that mark the first and the last quadrant in a range of quadrants, determine which portions of the tree boundary the range touches.

Parameters
[in]lqThe smallest quadrant at the start of the range: if NULL, the tree's first quadrant is taken to be the start of the range.
[in]uqThe smallest quadrant at the end of the range: if NULL, the tree's last quadrant is taken to be the end of the range.
[in]levelThe level of the containing quadrant whose boundaries are tested: 0 if we want to test the boundaries of the whole tree.
[in,out]facesAn array of size 4 that is filled: faces[i] is true if the range touches that face.
[in,out]cornersAn array of size 4 that is filled: corners[i] is true if the range touches that corner. faces or corners may be NULL.
Returns
Returns an int32_t encoded with the same information in faces and corners: the first (least) four bits represent the four faces, the next four bits represent the four corners.

◆ p4est_search()

void p4est_search ( p4est_t p4est,
p4est_search_query_t  quadrant_fn,
p4est_search_query_t  point_fn,
sc_array_t *  points 
)

This function is provided for backwards compatibility.

We call p4est_search_local with call_post = 0.

◆ p4est_search_all()

void p4est_search_all ( p4est_t p4est,
int  call_post,
p4est_search_all_t  quadrant_fn,
p4est_search_all_t  point_fn,
sc_array_t *  points 
)

Perform a top-down search on the whole forest.

This function combines the functionality of p4est_search_local and p4est_search_partition; their documentation applies for the most part.

The recursion proceeds from the root quadrant of each tree until (a) we encounter a remote quadrant that covers only one processor, or (b) we encounter a local leaf quadrant. In other words, we proceed with the recursion into a quadrant's children if (a) the quadrant is split between two or more processors, no matter whether one of them is the calling processor or not, or (b) if the quadrant is on the local processor but we have not reached a leaf yet.

The search can track one or more points, which are abstract placeholders. They are matched against the quadrants traversed using a callback function. The result of the callback function can be used to stop a recursion early. The user determines how a point is interpreted, we only pass it around.

Note that in the remote case (a), we may terminate the recursion even if the quadrant is not a leaf, which we have no means of knowing. Still, this case is sufficient to determine the processor ownership of a point.

Note
This is a very powerful function that can become slow if not used carefully.
As with the two other search functions in this file, calling it once with many points is generally much faster than calling it once for each point. Using multiple points also allows for a per-quadrant termination of the recursion in addition to a more costly per-point termination.
This function works fine when used for the special cases that either the partition or the local quadrants are not of interest. However, in the case of querying only local information we expect that p4est_search_local will be faster since it employs specific local optimizations.
Parameters
[in]p4estThe forest to be searched.
[in]call_postIf true, call quadrant callback both pre and post point callback, in both cases before recursion (!).
[in]quadrant_fnExecuted once for each quadrant that is entered. If the callback returns false, this quadrant and its descendants are excluded from the search, and the points in this branch are not queried further. Its point argument is always NULL. Callback may be NULL in which case it is ignored.
[in]point_fnExecuted once for each point that is relevant for a quadrant of the search. If it returns true, the point is tracked further down that branch, else it is discarded from the queries for the children. If points is not NULL, this callback must be not NULL. If points is NULL, it is not called.
[in]pointsUser-defined array of points. We do not interpret a point, just pass it into the callbacks. If NULL, only the quadrant_fn callback is executed. If that is NULL, the whole function noops. If not NULL, the point_fn is called on its members during the search.

◆ p4est_search_local()

void p4est_search_local ( p4est_t p4est,
int  call_post,
p4est_search_local_t  quadrant_fn,
p4est_search_local_t  point_fn,
sc_array_t *  points 
)

Search through the local part of a forest.

The search is especially efficient if multiple targets, called "points" below, are searched for simultaneously.

The search runs over all local quadrants and proceeds recursively top-down. For each tree, it may start at the root of that tree, or further down at the root of the subtree that contains all of the tree's local quadrants. Likewise, some intermediate levels in the recursion may be skipped if the processor-local part is contained in a single deeper subtree. The outer loop is thus a depth-first, processor-local forest traversal. Each quadrant in that loop either is a leaf, or a (direct or indirect) strict ancestor of a leaf. On entering a new quadrant, a user-provided quadrant-callback is executed.

As a convenience, the user may provide anonymous "points" that are tracked down the forest. This way one search call may be used for multiple targets. The set of points that potentially matches a given quadrant diminishes from the root down to the leaves: For each quadrant, an inner loop over the potentially matching points executes a point-callback for each candidate that determines whether the point may be a match. If not, it is discarded in the current branch, otherwise it is passed to the next deeper level. The callback is allowed to return true for the same point and more than one quadrant; in this case more than one matching quadrant may be identified. The callback is also allowed to return false for all children of a quadrant that it returned true for earlier. If the point callback returns false for all points relevant to a quadrant, the recursion stops. The points can really be anything, p4est does not perform any interpretation, just passes the pointer along to the callback function.

If points are present and the first quadrant callback returned true, we execute it a second time after calling the point callback for all current points. This can be used to gather and postprocess information about the points more easily. If it returns false, the recursion stops.

If the points are a NULL array, they are ignored and the recursion proceeds by querying the per-quadrant callback. If the points are not NULL but an empty array, the recursion will stop immediately!

Parameters
[in]p4estThe forest to be searched.
[in]call_postIf true, call quadrant callback both pre and post point callback, in both cases before recursion (!).
[in]quadrant_fnExecuted once when a quadrant is entered, and once when it is left (the second time only if points are present and the first call returned true). This quadrant is always local, if not completely then at least one descendant of it. If the callback returns false, this quadrant and its descendants are excluded from the search recursion. Its point argument is always NULL. Callback may be NULL in which case it is ignored.
[in]point_fnIf points is not NULL, must be not NULL. Shall return true for any possible matching point. If points is NULL, this callback is ignored.
[in]pointsUser-defined array of "points". If NULL, only the quadrant_fn callback is executed. If that is NULL, this function noops. If not NULL, the point_fn is called on its members during the search.

◆ p4est_search_partition()

void p4est_search_partition ( p4est_t p4est,
int  call_post,
p4est_search_partition_t  quadrant_fn,
p4est_search_partition_t  point_fn,
sc_array_t *  points 
)

Traverse the global partition top-down.

This is not a collective function. It does not communicate. We proceed top-down through the partition, identically on all processors except for the results of two user-provided callbacks. The recursion will only go down branches that are split between multiple processors. The callback functions can be used to stop a branch recursion even for split branches. This function offers the option to search for arbitrary user-defined points analogously to p4est_search_local.

Note
Traversing the whole processor partition will be at least O(P), so sensible use of the callback function is advised to cut it short.
Parameters
[in]p4estThe forest to traverse. Its local quadrants are never accessed.
[in]call_postIf true, call quadrant callback both pre and post point callback, in both cases before recursion (!).
[in]quadrant_fnThis function controls the recursion, which only continues deeper if this callback returns true for a branch quadrant. It is allowed to set this to NULL.
[in]point_fnThis function decides per-point whether it is followed down the recursion. Must be non-NULL if points are not NULL.
[in]pointsUser-provided array of points that are passed to the callback point_fn. See p4est_search_local for details.

◆ p4est_search_partition_gfp()

void p4est_search_partition_gfp ( const p4est_quadrant_t gfp,
int  nmemb,
p4est_topidx_t  num_trees,
int  call_post,
void *  user,
p4est_search_partition_t  quadrant_fn,
p4est_search_partition_t  point_fn,
sc_array_t *  points 
)

Traverse some given global partition top-down.

The partition can be that of any p4est, not necessarily known to the caller. This is not a collective function. It does not communicate. We proceed top-down through the partition, identically on all processors except for the results of two user-provided callbacks. The recursion will only go down branches that are split between multiple processors. The callback functions can be used to stop a branch recursion even for split branches. This function offers the option to search for arbitrary user-defined points analogously to p4est_search_local. This function is similar to p4est_search_partition_gfx, but does not require the p4est_gloidx_t array gfq. If gfq is available, using p4est_search_partition_gfx is recommended, because it is slightly faster.

Note
Traversing the whole given partition will be at least O(P), so sensible use of the callback function is advised to cut it short.
Parameters
[in]gfpPartition position to traverse. Length nmemb + 1.
[in]nmembNumber of processors encoded in gfp (plus one).
[in]num_treesTree number must match the contents of gfp.
[in]call_postIf true, call quadrant callback both pre and post point callback, in both cases before recursion (!).
[in]userWe pass a dummy p4est to the callbacks whose only valid element is its user_pointer set to user.
[in]quadrant_fnThis function controls the recursion, which only continues deeper if this callback returns true for a branch quadrant. It is allowed to set this to NULL.
[in]point_fnThis function decides per-point whether it is followed down the recursion. Must be non-NULL if points are not NULL.
[in]pointsUser-provided array of points that are passed to the callback point_fn. See p4est_search_local for details.

◆ p4est_search_partition_gfx()

void p4est_search_partition_gfx ( const p4est_gloidx_t gfq,
const p4est_quadrant_t gfp,
int  nmemb,
p4est_topidx_t  num_trees,
int  call_post,
void *  user,
p4est_search_partition_t  quadrant_fn,
p4est_search_partition_t  point_fn,
sc_array_t *  points 
)

Traverse some given global partition top-down.

The partition can be that of any p4est, not necessarily known to the caller. This is not a collective function. It does not communicate. We proceed top-down through the partition, identically on all processors except for the results of two user-provided callbacks. The recursion will only go down branches that are split between multiple processors. The callback functions can be used to stop a branch recursion even for split branches. This function offers the option to search for arbitrary user-defined points analogously to p4est_search_local.

Note
Traversing the whole given partition will be at least O(P), so sensible use of the callback function is advised to cut it short.
Parameters
[in]gfqPartition offsets to traverse. Length nmemb + 1.
[in]gfpPartition position to traverse. Length nmemb + 1.
[in]nmembNumber of processors encoded in gfq (plus one).
[in]num_treesTree number must match the contents of gfq.
[in]call_postIf true, call quadrant callback both pre and post point callback, in both cases before recursion (!).
[in]userWe pass a dummy p4est to the callbacks whose only valid element is its user_pointer set to user.
[in]quadrant_fnThis function controls the recursion, which only continues deeper if this callback returns true for a branch quadrant. It is allowed to set this to NULL.
[in]point_fnThis function decides per-point whether it is followed down the recursion. Must be non-NULL if points are not NULL.
[in]pointsUser-provided array of points that are passed to the callback point_fn. See p4est_search_local for details.

◆ p4est_search_reorder()

void p4est_search_reorder ( p4est_t p4est,
int  skip_levels,
p4est_search_reorder_t  reorder_fn,
p4est_search_local_t  pre_quadrant_fn,
p4est_search_local_t  post_quadrant_fn,
p4est_search_local_t  point_fn,
sc_array_t *  points 
)

Run a depth-first traversal, optionally filtering search points.

There are three main differences to p4est_search_local :

  • Before beginning the recursion, we call the reorder_fn callback with an index array enumerating the local tree roots. The callback may permute its entries to define the order of trees to traverse.
  • After the pre-quadrant callback and its point callbacks, the reorder callback is passed an index array to relevant child numbers of the branch quadrant, ordered but possibly non-contiguous. It may permute these to indicate the sequence of the children to traverse.
  • The post-quadrant callback is executed after the recursion returns. Even for leaves, it is called whenever the pre-callback returned true. Even called when all points have been unmatched by the point callback.
Parameters
[in]p4estThe forest to be searched.
[in]skip_levelsIf true and there is a search window that contains a single descendant, or if all quadrants in the search window are descendants of one child of it, skip the intermediate recursion levels.
[in]reorder_fnCalled with quadrants input array containing either the local tree roots or a set of siblings. The array may be permuted on output to define the order of traversal of the quadrants. May be NULL to omit reordering, always recurse. If not NULL and it returns true, don't recurse.
[in]pre_quadrant_fnAs in p4est_search_local, pre-order callback. If the pre-callback returns false, recursion stops. If it returns true, recursion continues. The quadrant argument is the same pre and post.
[in]post_quadrant_fnAs in p4est_search_local, post-order callback. It is called whenever the pre-callback returns true. The quadrant argument is the same pre and post.
[in]point_fnAs in p4est_search_local.
[in,out]pointsAs in p4est_search_local. May be NULL to use quadrant callbacks only. Otherwise, if no points remain for a particular search quadrant, the recursion stops even if the quadrant callback indicates to continue. This behavior can be prevented by always keeping one bogus point around.

◆ p4est_split_array()

void p4est_split_array ( sc_array_t *  array,
int  level,
size_t  indices[] 
)

Split an array of quadrants by the children of an ancestor.

Given a sorted array of quadrants that have a common ancestor at level level, compute the indices of the first quadrant in each of the common ancestor's children at level level + 1.

Parameters
[in]arrayThe sorted array of quadrants of level > level.
[in]levelThe level at which there is a common ancestor.
[in,out]indicesThe indices of the first quadrant in each of the ancestors's children, plus an additional index on the end. The quadrants of array that are descendants of child i have indices between indices[i] and indices[i + 1] - 1. If indices[i] = indices[i+1], this indicates that no quadrant in the array is contained in child i.