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
p4est_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 P4EST_SEARCH_H
26 #define P4EST_SEARCH_H
27 
60 #include <p4est.h>
61 
62 SC_EXTERN_C_BEGIN;
63 
91 void p4est_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 p4est_find_lower_bound (sc_array_t * array,
103  const p4est_quadrant_t * q,
104  size_t guess);
105 
110 ssize_t p4est_find_higher_bound (sc_array_t * array,
111  const p4est_quadrant_t * q,
112  size_t guess);
113 
132  cumulative_id,
134  which_tree,
136  quadrant_id);
137 
155 void p4est_split_array (sc_array_t * array, int level,
156  size_t indices[]);
157 
183  p4est_quadrant_t * uq,
184  int level, int faces[],
185  int corners[]);
186 
213  p4est_topidx_t which_tree,
214  p4est_quadrant_t * quadrant,
215  p4est_locidx_t local_num,
216  void *point);
217 
220 
281 void p4est_search_local (p4est_t * p4est, int call_post,
282  p4est_search_local_t quadrant_fn,
283  p4est_search_local_t point_fn,
284  sc_array_t * points);
285 
290  p4est_search_query_t quadrant_fn,
291  p4est_search_query_t point_fn,
292  sc_array_t * points);
293 
317  sc_array_t * quadrants,
318  sc_array_t * indices);
319 
363  int skip_levels,
364  p4est_search_reorder_t reorder_fn,
366  pre_quadrant_fn,
368  post_quadrant_fn,
369  p4est_search_local_t point_fn,
370  sc_array_t * points);
371 
392  p4est_topidx_t which_tree,
393  p4est_quadrant_t * quadrant,
394  int pfirst, int plast,
395  void *point);
396 
422 void p4est_search_partition (p4est_t *p4est, int call_post,
424  quadrant_fn,
425  p4est_search_partition_t point_fn,
426  sc_array_t *points);
427 
459  (const p4est_gloidx_t *gfq, const p4est_quadrant_t *gfp,
460  int nmemb, p4est_topidx_t num_trees, int call_post, void *user,
462  sc_array_t *points);
463 
497  (const p4est_quadrant_t *gfp, int nmemb, p4est_topidx_t num_trees,
498  int call_post, void *user, p4est_search_partition_t quadrant_fn,
499  p4est_search_partition_t point_fn, sc_array_t *points);
500 
551 typedef int (*p4est_search_all_t) (p4est_t * p4est,
552  p4est_topidx_t which_tree,
553  p4est_quadrant_t * quadrant,
554  int pfirst, int plast,
555  p4est_locidx_t local_num,
556  void *point);
557 
617 void p4est_search_all (p4est_t * p4est, int call_post,
618  p4est_search_all_t quadrant_fn,
619  p4est_search_all_t point_fn,
620  sc_array_t * points);
621 
622 SC_EXTERN_C_END;
623 
624 #endif /* !P4EST_SEARCH_H */
The top-level 2D p4est interface.
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
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.
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.
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.
Definition: p4est_search.h:316
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.
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.
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.
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.
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.
p4est_search_local_t p4est_search_query_t
This typedef is provided for backwards compatibility.
Definition: p4est_search.h:219
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.
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.
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.
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.
Definition: p4est_search.h:391
void p4est_split_array(sc_array_t *array, int level, size_t indices[])
Split an array of quadrants by the children of an ancestor.
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.
Definition: p4est_search.h:212
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.
Definition: p4est_search.h:551
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.
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.
The 2D quadrant datatype.
Definition: p4est.h:76
The p4est forest datatype.
Definition: p4est.h:150