p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
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 
89 void p4est_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 p4est_quadrant_t * q,
102  size_t guess);
103 
109  const p4est_quadrant_t * q,
110  size_t guess);
111 
130  cumulative_id,
132  which_tree,
134  quadrant_id);
135 
152 void p4est_split_array (sc_array_t * array, int level,
153  size_t indices[]);
154 
179  p4est_quadrant_t * uq,
180  int level, int faces[],
181  int corners[]);
182 
209  p4est_topidx_t which_tree,
210  p4est_quadrant_t * quadrant,
211  p4est_locidx_t local_num,
212  void *point);
213 
216 
276 void p4est_search_local (p4est_t * p4est, int call_post,
277  p4est_search_local_t quadrant_fn,
278  p4est_search_local_t point_fn,
279  sc_array_t * points);
280 
285  p4est_search_query_t quadrant_fn,
286  p4est_search_query_t point_fn,
287  sc_array_t * points);
288 
310  sc_array_t * quadrants,
311  sc_array_t * indices);
312 
355  int skip_levels,
356  p4est_search_reorder_t reorder_fn,
358  pre_quadrant_fn,
360  post_quadrant_fn,
361  p4est_search_local_t point_fn,
362  sc_array_t * points);
363 
383  p4est_topidx_t which_tree,
384  p4est_quadrant_t * quadrant,
385  int pfirst, int plast,
386  void *point);
387 
412 void p4est_search_partition (p4est_t * p4est, int call_post,
414  quadrant_fn,
415  p4est_search_partition_t point_fn,
416  sc_array_t * points);
417 
467 typedef int (*p4est_search_all_t) (p4est_t * p4est,
468  p4est_topidx_t which_tree,
469  p4est_quadrant_t * quadrant,
470  int pfirst, int plast,
471  p4est_locidx_t local_num,
472  void *point);
473 
533 void p4est_search_all (p4est_t * p4est, int call_post,
534  p4est_search_all_t quadrant_fn,
535  p4est_search_all_t point_fn,
536  sc_array_t * points);
537 
538 SC_EXTERN_C_END;
539 
540 #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:309
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.
p4est_search_local_t p4est_search_query_t
This typedef is provided for backwards compatibility.
Definition: p4est_search.h:215
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(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:382
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:208
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:467
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:72
The p4est forest datatype.
Definition: p4est.h:136