p4est  1.0
src/p8est_ghost.h
Go to the documentation of this file.
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 
00031 #ifndef P8EST_GHOST_H
00032 #define P8EST_GHOST_H
00033 
00034 #include <p8est.h>
00035 
00036 SC_EXTERN_C_BEGIN;
00037 
00039 typedef struct
00040 {
00041   int                 mpisize;
00042   p4est_topidx_t      num_trees;
00043   p8est_connect_type_t btype; 
00052   sc_array_t          ghosts; 
00053   p4est_locidx_t     *tree_offsets;     
00054   p4est_locidx_t     *proc_offsets;     
00060   sc_array_t          mirrors; 
00061   p4est_locidx_t     *mirror_tree_offsets;      
00062   p4est_locidx_t     *mirror_proc_mirrors;      
00065   p4est_locidx_t     *mirror_proc_offsets;      
00067   p4est_locidx_t     *mirror_proc_fronts;       
00073   p4est_locidx_t     *mirror_proc_front_offsets;        
00076 }
00077 p8est_ghost_t;
00078 
00090 int                 p8est_ghost_is_valid (p8est_ghost_t *ghost);
00091 
00092 
00097 size_t              p8est_ghost_memory_used (p8est_ghost_t * ghost);
00098 
00112 int                 p8est_quadrant_find_owner (p8est_t * p8est,
00113                                                p4est_topidx_t treeid,
00114                                                int face,
00115                                                const p8est_quadrant_t * q);
00116 
00128 p8est_ghost_t      *p8est_ghost_new (p8est_t * p8est,
00129                                      p8est_connect_type_t btype);
00130 
00132 void                p8est_ghost_destroy (p8est_ghost_t * ghost);
00133 
00141 ssize_t             p8est_ghost_bsearch (p8est_ghost_t * ghost,
00142                                          int which_proc,
00143                                          p4est_topidx_t which_tree,
00144                                          const p8est_quadrant_t * q);
00145 
00153 ssize_t             p8est_ghost_tree_contains (p8est_ghost_t * ghost,
00154                                                int which_proc,
00155                                                p4est_topidx_t which_tree,
00156                                                const p8est_quadrant_t * q);
00157 
00182 p4est_locidx_t      p8est_face_quadrant_exists (p8est_t * p8est,
00183                                                 p8est_ghost_t * ghost,
00184                                                 p4est_topidx_t treeid,
00185                                                 const p8est_quadrant_t * q,
00186                                                 int *face, int *hang,
00187                                                 int *owner_rank);
00188 
00210 int                 p8est_quadrant_exists (p8est_t * p8est,
00211                                            p8est_ghost_t * ghost,
00212                                            p4est_topidx_t treeid,
00213                                            const p8est_quadrant_t * q,
00214                                            sc_array_t * exists_arr,
00215                                            sc_array_t * rproc_arr,
00216                                            sc_array_t * rquad_arr);
00217 
00226 int                 p8est_is_balanced (p8est_t * p8est,
00227                                        p8est_connect_type_t btype);
00228 
00234 unsigned            p8est_ghost_checksum (p8est_t * p8est,
00235                                           p8est_ghost_t * ghost);
00236 
00248 void                p8est_ghost_exchange_data (p8est_t * p4est,
00249                                                p8est_ghost_t * ghost,
00250                                                void *ghost_data);
00251 
00262 void                p8est_ghost_exchange_custom (p8est_t * p4est,
00263                                                  p8est_ghost_t * ghost,
00264                                                  size_t data_size,
00265                                                  void **mirror_data,
00266                                                  void *ghost_data);
00267 
00284 void                p8est_ghost_exchange_custom_levels (p8est_t * p8est,
00285                                                         p8est_ghost_t * ghost,
00286                                                         int minlevel,
00287                                                         int maxlevel,
00288                                                         size_t data_size,
00289                                                         void **mirror_data,
00290                                                         void *ghost_data);
00291 
00298 void                p8est_ghost_expand (p8est_t * p8est,
00299                                         p8est_ghost_t * ghost);
00300 
00301 SC_EXTERN_C_END;
00302 
00303 #endif /* !P8EST_GHOST_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines