p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p8est_mesh.h
Go to the documentation of this file.
1 /*
2  This file is part of p4est.
3  p4est is a C library to manage a collection (a forest) of multiple
4  connected adaptive quadtrees or octrees in parallel.
5 
6  Copyright (C) 2010 The University of Texas System
7  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
8 
9  p4est is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with p4est; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 
31 #ifndef P8EST_MESH_H
32 #define P8EST_MESH_H
33 
34 #include <p8est_ghost.h>
35 
36 SC_EXTERN_C_BEGIN;
37 
89 typedef struct
90 {
91  p4est_locidx_t local_num_quadrants;
92  p4est_locidx_t ghost_num_quadrants;
93 
99  int8_t *quad_to_face;
104  /* These members are NULL if the connect_t is not P4EST_CONNECT_CORNER */
105  /* CAUTION: tree-boundary corners not yet implemented */
106  p4est_locidx_t local_num_corners; /* tree-boundary corners */
107  p4est_locidx_t *quad_to_corner; /* 8 indices for each local quad */
108  sc_array_t *corner_offset; /* local_num_corners + 1 entries */
109  sc_array_t *corner_quad; /* corner_offset indexes into this */
110  sc_array_t *corner_corner; /* and this one too (type int8_t) */
111 }
113 
117 typedef struct
118 {
119  /* forest information */
120  p8est_t *p4est;
121  p8est_ghost_t *ghost;
122  p8est_mesh_t *mesh;
123 
124  /* quadrant information */
125  p4est_topidx_t which_tree;
126  p4est_locidx_t quadrant_id; /* tree-local quadrant index */
127  p4est_locidx_t quadrant_code; /* 6 * (quadrant_id + tree_offset) */
128 
129  /* neighbor information */
130  int face; /* Face number in 0..5. */
131  int subface; /* Hanging neighbor number in 0..3. */
132 
133  /* internal information */
134  p4est_locidx_t current_qtq;
135 }
137 
142 size_t p8est_mesh_memory_used (p8est_mesh_t * mesh);
143 
151  p8est_connect_type_t btype);
152 
156 void p8est_mesh_destroy (p8est_mesh_t * mesh);
157 
169  cumulative_id,
171  * which_tree,
173  * quadrant_id);
174 
181  * mfn, p8est_t * p8est,
182  p8est_ghost_t * ghost,
183  p8est_mesh_t * mesh,
184  p4est_topidx_t which_tree,
186  quadrant_id);
187 
194  * mfn, p8est_t * p8est,
195  p8est_ghost_t * ghost,
196  p8est_mesh_t * mesh,
197  p4est_topidx_t which_tree,
199  * quadrant);
200 
212  * mfn,
213  p4est_topidx_t * ntree,
214  p4est_locidx_t * nquad,
215  int *nface, int *nrank);
216 
225  * mfn, void *ghost_data);
226 
227 SC_EXTERN_C_END;
228 
229 #endif /* !P8EST_MESH_H */
p8est_mesh_t * p8est_mesh_new(p8est_t *p8est, p8est_ghost_t *ghost, p8est_connect_type_t btype)
Create a p8est_mesh structure.
This structure contains complete mesh information on the forest.
Definition: p8est_mesh.h:89
sc_array_t * quad_level
stores lists of per-level quads, NULL by default
Definition: p8est_mesh.h:101
passing quadrants and data to neighboring processes
p8est_quadrant_t * p8est_mesh_face_neighbor_next(p8est_mesh_face_neighbor_t *mfn, p4est_topidx_t *ntree, p4est_locidx_t *nquad, int *nface, int *nrank)
Move the iterator forward to loop around neighbors of the quadrant.
p8est_connect_type_t
Characterize a type of adjacency.
Definition: p8est_connectivity.h:79
quadrants that neighbor the local domain
Definition: p8est_ghost.h:39
p8est_quadrant_t * p8est_mesh_quadrant_cumulative(p8est_t *p8est, p4est_locidx_t cumulative_id, p4est_topidx_t *which_tree, p4est_locidx_t *quadrant_id)
Find a quadrant based on its cumulative number in the local forest.
int * ghost_to_proc
processor for each ghost quad
Definition: p8est_mesh.h:96
void * p8est_mesh_face_neighbor_data(p8est_mesh_face_neighbor_t *mfn, void *ghost_data)
Get the user data for the current face neighbor.
void p8est_mesh_face_neighbor_init2(p8est_mesh_face_neighbor_t *mfn, p8est_t *p8est, p8est_ghost_t *ghost, p8est_mesh_t *mesh, p4est_topidx_t which_tree, p4est_locidx_t quadrant_id)
Initialize a mesh neighbor iterator by quadrant index.
The 3D quadrant (i.e.
Definition: p8est.h:61
void p8est_mesh_destroy(p8est_mesh_t *mesh)
Destroy a p8est_mesh structure.
The p8est forest datatype.
Definition: p8est.h:125
p4est_topidx_t * quad_to_tree
tree index for each local quad, NULL by default
Definition: p8est_mesh.h:94
p4est_locidx_t * quad_to_quad
one index for each of the 6 faces
Definition: p8est_mesh.h:98
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
void p8est_mesh_face_neighbor_init(p8est_mesh_face_neighbor_t *mfn, p8est_t *p8est, p8est_ghost_t *ghost, p8est_mesh_t *mesh, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant)
Initialize a mesh neighbor iterator by quadrant pointer.
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p8est_mesh.h:99
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p8est_mesh.h:100
size_t p8est_mesh_memory_used(p8est_mesh_t *mesh)
Calculate the memory usage of the mesh structure.
This structure can be used as the status of a face neighbor iterator.
Definition: p8est_mesh.h:117