p4est  2.8.7
p4est is a software library for parallel adaptive mesh refinement.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
p8est_search.h
Go to the documentation of this file.
1 /*
2  This file is part of p4est.
3  p4est is a C library to manage a collection (a forest) of multiple
4  connected adaptive quadtrees or octrees in parallel.
5 
6  Copyright (C) 2010 The University of Texas System
7  Additional copyright (C) 2011 individual authors
8  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
9 
10  p4est is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  p4est is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with p4est; if not, write to the Free Software Foundation, Inc.,
22  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24 
25 #ifndef P8EST_SEARCH_H
26 #define P8EST_SEARCH_H
27 
60 #include <p8est.h>
61 
62 SC_EXTERN_C_BEGIN;
63 
91 void p8est_find_partition (const int num_procs,
92  p4est_gloidx_t * search_in,
93  p4est_gloidx_t my_begin,
94  p4est_gloidx_t my_end,
95  p4est_gloidx_t * begin,
96  p4est_gloidx_t * end);
97 
102 ssize_t p8est_find_lower_bound (sc_array_t * array,
103  const p8est_quadrant_t * q,
104  size_t guess);
105 
110 ssize_t p8est_find_higher_bound (sc_array_t * array,
111  const p8est_quadrant_t * q,
112  size_t guess);
113 
132  cumulative_id,
134  which_tree,
136  quadrant_id);
137 
155 void p8est_split_array (sc_array_t * array, int level,
156  size_t indices[]);
157 
186  p8est_quadrant_t * uq,
187  int level, int faces[],
188  int edges[], int corners[]);
189 
216  p4est_topidx_t which_tree,
217  p8est_quadrant_t * quadrant,
218  p4est_locidx_t local_num,
219  void *point);
220 
223 
284 void p8est_search_local (p8est_t * p4est, int call_post,
285  p8est_search_local_t quadrant_fn,
286  p8est_search_local_t point_fn,
287  sc_array_t * points);
288 
293  p8est_search_query_t quadrant_fn,
294  p8est_search_query_t point_fn,
295  sc_array_t * points);
296 
320  sc_array_t * quadrants,
321  sc_array_t * indices);
322 
366  int skip_levels,
367  p8est_search_reorder_t reorder_fn,
369  pre_quadrant_fn,
371  post_quadrant_fn,
372  p8est_search_local_t point_fn,
373  sc_array_t * points);
374 
395  p4est_topidx_t which_tree,
396  p8est_quadrant_t * quadrant,
397  int pfirst, int plast,
398  void *point);
399 
424 void p8est_search_partition (p8est_t *p4est, int call_post,
426  quadrant_fn,
427  p8est_search_partition_t point_fn,
428  sc_array_t *points);
429 
461  (const p4est_gloidx_t *gfq, const p8est_quadrant_t *gfp,
462  int nmemb, p4est_topidx_t num_trees, int call_post, void *user,
464  sc_array_t *points);
465 
499  (const p8est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees,
500  int call_post, void *user, p8est_search_partition_t quadrant_fn,
501  p8est_search_partition_t point_fn, sc_array_t *points);
502 
553 typedef int (*p8est_search_all_t) (p8est_t * p4est,
554  p4est_topidx_t which_tree,
555  p8est_quadrant_t * quadrant,
556  int pfirst, int plast,
557  p4est_locidx_t local_num,
558  void *point);
559 
619 void p8est_search_all (p8est_t * p4est, int call_post,
620  p8est_search_all_t quadrant_fn,
621  p8est_search_all_t point_fn,
622  sc_array_t * points);
623 
624 SC_EXTERN_C_END;
625 
626 #endif /* !P8EST_SEARCH_H */
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:93
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:106
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
The top-level 3D p8est interface.
void p8est_search_partition(p8est_t *p4est, int call_post, p8est_search_partition_t quadrant_fn, p8est_search_partition_t point_fn, sc_array_t *points)
Traverse the global partition top-down.
p8est_quadrant_t * p8est_find_quadrant_cumulative(p8est_t *p8est, 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.
int32_t p8est_find_range_boundaries(p8est_quadrant_t *lq, p8est_quadrant_t *uq, int level, int faces[], int edges[], int corners[])
Find the boundary points touched by a range of quadrants.
void p8est_search_local(p8est_t *p4est, int call_post, p8est_search_local_t quadrant_fn, p8est_search_local_t point_fn, sc_array_t *points)
Search through the local part of a forest.
void p8est_search_partition_gfp(const p8est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees, int call_post, void *user, p8est_search_partition_t quadrant_fn, p8est_search_partition_t point_fn, sc_array_t *points)
Traverse some given global partition top-down.
void p8est_split_array(sc_array_t *array, int level, size_t indices[])
Split an array of quadrants by the children of an ancestor.
void p8est_search(p8est_t *p4est, p8est_search_query_t quadrant_fn, p8est_search_query_t point_fn, sc_array_t *points)
This function is provided for backwards compatibility.
void p8est_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.
int(* p8est_search_reorder_t)(p8est_t *p4est, sc_array_t *quadrants, sc_array_t *indices)
Callback function to query, reorder, and reduce a set of quadrants.
Definition: p8est_search.h:319
ssize_t p8est_find_lower_bound(sc_array_t *array, const p8est_quadrant_t *q, size_t guess)
Find the lowest position tq in a quadrant array such that tq >= q.
void p8est_search_all(p8est_t *p4est, int call_post, p8est_search_all_t quadrant_fn, p8est_search_all_t point_fn, sc_array_t *points)
Perform a top-down search on the whole forest.
int(* p8est_search_partition_t)(p8est_t *p4est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant, int pfirst, int plast, void *point)
Callback function for the partition recursion.
Definition: p8est_search.h:394
void p8est_search_partition_gfx(const p4est_gloidx_t *gfq, const p8est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees, int call_post, void *user, p8est_search_partition_t quadrant_fn, p8est_search_partition_t point_fn, sc_array_t *points)
Traverse some given global partition top-down.
int(* p8est_search_all_t)(p8est_t *p4est, p4est_topidx_t which_tree, p8est_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.
Definition: p8est_search.h:553
int(* p8est_search_local_t)(p8est_t *p4est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant, p4est_locidx_t local_num, void *point)
Callback function to query the match of a "point" with a quadrant.
Definition: p8est_search.h:215
ssize_t p8est_find_higher_bound(sc_array_t *array, const p8est_quadrant_t *q, size_t guess)
Find the highest position tq in a quadrant array such that tq <= q.
p8est_search_local_t p8est_search_query_t
This typedef is provided for backwards compatibility.
Definition: p8est_search.h:222
void p8est_search_reorder(p8est_t *p4est, int skip_levels, p8est_search_reorder_t reorder_fn, p8est_search_local_t pre_quadrant_fn, p8est_search_local_t post_quadrant_fn, p8est_search_local_t point_fn, sc_array_t *points)
Run a depth-first traversal, optionally filtering search points.
The p4est forest datatype.
Definition: p4est.h:150
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:72
The p8est forest datatype.
Definition: p8est.h:146