p4est  1.0
src/p4est_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 P4EST_MESH_H
00032 #define P4EST_MESH_H
00033 
00034 #include <p4est_ghost.h>
00035 
00036 SC_EXTERN_C_BEGIN;
00037 
00077 typedef struct
00078 {
00079   p4est_locidx_t      local_num_quadrants;
00080   p4est_locidx_t      ghost_num_quadrants;
00081 
00082   p4est_topidx_t     *quad_to_tree;     
00083   int                *ghost_to_proc;    
00085   p4est_locidx_t     *quad_to_quad;     
00086   int8_t             *quad_to_face;     
00087   sc_array_t         *quad_to_half;     
00089   /* CAUTION: tree-boundary corners not yet implemented */
00090   p4est_locidx_t      local_num_corners;        /* tree-boundary corners */
00091   p4est_locidx_t     *quad_to_corner;   /* 4 indices for each local quad */
00092   sc_array_t         *corner_offset;    /* has num_corners + 1 entries */
00093   sc_array_t         *corner_quad;      /* corner_offset indexes into this */
00094   sc_array_t         *corner_corner;    /* and this one too (type int8_t) */
00095 }
00096 p4est_mesh_t;
00097 
00101 typedef struct
00102 {
00103   /* forest information */
00104   p4est_t            *p4est;
00105   p4est_ghost_t      *ghost;
00106   p4est_mesh_t       *mesh;
00107 
00108   /* quadrant information */
00109   p4est_topidx_t      which_tree;
00110   p4est_locidx_t      quadrant_id;      /* tree-local quadrant index */
00111   p4est_locidx_t      quadrant_code;    /* 4 * (quadrant_id + tree_offset) */
00112 
00113   /* neighbor information */
00114   int                 face;     /* Face number in 0..3. */
00115   int                 subface;  /* Hanging neighbor number in 0..1. */
00116 
00117   /* internal information */
00118   p4est_locidx_t      current_qtq;
00119 }
00120 p4est_mesh_face_neighbor_t;
00121 
00126 size_t              p4est_mesh_memory_used (p4est_mesh_t * mesh);
00127 
00134 p4est_mesh_t       *p4est_mesh_new (p4est_t * p4est, p4est_ghost_t * ghost,
00135                                     p4est_connect_type_t btype);
00136 
00140 void                p4est_mesh_destroy (p4est_mesh_t * mesh);
00141 
00151 p4est_quadrant_t   *p4est_mesh_quadrant_cumulative (p4est_t * p4est,
00152                                                     p4est_locidx_t
00153                                                     cumulative_id,
00154                                                     p4est_topidx_t
00155                                                     * which_tree,
00156                                                     p4est_locidx_t
00157                                                     * quadrant_id);
00158 
00164 void                p4est_mesh_face_neighbor_init2 (p4est_mesh_face_neighbor_t
00165                                                     * mfn, p4est_t * p4est,
00166                                                     p4est_ghost_t * ghost,
00167                                                     p4est_mesh_t * mesh,
00168                                                     p4est_topidx_t which_tree,
00169                                                     p4est_locidx_t
00170                                                     quadrant_id);
00171 
00177 void                p4est_mesh_face_neighbor_init (p4est_mesh_face_neighbor_t
00178                                                    * mfn, p4est_t * p4est,
00179                                                    p4est_ghost_t * ghost,
00180                                                    p4est_mesh_t * mesh,
00181                                                    p4est_topidx_t which_tree,
00182                                                    p4est_quadrant_t
00183                                                    * quadrant);
00184 
00195 p4est_quadrant_t   *p4est_mesh_face_neighbor_next (p4est_mesh_face_neighbor_t
00196                                                    * mfn,
00197                                                    p4est_topidx_t * ntree,
00198                                                    p4est_locidx_t * nquad,
00199                                                    int *nface, int *nrank);
00200 
00208 void               *p4est_mesh_face_neighbor_data (p4est_mesh_face_neighbor_t
00209                                                    * mfn, void *ghost_data);
00210 
00211 SC_EXTERN_C_END;
00212 
00213 #endif /* !P4EST_MESH_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines