p4est  1.0
src/p8est_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 P8EST_ALGORITHMS_H
00025 #define P8EST_ALGORITHMS_H
00026 
00027 #include <p8est.h>
00028 #include <p8est_extended.h>
00029 
00030 SC_EXTERN_C_BEGIN;
00031 
00037 void                p8est_quadrant_init_data (p8est_t * p8est,
00038                                               p4est_topidx_t which_tree,
00039                                               p8est_quadrant_t * quad,
00040                                               p8est_init_t init_fn);
00041 
00045 void                p8est_quadrant_free_data (p8est_t * p8est,
00046                                               p8est_quadrant_t * quad);
00047 
00056 unsigned            p8est_quadrant_checksum (sc_array_t * quadrants,
00057                                              sc_array_t * checkarray,
00058                                              size_t first_quadrant);
00059 
00064 int                 p8est_tree_is_sorted (p8est_tree_t * tree);
00065 
00070 int                 p8est_tree_is_linear (p8est_tree_t * tree);
00071 
00076 int                 p8est_tree_is_complete (p8est_tree_t * tree);
00077 
00082 int                 p8est_tree_is_almost_sorted (p8est_tree_t * tree,
00083                                                  int check_linearity);
00084 
00098 void                p8est_tree_print (int log_priority, p8est_tree_t * tree);
00099 
00106 int                 p8est_is_equal (p8est_t * p8est1, p8est_t * p8est2,
00107                                     int compare_data);
00108 
00117 int                 p8est_is_valid (p8est_t * p8est);
00118 
00137 void                p8est_tree_compute_overlap (p8est_t * p8est,
00138                                                 sc_array_t * in,
00139                                                 sc_array_t * out,
00140                                                 p8est_connect_type_t
00141                                                 balance,
00142                                                 sc_array_t * borders,
00143                                                 sc_array_t * inseeds);
00144 
00149 void                p8est_tree_uniqify_overlap (sc_array_t * out);
00150 
00156 size_t              p8est_tree_remove_nonowned (p8est_t * p8est,
00157                                                 p4est_topidx_t which_tree);
00158 
00178 void                p8est_complete_region (p8est_t * p8est,
00179                                            const p8est_quadrant_t * q1,
00180                                            int include_q1,
00181                                            const p8est_quadrant_t * q2,
00182                                            int include_q2,
00183                                            p8est_tree_t * tree,
00184                                            p4est_topidx_t which_tree,
00185                                            p8est_init_t init_fn);
00186 
00194 void                p8est_complete_subtree (p8est_t * p8est,
00195                                             p4est_topidx_t which_tree,
00196                                             p8est_init_t init_fn);
00197 
00206 void                p8est_balance_subtree (p8est_t * p8est,
00207                                            p8est_connect_type_t btype,
00208                                            p4est_topidx_t which_tree,
00209                                            p8est_init_t init_fn);
00210 
00211 void                p8est_balance_border (p8est_t * p8est,
00212                                           p8est_connect_type_t btype,
00213                                           p4est_topidx_t which_tree,
00214                                           p8est_init_t init_fn,
00215                                           p8est_replace_t replace_fn,
00216                                           sc_array_t * borders);
00217 
00227 size_t              p8est_linearize_tree (p8est_t * p8est,
00228                                           p8est_tree_t * tree);
00229 
00249 p4est_locidx_t      p8est_partition_correction (p4est_gloidx_t *
00250                                                 partition,
00251                                                 int num_procs,
00252                                                 int rank,
00253                                                 p4est_gloidx_t
00254                                                 min_quadrant_id,
00255                                                 p4est_gloidx_t
00256                                                 max_quadrant_id);
00257 
00269 p4est_gloidx_t      p8est_partition_for_coarsening (p8est_t * p8est,
00270                                                     p4est_locidx_t *
00271                                                     num_quadrants_in_proc);
00272 
00283 int                 p8est_next_nonempty_process (int rank,
00284                                                  int num_procs,
00285                                                  p4est_locidx_t *
00286                                                  num_quadrants_in_proc);
00287 
00298 p4est_gloidx_t      p8est_partition_given (p8est_t * p8est,
00299                                            const p4est_locidx_t *
00300                                            num_quadrants_in_proc);
00301 
00302 SC_EXTERN_C_END;
00303 
00304 #endif /* !P8EST_ALGORITHMS_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines