p4est  1.0
src/p4est_algorithms.h
00001 /*
00002   This file is part of p4est.
00003   p4est is a C library to manage a collection (a forest) of multiple
00004   connected adaptive quadtrees or octrees in parallel.
00005 
00006   Copyright (C) 2010 The University of Texas System
00007   Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
00008 
00009   p4est is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   p4est is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with p4est; if not, write to the Free Software Foundation, Inc.,
00021   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #ifndef P4EST_ALGORITHMS_H
00025 #define P4EST_ALGORITHMS_H
00026 
00027 #include <p4est.h>
00028 #include <p4est_extended.h>
00029 
00030 SC_EXTERN_C_BEGIN;
00031 
00037 void                p4est_quadrant_init_data (p4est_t * p4est,
00038                                               p4est_topidx_t which_tree,
00039                                               p4est_quadrant_t * quad,
00040                                               p4est_init_t init_fn);
00041 
00045 void                p4est_quadrant_free_data (p4est_t * p4est,
00046                                               p4est_quadrant_t * quad);
00047 
00056 unsigned            p4est_quadrant_checksum (sc_array_t * quadrants,
00057                                              sc_array_t * checkarray,
00058                                              size_t first_quadrant);
00059 
00064 int                 p4est_tree_is_sorted (p4est_tree_t * tree);
00065 
00070 int                 p4est_tree_is_linear (p4est_tree_t * tree);
00071 
00076 int                 p4est_tree_is_complete (p4est_tree_t * tree);
00077 
00082 int                 p4est_tree_is_almost_sorted (p4est_tree_t * tree,
00083                                                  int check_linearity);
00084 
00098 void                p4est_tree_print (int log_priority, p4est_tree_t * tree);
00099 
00106 int                 p4est_is_equal (p4est_t * p4est1, p4est_t * p4est2,
00107                                     int compare_data);
00108 
00117 int                 p4est_is_valid (p4est_t * p4est);
00118 
00137 void                p4est_tree_compute_overlap (p4est_t * p4est,
00138                                                 sc_array_t * in,
00139                                                 sc_array_t * out,
00140                                                 p4est_connect_type_t balance,
00141                                                 sc_array_t * borders,
00142                                                 sc_array_t * inseeds);
00143 
00148 void                p4est_tree_uniqify_overlap (sc_array_t * out);
00149 
00155 size_t              p4est_tree_remove_nonowned (p4est_t * p4est,
00156                                                 p4est_topidx_t which_tree);
00157 
00177 void                p4est_complete_region (p4est_t * p4est,
00178                                            const p4est_quadrant_t * q1,
00179                                            int include_q1,
00180                                            const p4est_quadrant_t * q2,
00181                                            int include_q2,
00182                                            p4est_tree_t * tree,
00183                                            p4est_topidx_t which_tree,
00184                                            p4est_init_t init_fn);
00185 
00193 void                p4est_complete_subtree (p4est_t * p4est,
00194                                             p4est_topidx_t which_tree,
00195                                             p4est_init_t init_fn);
00196 
00205 void                p4est_balance_subtree (p4est_t * p4est,
00206                                            p4est_connect_type_t btype,
00207                                            p4est_topidx_t which_tree,
00208                                            p4est_init_t init_fn);
00209 
00210 void                p4est_balance_border (p4est_t * p4est,
00211                                           p4est_connect_type_t btype,
00212                                           p4est_topidx_t which_tree,
00213                                           p4est_init_t init_fn,
00214                                           p4est_replace_t replace_fn,
00215                                           sc_array_t * borders);
00216 
00226 size_t              p4est_linearize_tree (p4est_t * p4est,
00227                                           p4est_tree_t * tree);
00228 
00248 p4est_locidx_t      p4est_partition_correction (p4est_gloidx_t *
00249                                                 partition,
00250                                                 int num_procs,
00251                                                 int rank,
00252                                                 p4est_gloidx_t
00253                                                 min_quadrant_id,
00254                                                 p4est_gloidx_t
00255                                                 max_quadrant_id);
00256 
00268 p4est_gloidx_t      p4est_partition_for_coarsening (p4est_t * p4est,
00269                                                     p4est_locidx_t *
00270                                                     num_quadrants_in_proc);
00271 
00282 int                 p4est_next_nonempty_process (int rank,
00283                                                  int num_procs,
00284                                                  p4est_locidx_t *
00285                                                  num_quadrants_in_proc);
00286 
00297 p4est_gloidx_t      p4est_partition_given (p4est_t * p4est,
00298                                            const p4est_locidx_t *
00299                                            num_quadrants_in_proc);
00300 
00301 SC_EXTERN_C_END;
00302 
00303 #endif /* !P4EST_ALGORITHMS_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines