p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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  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 P4EST_MESH_H
32 #define P4EST_MESH_H
33 
34 #include <p4est_ghost.h>
35 
36 SC_EXTERN_C_BEGIN;
37 
88 typedef struct
89 {
90  p4est_locidx_t local_num_quadrants;
91  p4est_locidx_t ghost_num_quadrants;
92 
98  int8_t *quad_to_face;
103  /* These members are NULL if the connect_t is not P4EST_CONNECT_CORNER */
104  /* CAUTION: tree-boundary corners not yet implemented */
105  p4est_locidx_t local_num_corners; /* tree-boundary corners */
106  p4est_locidx_t *quad_to_corner; /* 4 indices for each local quad */
107  sc_array_t *corner_offset; /* local_num_corners + 1 entries */
108  sc_array_t *corner_quad; /* corner_offset indexes into this */
109  sc_array_t *corner_corner; /* and this one too (type int8_t) */
110 }
112 
116 typedef struct
117 {
118  /* forest information */
119  p4est_t *p4est;
120  p4est_ghost_t *ghost;
121  p4est_mesh_t *mesh;
122 
123  /* quadrant information */
124  p4est_topidx_t which_tree;
125  p4est_locidx_t quadrant_id; /* tree-local quadrant index */
126  p4est_locidx_t quadrant_code; /* 4 * (quadrant_id + tree_offset) */
127 
128  /* neighbor information */
129  int face; /* Face number in 0..3. */
130  int subface; /* Hanging neighbor number in 0..1. */
131 
132  /* internal information */
133  p4est_locidx_t current_qtq;
134 }
136 
141 size_t p4est_mesh_memory_used (p4est_mesh_t * mesh);
142 
150  p4est_connect_type_t btype);
151 
155 void p4est_mesh_destroy (p4est_mesh_t * mesh);
156 
168  cumulative_id,
170  * which_tree,
172  * quadrant_id);
173 
180  * mfn, p4est_t * p4est,
181  p4est_ghost_t * ghost,
182  p4est_mesh_t * mesh,
183  p4est_topidx_t which_tree,
185  quadrant_id);
186 
193  * mfn, p4est_t * p4est,
194  p4est_ghost_t * ghost,
195  p4est_mesh_t * mesh,
196  p4est_topidx_t which_tree,
198  * quadrant);
199 
211  * mfn,
212  p4est_topidx_t * ntree,
213  p4est_locidx_t * nquad,
214  int *nface, int *nrank);
215 
224  * mfn, void *ghost_data);
225 
226 SC_EXTERN_C_END;
227 
228 #endif /* !P4EST_MESH_H */
quadrants that neighbor the local domain
Definition: p4est_ghost.h:39
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.
Definition: p4est_mesh.c:717
void p4est_mesh_destroy(p4est_mesh_t *mesh)
Destroy a p4est_mesh structure.
Definition: p4est_mesh.c:608
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.
Definition: p4est_mesh.c:689
p4est_topidx_t * quad_to_tree
tree index for each local quad, NULL by default
Definition: p4est_mesh.h:93
This structure can be used as the status of a face neighbor iterator.
Definition: p4est_mesh.h:116
void * p4est_mesh_face_neighbor_data(p4est_mesh_face_neighbor_t *mfn, void *ghost_data)
Get the user data for the current face neighbor.
Definition: p4est_mesh.c:837
The p4est forest datatype.
Definition: p4est.h:129
int * ghost_to_proc
processor for each ghost quad
Definition: p4est_mesh.h:95
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.
Definition: p4est_mesh.c:745
p4est_locidx_t * quad_to_quad
one index for each of the 4 faces
Definition: p4est_mesh.h:97
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p4est_mesh.h:99
size_t p4est_mesh_memory_used(p4est_mesh_t *mesh)
Calculate the memory usage of the mesh structure.
Definition: p4est_mesh.c:479
sc_array_t * quad_level
stores lists of per-level quads, NULL by default
Definition: p4est_mesh.h:100
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p4est_mesh.h:98
p4est_quadrant_t * p4est_mesh_quadrant_cumulative(p4est_t *p4est, 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.
Definition: p4est_mesh.c:639
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:77
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
p4est_mesh_t * p4est_mesh_new(p4est_t *p4est, p4est_ghost_t *ghost, p4est_connect_type_t btype)
Create a p4est_mesh structure.
Definition: p4est_mesh.c:520
The 2D quadrant datatype.
Definition: p4est.h:65
passing quadrants and data to neighboring processes
This structure contains complete mesh information on the forest.
Definition: p4est_mesh.h:88