p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
p4est_algorithms.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 
33 #ifndef P4EST_ALGORITHMS_H
34 #define P4EST_ALGORITHMS_H
35 
36 #include <p4est.h>
37 #include <p4est_extended.h>
38 
39 SC_EXTERN_C_BEGIN;
40 
47  p4est_topidx_t which_tree,
48  p4est_quadrant_t * quad,
49  p4est_init_t init_fn);
50 
55  p4est_quadrant_t * quad);
56 
65 unsigned p4est_quadrant_checksum (sc_array_t * quadrants,
66  sc_array_t * checkarray,
67  size_t first_quadrant);
68 
85  const p4est_quadrant_t * ld,
86  const p4est_quadrant_t *
87  quadrant);
88 
94 
100 
106 
112  int check_linearity);
113 
127 void p4est_tree_print (int log_priority, p4est_tree_t * tree);
128 
135 int p4est_is_equal (p4est_t * p4est1, p4est_t * p4est2,
136  int compare_data);
137 
150 
170  sc_array_t * in,
171  sc_array_t * out,
172  p4est_connect_type_t balance,
173  sc_array_t * borders,
174  sc_array_t * inseeds);
175 
181 
188  p4est_topidx_t which_tree);
189 
210  const p4est_quadrant_t * q1,
211  int include_q1,
212  const p4est_quadrant_t * q2,
213  int include_q2,
214  p4est_tree_t * tree,
215  p4est_topidx_t which_tree,
216  p4est_init_t init_fn);
217 
229  p4est_topidx_t which_tree,
230  p4est_init_t init_fn);
231 
241  p4est_connect_type_t btype,
242  p4est_topidx_t which_tree,
243  p4est_init_t init_fn);
244 
245 void p4est_balance_border (p4est_t * p4est,
246  p4est_connect_type_t btype,
247  p4est_topidx_t which_tree,
248  p4est_init_t init_fn,
249  p4est_replace_t replace_fn,
250  sc_array_t * borders);
251 
262  p4est_tree_t * tree);
263 
284  partition,
285  int num_procs,
286  int rank,
288  min_quadrant_id,
290  max_quadrant_id);
291 
305  num_quadrants_in_proc);
306 
318  int num_procs,
320  num_quadrants_in_proc);
321 
333  const p4est_locidx_t *
334  num_quadrants_in_proc);
335 
336 SC_EXTERN_C_END;
337 
338 #endif /* !P4EST_ALGORITHMS_H */
The top-level 2D p4est interface.
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:203
int p4est_quadrant_in_range(const p4est_quadrant_t *fd, const p4est_quadrant_t *ld, const p4est_quadrant_t *quadrant)
Report whether a quadrant fits into the limits of a quadrant range.
size_t p4est_linearize_tree(p4est_t *p4est, p4est_tree_t *tree)
Remove overlaps from a sorted list of quadrants.
int p4est_is_valid(p4est_t *p4est)
Check a forest for validity and allreduce the result.
void p4est_tree_print(int log_priority, p4est_tree_t *tree)
Print the quadrants in a tree.
int p4est_is_equal(p4est_t *p4est1, p4est_t *p4est2, int compare_data)
Locally check forest/connectivity structures for equality.
unsigned p4est_quadrant_checksum(sc_array_t *quadrants, sc_array_t *checkarray, size_t first_quadrant)
Computes a machine-independent checksum of a list of quadrants.
int p4est_tree_is_linear(p4est_tree_t *tree)
Test if a tree is sorted in Morton ordering and linear.
int p4est_tree_is_almost_sorted(p4est_tree_t *tree, int check_linearity)
Check if a tree is sorted/linear except for diagonally outside corners.
int p4est_next_nonempty_process(int rank, int num_procs, p4est_locidx_t *num_quadrants_in_proc)
Find next non-empty process.
void p4est_tree_uniqify_overlap(sc_array_t *out)
Gets the reduced representation of the overlap that results from using p4est_tree_compute_overlap_new...
void p4est_quadrant_init_data(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quad, p4est_init_t init_fn)
Alloc and initialize the user data of a valid quadrant.
void p4est_complete_region(p4est_t *p4est, const p4est_quadrant_t *q1, int include_q1, const p4est_quadrant_t *q2, int include_q2, p4est_tree_t *tree, p4est_topidx_t which_tree, p4est_init_t init_fn)
Constructs a minimal linear octree between two octants.
p4est_gloidx_t p4est_partition_given(p4est_t *p4est, const p4est_locidx_t *num_quadrants_in_proc)
Partition p4est given the number of quadrants per proc.
int p4est_tree_is_sorted(p4est_tree_t *tree)
Test if a tree is sorted in Morton ordering.
p4est_locidx_t p4est_partition_correction(p4est_gloidx_t *partition, int num_procs, int rank, p4est_gloidx_t min_quadrant_id, p4est_gloidx_t max_quadrant_id)
Compute correction of partition for a process.
void p4est_quadrant_free_data(p4est_t *p4est, p4est_quadrant_t *quad)
Free the user data of a valid quadrant.
void p4est_balance_subtree(p4est_t *p4est, p4est_connect_type_t btype, p4est_topidx_t which_tree, p4est_init_t init_fn)
Balances a sorted tree within a p4est.
int p4est_tree_is_complete(p4est_tree_t *tree)
Test if a tree is sorted in Morton ordering and complete.
p4est_gloidx_t p4est_partition_for_coarsening(p4est_t *p4est, p4est_locidx_t *num_quadrants_in_proc)
Correct partition counters to allow one level of coarsening.
void p4est_tree_compute_overlap(p4est_t *p4est, sc_array_t *in, sc_array_t *out, p4est_connect_type_t balance, sc_array_t *borders, sc_array_t *inseeds)
Compute the overlap of a number of insulation layers with a tree.
size_t p4est_tree_remove_nonowned(p4est_t *p4est, p4est_topidx_t which_tree)
Removes quadrants that are outside the owned tree boundaries from a tree.
void p4est_complete_subtree(p4est_t *p4est, p4est_topidx_t which_tree, p4est_init_t init_fn)
Completes a sorted tree within a p4est.
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
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:88
Interface routines with extended capabilities.
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:110
The 2D quadrant datatype.
Definition: p4est.h:72
The p4est tree datatype.
Definition: p4est.h:115
The p4est forest datatype.
Definition: p4est.h:136