p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
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 
89 void p8est_find_partition (const int num_procs,
90  p4est_gloidx_t * search_in,
91  p4est_gloidx_t my_begin,
92  p4est_gloidx_t my_end,
93  p4est_gloidx_t * begin,
94  p4est_gloidx_t * end);
95 
101  const p8est_quadrant_t * q,
102  size_t guess);
103 
109  const p8est_quadrant_t * q,
110  size_t guess);
111 
130  cumulative_id,
132  which_tree,
134  quadrant_id);
135 
152 void p8est_split_array (sc_array_t * array, int level,
153  size_t indices[]);
154 
182  p8est_quadrant_t * uq,
183  int level, int faces[],
184  int edges[], int corners[]);
185 
212  p4est_topidx_t which_tree,
213  p8est_quadrant_t * quadrant,
214  p4est_locidx_t local_num,
215  void *point);
216 
219 
279 void p8est_search_local (p8est_t * p4est, int call_post,
280  p8est_search_local_t quadrant_fn,
281  p8est_search_local_t point_fn,
282  sc_array_t * points);
283 
288  p8est_search_query_t quadrant_fn,
289  p8est_search_query_t point_fn,
290  sc_array_t * points);
291 
313  sc_array_t * quadrants,
314  sc_array_t * indices);
315 
358  int skip_levels,
359  p8est_search_reorder_t reorder_fn,
361  pre_quadrant_fn,
363  post_quadrant_fn,
364  p8est_search_local_t point_fn,
365  sc_array_t * points);
366 
386  p4est_topidx_t which_tree,
387  p8est_quadrant_t * quadrant,
388  int pfirst, int plast,
389  void *point);
390 
415 void p8est_search_partition (p8est_t * p4est, int call_post,
417  quadrant_fn,
418  p8est_search_partition_t point_fn,
419  sc_array_t * points);
420 
470 typedef int (*p8est_search_all_t) (p8est_t * p8est,
471  p4est_topidx_t which_tree,
472  p8est_quadrant_t * quadrant,
473  int pfirst, int plast,
474  p4est_locidx_t local_num,
475  void *point);
476 
536 void p8est_search_all (p8est_t * p4est, int call_post,
537  p8est_search_all_t quadrant_fn,
538  p8est_search_all_t point_fn,
539  sc_array_t * points);
540 
541 SC_EXTERN_C_END;
542 
543 #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_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:312
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.
int(* p8est_search_all_t)(p8est_t *p8est, 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:470
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:385
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:211
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:218
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:136
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:68
The p8est forest datatype.
Definition: p8est.h:132