p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p4est_algorithms.h
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  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
8 
9  p4est is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with p4est; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef P4EST_ALGORITHMS_H
25 #define P4EST_ALGORITHMS_H
26 
27 #include <p4est.h>
28 #include <p4est_extended.h>
29 
30 SC_EXTERN_C_BEGIN;
31 
37 void p4est_quadrant_init_data (p4est_t * p4est,
38  p4est_topidx_t which_tree,
39  p4est_quadrant_t * quad,
40  p4est_init_t init_fn);
41 
45 void p4est_quadrant_free_data (p4est_t * p4est,
46  p4est_quadrant_t * quad);
47 
56 unsigned p4est_quadrant_checksum (sc_array_t * quadrants,
57  sc_array_t * checkarray,
58  size_t first_quadrant);
59 
64 int p4est_tree_is_sorted (p4est_tree_t * tree);
65 
70 int p4est_tree_is_linear (p4est_tree_t * tree);
71 
76 int p4est_tree_is_complete (p4est_tree_t * tree);
77 
82 int p4est_tree_is_almost_sorted (p4est_tree_t * tree,
83  int check_linearity);
84 
98 void p4est_tree_print (int log_priority, p4est_tree_t * tree);
99 
106 int p4est_is_equal (p4est_t * p4est1, p4est_t * p4est2,
107  int compare_data);
108 
117 int p4est_is_valid (p4est_t * p4est);
118 
137 void p4est_tree_compute_overlap (p4est_t * p4est,
138  sc_array_t * in,
139  sc_array_t * out,
140  p4est_connect_type_t balance,
141  sc_array_t * borders,
142  sc_array_t * inseeds);
143 
148 void p4est_tree_uniqify_overlap (sc_array_t * out);
149 
155 size_t p4est_tree_remove_nonowned (p4est_t * p4est,
156  p4est_topidx_t which_tree);
157 
177 void p4est_complete_region (p4est_t * p4est,
178  const p4est_quadrant_t * q1,
179  int include_q1,
180  const p4est_quadrant_t * q2,
181  int include_q2,
182  p4est_tree_t * tree,
183  p4est_topidx_t which_tree,
184  p4est_init_t init_fn);
185 
193 void p4est_complete_subtree (p4est_t * p4est,
194  p4est_topidx_t which_tree,
195  p4est_init_t init_fn);
196 
205 void p4est_balance_subtree (p4est_t * p4est,
206  p4est_connect_type_t btype,
207  p4est_topidx_t which_tree,
208  p4est_init_t init_fn);
209 
210 void p4est_balance_border (p4est_t * p4est,
211  p4est_connect_type_t btype,
212  p4est_topidx_t which_tree,
213  p4est_init_t init_fn,
214  p4est_replace_t replace_fn,
215  sc_array_t * borders);
216 
226 size_t p4est_linearize_tree (p4est_t * p4est,
227  p4est_tree_t * tree);
228 
248 p4est_locidx_t p4est_partition_correction (p4est_gloidx_t *
249  partition,
250  int num_procs,
251  int rank,
253  min_quadrant_id,
255  max_quadrant_id);
256 
268 p4est_gloidx_t p4est_partition_for_coarsening (p4est_t * p4est,
270  num_quadrants_in_proc);
271 
282 int p4est_next_nonempty_process (int rank,
283  int num_procs,
285  num_quadrants_in_proc);
286 
297 p4est_gloidx_t p4est_partition_given (p4est_t * p4est,
298  const p4est_locidx_t *
299  num_quadrants_in_proc);
300 
301 SC_EXTERN_C_END;
302 
303 #endif /* !P4EST_ALGORITHMS_H */
Interface routines with extended capabilities.
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:84
The p4est forest datatype.
Definition: p4est.h:129
The top-level 2D p4est interface.
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:77
The p4est tree datatype.
Definition: p4est.h:108
void(* p4est_init_t)(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Callback function prototype to initialize the quadrant's user data.
Definition: p4est.h:184
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
void(* p4est_replace_t)(p4est_t *p4est, p4est_topidx_t which_tree, int num_outgoing, p4est_quadrant_t *outgoing[], int num_incoming, p4est_quadrant_t *incoming[])
Callback function prototype to replace one set of quadrants with another.
Definition: p4est_extended.h:104
The 2D quadrant datatype.
Definition: p4est.h:65