p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p8est_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 P8EST_ALGORITHMS_H
25 #define P8EST_ALGORITHMS_H
26 
27 #include <p8est.h>
28 #include <p8est_extended.h>
29 
30 SC_EXTERN_C_BEGIN;
31 
37 void p8est_quadrant_init_data (p8est_t * p8est,
38  p4est_topidx_t which_tree,
39  p8est_quadrant_t * quad,
40  p8est_init_t init_fn);
41 
45 void p8est_quadrant_free_data (p8est_t * p8est,
46  p8est_quadrant_t * quad);
47 
56 unsigned p8est_quadrant_checksum (sc_array_t * quadrants,
57  sc_array_t * checkarray,
58  size_t first_quadrant);
59 
64 int p8est_tree_is_sorted (p8est_tree_t * tree);
65 
70 int p8est_tree_is_linear (p8est_tree_t * tree);
71 
76 int p8est_tree_is_complete (p8est_tree_t * tree);
77 
82 int p8est_tree_is_almost_sorted (p8est_tree_t * tree,
83  int check_linearity);
84 
98 void p8est_tree_print (int log_priority, p8est_tree_t * tree);
99 
106 int p8est_is_equal (p8est_t * p8est1, p8est_t * p8est2,
107  int compare_data);
108 
117 int p8est_is_valid (p8est_t * p8est);
118 
137 void p8est_tree_compute_overlap (p8est_t * p8est,
138  sc_array_t * in,
139  sc_array_t * out,
141  balance,
142  sc_array_t * borders,
143  sc_array_t * inseeds);
144 
149 void p8est_tree_uniqify_overlap (sc_array_t * out);
150 
156 size_t p8est_tree_remove_nonowned (p8est_t * p8est,
157  p4est_topidx_t which_tree);
158 
178 void p8est_complete_region (p8est_t * p8est,
179  const p8est_quadrant_t * q1,
180  int include_q1,
181  const p8est_quadrant_t * q2,
182  int include_q2,
183  p8est_tree_t * tree,
184  p4est_topidx_t which_tree,
185  p8est_init_t init_fn);
186 
194 void p8est_complete_subtree (p8est_t * p8est,
195  p4est_topidx_t which_tree,
196  p8est_init_t init_fn);
197 
206 void p8est_balance_subtree (p8est_t * p8est,
207  p8est_connect_type_t btype,
208  p4est_topidx_t which_tree,
209  p8est_init_t init_fn);
210 
211 void p8est_balance_border (p8est_t * p8est,
212  p8est_connect_type_t btype,
213  p4est_topidx_t which_tree,
214  p8est_init_t init_fn,
215  p8est_replace_t replace_fn,
216  sc_array_t * borders);
217 
227 size_t p8est_linearize_tree (p8est_t * p8est,
228  p8est_tree_t * tree);
229 
249 p4est_locidx_t p8est_partition_correction (p4est_gloidx_t *
250  partition,
251  int num_procs,
252  int rank,
254  min_quadrant_id,
256  max_quadrant_id);
257 
269 p4est_gloidx_t p8est_partition_for_coarsening (p8est_t * p8est,
271  num_quadrants_in_proc);
272 
283 int p8est_next_nonempty_process (int rank,
284  int num_procs,
286  num_quadrants_in_proc);
287 
298 p4est_gloidx_t p8est_partition_given (p8est_t * p8est,
299  const p4est_locidx_t *
300  num_quadrants_in_proc);
301 
302 SC_EXTERN_C_END;
303 
304 #endif /* !P8EST_ALGORITHMS_H */
Interface routines with extended capabilities.
p8est_connect_type_t
Characterize a type of adjacency.
Definition: p8est_connectivity.h:79
The top-level 3D p8est interface.
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:84
The 3D quadrant (i.e.
Definition: p8est.h:61
The p8est forest datatype.
Definition: p8est.h:125
void(* p8est_init_t)(p8est_t *p8est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant)
Callback function prototype to initialize the quadrant's user data.
Definition: p8est.h:180
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
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
The p8est tree datatype.
Definition: p8est.h:104
void(* p8est_replace_t)(p8est_t *p8est, p4est_topidx_t which_tree, int num_outgoing, p8est_quadrant_t *outgoing[], int num_incoming, p8est_quadrant_t *incoming[])
Callback function prototype to replace one set of quadrants with another.
Definition: p8est_extended.h:104