p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
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  Additional copyright (C) 2011 individual authors
8  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
9 
10  p4est is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  p4est is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with p4est; if not, write to the Free Software Foundation, Inc.,
22  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24 
32 #ifndef P8EST_MESH_H
33 #define P8EST_MESH_H
34 
35 #include <p8est_ghost.h>
36 
37 SC_EXTERN_C_BEGIN;
38 
134 typedef struct
135 {
136  p4est_locidx_t local_num_quadrants;
137  p4est_locidx_t ghost_num_quadrants;
138 
145  int8_t *quad_to_face;
154  /* These members are NULL if edges are not requested in \ref p8est_mesh_new. */
161  /* These members are NULL if corners are not requested in \ref p8est_mesh_new. */
162  p4est_locidx_t local_num_corners; /* tree-boundary corners */
163  p4est_locidx_t *quad_to_corner; /* 8 indices for each local quad */
164  sc_array_t *corner_offset; /* local_num_corners + 1 entries */
165  sc_array_t *corner_quad; /* corner_offset indexes into this */
166  sc_array_t *corner_corner; /* and this one too (type int8_t) */
167 }
169 
173 typedef struct
174 {
175  /* forest information */
176  p8est_t *p4est;
177  p8est_ghost_t *ghost;
178  p8est_mesh_t *mesh;
179 
180  /* quadrant information */
181  p4est_topidx_t which_tree;
182  p4est_locidx_t quadrant_id; /* tree-local quadrant index */
183  p4est_locidx_t quadrant_code; /* 6 * (quadrant_id + tree_offset) */
184 
185  /* neighbor information */
186  int face; /* Face number in 0..5. */
187  int subface; /* Hanging neighbor number in 0..3. */
188 
189  /* internal information */
190  p4est_locidx_t current_qtq;
191 }
193 
199 
209  p8est_connect_type_t btype);
210 
215 
226  p8est_mesh_t * mesh,
227  p4est_locidx_t qid);
228 
274  p8est_ghost_t * ghost,
275  p8est_mesh_t * mesh,
276  p4est_locidx_t curr_quad_id,
277  p4est_locidx_t direction,
278  sc_array_t * neighboring_quads,
279  sc_array_t * neighboring_encs,
280  sc_array_t * neighboring_qids);
281 
297  p8est_mesh_t * mesh,
299  cumulative_id,
301  which_tree,
303  quadrant_id);
304 
311  * mfn, p8est_t * p8est,
312  p8est_ghost_t * ghost,
313  p8est_mesh_t * mesh,
314  p4est_topidx_t which_tree,
316  quadrant_id);
317 
324  * mfn, p8est_t * p8est,
325  p8est_ghost_t * ghost,
326  p8est_mesh_t * mesh,
327  p4est_topidx_t which_tree,
329  quadrant);
330 
342  * mfn,
343  p4est_topidx_t * ntree,
344  p4est_locidx_t * nquad,
345  int *nface, int *nrank);
346 
355  * mfn, void *ghost_data);
356 
357 SC_EXTERN_C_END;
358 
359 #endif /* !P8EST_MESH_H */
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:93
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:106
p8est_connect_type_t
Characterize a type of adjacency.
Definition: p8est_connectivity.h:90
passing quadrants and data to neighboring processes
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_destroy(p8est_mesh_t *mesh)
Destroy a p8est_mesh structure.
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.
p8est_mesh_t * p8est_mesh_new(p8est_t *p8est, p8est_ghost_t *ghost, p8est_connect_type_t btype)
Create a p8est_mesh structure.
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_quadrant_t * p8est_mesh_get_quadrant(p8est_t *p4est, p8est_mesh_t *mesh, p4est_locidx_t qid)
Access a process-local quadrant inside a forest.
size_t p8est_mesh_memory_used(p8est_mesh_t *mesh)
Calculate the memory usage of the mesh structure.
p8est_quadrant_t * p8est_mesh_quadrant_cumulative(p8est_t *p8est, p8est_mesh_t *mesh, 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.
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.
p4est_locidx_t p8est_mesh_get_neighbors(p8est_t *p4est, p8est_ghost_t *ghost, p8est_mesh_t *mesh, p4est_locidx_t curr_quad_id, p4est_locidx_t direction, sc_array_t *neighboring_quads, sc_array_t *neighboring_encs, sc_array_t *neighboring_qids)
Lookup neighboring quads of quadrant in a specific direction.
The p4est forest datatype.
Definition: p4est.h:136
quadrants that neighbor the local domain
Definition: p8est_ghost.h:41
This structure can be used as the status of a face neighbor iterator.
Definition: p8est_mesh.h:174
This structure contains complete mesh information on a 2:1 balanced forest.
Definition: p8est_mesh.h:135
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p8est_mesh.h:146
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p8est_mesh.h:145
sc_array_t * edge_offset
local_num_edges + 1 entries
Definition: p8est_mesh.h:157
p4est_locidx_t local_num_edges
unsame-size and tree-boundary edges
Definition: p8est_mesh.h:155
int * ghost_to_proc
processor for each ghost quad
Definition: p8est_mesh.h:142
p4est_locidx_t * quad_to_quad
one index for each of the 6 faces
Definition: p8est_mesh.h:144
sc_array_t * quad_level
Stores lists of per-level quads.
Definition: p8est_mesh.h:147
p4est_locidx_t * quad_to_edge
12 indices for each local quad
Definition: p8est_mesh.h:156
sc_array_t * edge_edge
and this one too (type int8_t)
Definition: p8est_mesh.h:159
sc_array_t * edge_quad
edge_offset indexes into this
Definition: p8est_mesh.h:158
p4est_topidx_t * quad_to_tree
tree index for each local quad.
Definition: p8est_mesh.h:139
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:68
The p8est forest datatype.
Definition: p8est.h:132