p4est  1.0
src/p4est_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 P4EST_GHOST_H
00032 #define P4EST_GHOST_H
00033 
00034 #include <p4est.h>
00035 
00036 SC_EXTERN_C_BEGIN;
00037 
00039 typedef struct
00040 {
00041   int                 mpisize;
00042   p4est_topidx_t      num_trees;
00043   p4est_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;      
00068   p4est_locidx_t     *mirror_proc_fronts;       
00074   p4est_locidx_t     *mirror_proc_front_offsets;        
00077 }
00078 p4est_ghost_t;
00079 
00090 int                 p4est_ghost_is_valid (p4est_ghost_t * ghost);
00091 
00096 size_t              p4est_ghost_memory_used (p4est_ghost_t * ghost);
00097 
00111 int                 p4est_quadrant_find_owner (p4est_t * p4est,
00112                                                p4est_topidx_t treeid,
00113                                                int face,
00114                                                const p4est_quadrant_t * q);
00115 
00127 p4est_ghost_t      *p4est_ghost_new (p4est_t * p4est,
00128                                      p4est_connect_type_t btype);
00129 
00131 void                p4est_ghost_destroy (p4est_ghost_t * ghost);
00132 
00140 ssize_t             p4est_ghost_bsearch (p4est_ghost_t * ghost,
00141                                          int which_proc,
00142                                          p4est_topidx_t which_tree,
00143                                          const p4est_quadrant_t * q);
00144 
00152 ssize_t             p4est_ghost_contains (p4est_ghost_t * ghost,
00153                                           int which_proc,
00154                                           p4est_topidx_t which_tree,
00155                                           const p4est_quadrant_t * q);
00156 
00181 p4est_locidx_t      p4est_face_quadrant_exists (p4est_t * p4est,
00182                                                 p4est_ghost_t * ghost,
00183                                                 p4est_topidx_t treeid,
00184                                                 const p4est_quadrant_t * q,
00185                                                 int *face, int *hang,
00186                                                 int *owner_rank);
00187 
00209 int                 p4est_quadrant_exists (p4est_t * p4est,
00210                                            p4est_ghost_t * ghost,
00211                                            p4est_topidx_t treeid,
00212                                            const p4est_quadrant_t * q,
00213                                            sc_array_t * exists_arr,
00214                                            sc_array_t * rproc_arr,
00215                                            sc_array_t * rquad_arr);
00216 
00225 int                 p4est_is_balanced (p4est_t * p4est,
00226                                        p4est_connect_type_t btype);
00227 
00233 unsigned            p4est_ghost_checksum (p4est_t * p4est,
00234                                           p4est_ghost_t * ghost);
00235 
00247 void                p4est_ghost_exchange_data (p4est_t * p4est,
00248                                                p4est_ghost_t * ghost,
00249                                                void *ghost_data);
00250 
00261 void                p4est_ghost_exchange_custom (p4est_t * p4est,
00262                                                  p4est_ghost_t * ghost,
00263                                                  size_t data_size,
00264                                                  void **mirror_data,
00265                                                  void *ghost_data);
00266 
00283 void                p4est_ghost_exchange_custom_levels (p4est_t * p4est,
00284                                                         p4est_ghost_t * ghost,
00285                                                         int minlevel,
00286                                                         int maxlevel,
00287                                                         size_t data_size,
00288                                                         void **mirror_data,
00289                                                         void *ghost_data);
00290 
00297 void                p4est_ghost_expand (p4est_t * p4est,
00298                                         p4est_ghost_t * ghost);
00299 
00300 SC_EXTERN_C_END;
00301 
00302 #endif /* !P4EST_GHOST_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines