p4est  1.0
src/p8est_mesh.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_MESH_H
00032 #define P8EST_MESH_H
00033 
00034 #include <p8est_ghost.h>
00035 
00036 SC_EXTERN_C_BEGIN;
00037 
00078 typedef struct
00079 {
00080   p4est_locidx_t      local_num_quadrants;
00081   p4est_locidx_t      ghost_num_quadrants;
00082 
00083   p4est_topidx_t     *quad_to_tree;     
00084   int                *ghost_to_proc;    
00086   p4est_locidx_t     *quad_to_quad;     
00087   int8_t             *quad_to_face;     
00088   sc_array_t         *quad_to_half;     
00090   /* CAUTION: tree-boundary/tree-edge corners not yet implemented */
00091   p4est_locidx_t      local_num_corners;        /* tree-boundary corners */
00092   p4est_locidx_t     *quad_to_corner;   /* 8 indices for each local quad */
00093   sc_array_t         *corner_offset;    /* has num_corners + 1 entries */
00094   sc_array_t         *corner_quad;      /* corner_offset indexes into this */
00095   sc_array_t         *corner_corner;    /* and this one too (type int8_t) */
00096 }
00097 p8est_mesh_t;
00098 
00102 typedef struct
00103 {
00104   /* forest information */
00105   p8est_t            *p4est;
00106   p8est_ghost_t      *ghost;
00107   p8est_mesh_t       *mesh;
00108 
00109   /* quadrant information */
00110   p4est_topidx_t      which_tree;
00111   p4est_locidx_t      quadrant_id;      /* tree-local quadrant index */
00112   p4est_locidx_t      quadrant_code;    /* 6 * (quadrant_id + tree_offset) */
00113 
00114   /* neighbor information */
00115   int                 face;     /* Face number in 0..5. */
00116   int                 subface;  /* Hanging neighbor number in 0..3. */
00117 
00118   /* internal information */
00119   p4est_locidx_t      current_qtq;
00120 }
00121 p8est_mesh_face_neighbor_t;
00122 
00127 size_t              p8est_mesh_memory_used (p8est_mesh_t * mesh);
00128 
00135 p8est_mesh_t       *p8est_mesh_new (p8est_t * p8est, p8est_ghost_t * ghost,
00136                                     p8est_connect_type_t btype);
00137 
00141 void                p8est_mesh_destroy (p8est_mesh_t * mesh);
00142 
00152 p8est_quadrant_t   *p8est_mesh_quadrant_cumulative (p8est_t * p8est,
00153                                                     p4est_locidx_t
00154                                                     cumulative_id,
00155                                                     p4est_topidx_t
00156                                                     * which_tree,
00157                                                     p4est_locidx_t
00158                                                     * quadrant_id);
00159 
00165 void                p8est_mesh_face_neighbor_init2 (p8est_mesh_face_neighbor_t
00166                                                     * mfn, p8est_t * p8est,
00167                                                     p8est_ghost_t * ghost,
00168                                                     p8est_mesh_t * mesh,
00169                                                     p4est_topidx_t which_tree,
00170                                                     p4est_locidx_t
00171                                                     quadrant_id);
00172 
00178 void                p8est_mesh_face_neighbor_init (p8est_mesh_face_neighbor_t
00179                                                    * mfn, p8est_t * p8est,
00180                                                    p8est_ghost_t * ghost,
00181                                                    p8est_mesh_t * mesh,
00182                                                    p4est_topidx_t which_tree,
00183                                                    p8est_quadrant_t
00184                                                    * quadrant);
00185 
00196 p8est_quadrant_t   *p8est_mesh_face_neighbor_next (p8est_mesh_face_neighbor_t
00197                                                    * mfn,
00198                                                    p4est_topidx_t * ntree,
00199                                                    p4est_locidx_t * nquad,
00200                                                    int *nface, int *nrank);
00201 
00209 void               *p8est_mesh_face_neighbor_data (p8est_mesh_face_neighbor_t
00210                                                    * mfn, void *ghost_data);
00211 
00212 SC_EXTERN_C_END;
00213 
00214 #endif /* !P8EST_MESH_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines