p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
p4est_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 P4EST_MESH_H
33 #define P4EST_MESH_H
34 
35 #include <p4est_ghost.h>
36 
37 SC_EXTERN_C_BEGIN;
38 
100 typedef struct
101 {
102  p4est_locidx_t local_num_quadrants;
103  p4est_locidx_t ghost_num_quadrants;
104 
111  int8_t *quad_to_face;
121  /* These members are NULL if corners are not requested in \ref p4est_mesh_new. */
122  p4est_locidx_t local_num_corners; /* tree-boundary corners */
123  p4est_locidx_t *quad_to_corner; /* 4 indices for each local quad */
124  sc_array_t *corner_offset; /* local_num_corners + 1 entries */
125  sc_array_t *corner_quad; /* corner_offset indexes into this */
126  sc_array_t *corner_corner; /* and this one too (type int8_t) */
127 }
129 
133 typedef struct
134 {
135  /* forest information */
136  p4est_t *p4est;
137  p4est_ghost_t *ghost;
138  p4est_mesh_t *mesh;
139 
140  /* quadrant information */
141  p4est_topidx_t which_tree;
142  p4est_locidx_t quadrant_id; /* tree-local quadrant index */
143  p4est_locidx_t quadrant_code; /* 4 * (quadrant_id + tree_offset) */
144 
145  /* neighbor information */
146  int face; /* Face number in 0..3. */
147  int subface; /* Hanging neighbor number in 0..1. */
148 
149  /* internal information */
150  p4est_locidx_t current_qtq;
151 }
153 
159 
169  p4est_ghost_t * ghost,
170  p4est_connect_type_t btype);
171 
176 
187  p4est_mesh_t * mesh,
188  p4est_locidx_t qid);
189 
233  p4est_ghost_t * ghost,
234  p4est_mesh_t * mesh,
235  p4est_locidx_t curr_quad_id,
236  p4est_locidx_t direction,
237  sc_array_t * neighboring_quads,
238  sc_array_t * neighboring_encs,
239  sc_array_t * neighboring_qids);
240 
256  p4est_mesh_t * mesh,
258  cumulative_id,
260  which_tree,
262  quadrant_id);
263 
270  * mfn, p4est_t * p4est,
271  p4est_ghost_t * ghost,
272  p4est_mesh_t * mesh,
273  p4est_topidx_t which_tree,
275  quadrant_id);
276 
283  * mfn, p4est_t * p4est,
284  p4est_ghost_t * ghost,
285  p4est_mesh_t * mesh,
286  p4est_topidx_t which_tree,
288  quadrant);
289 
301  * mfn,
302  p4est_topidx_t * ntree,
303  p4est_locidx_t * nquad,
304  int *nface, int *nrank);
305 
314  * mfn, void *ghost_data);
315 
316 SC_EXTERN_C_END;
317 
318 #endif /* !P4EST_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
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:88
passing quadrants and data to neighboring processes
p4est_quadrant_t * p4est_mesh_face_neighbor_next(p4est_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.
p4est_locidx_t p4est_mesh_get_neighbors(p4est_t *p4est, p4est_ghost_t *ghost, p4est_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.
p4est_mesh_t * p4est_mesh_new(p4est_t *p4est, p4est_ghost_t *ghost, p4est_connect_type_t btype)
Create a p4est_mesh structure.
void * p4est_mesh_face_neighbor_data(p4est_mesh_face_neighbor_t *mfn, void *ghost_data)
Get the user data for the current face neighbor.
p4est_quadrant_t * p4est_mesh_get_quadrant(p4est_t *p4est, p4est_mesh_t *mesh, p4est_locidx_t qid)
Access a process-local quadrant inside a forest.
void p4est_mesh_face_neighbor_init(p4est_mesh_face_neighbor_t *mfn, p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_t *mesh, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Initialize a mesh neighbor iterator by quadrant pointer.
void p4est_mesh_destroy(p4est_mesh_t *mesh)
Destroy a p4est_mesh structure.
void p4est_mesh_face_neighbor_init2(p4est_mesh_face_neighbor_t *mfn, p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_t *mesh, p4est_topidx_t which_tree, p4est_locidx_t quadrant_id)
Initialize a mesh neighbor iterator by quadrant index.
p4est_quadrant_t * p4est_mesh_quadrant_cumulative(p4est_t *p4est, p4est_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.
size_t p4est_mesh_memory_used(p4est_mesh_t *mesh)
Calculate the memory usage of the mesh structure.
quadrants that neighbor the local domain
Definition: p4est_ghost.h:41
This structure can be used as the status of a face neighbor iterator.
Definition: p4est_mesh.h:134
This structure contains complete mesh information on a 2:1 balanced forest.
Definition: p4est_mesh.h:101
p4est_locidx_t * quad_to_quad
one index for each of the 4 faces
Definition: p4est_mesh.h:110
sc_array_t * quad_level
Stores lists of per-level quads.
Definition: p4est_mesh.h:114
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p4est_mesh.h:112
p4est_topidx_t * quad_to_tree
tree index for each local quad.
Definition: p4est_mesh.h:105
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p4est_mesh.h:111
int * ghost_to_proc
processor for each ghost quad
Definition: p4est_mesh.h:108
The 2D quadrant datatype.
Definition: p4est.h:72
The p4est forest datatype.
Definition: p4est.h:136