p4est  2.8.7
p4est is a software library for parallel adaptive mesh refinement.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules 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  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 
44 #ifndef P8EST_MESH_H
45 #define P8EST_MESH_H
46 
47 #include <p8est_ghost.h>
48 
49 SC_EXTERN_C_BEGIN;
50 
54 typedef struct
55 {
68 }
70 
169 typedef struct
170 {
180  int8_t *quad_to_face;
181  sc_array_t *quad_to_half;
182  sc_array_t *quad_level;
189  /* These members are NULL if btype in params is < P8EST_CONNECT_EDGE and can
190  * be requested in \ref p8est_mesh_new. */
193  sc_array_t *edge_offset;
194  sc_array_t *edge_quad;
195  sc_array_t *edge_edge;
197  /* These members are NULL if btype in params is < P8EST_CONNECT_CORNER and can
198  * be requested in \ref p8est_mesh_new. */
201  sc_array_t *corner_offset;
202  sc_array_t *corner_quad;
203  sc_array_t *corner_corner;
209 }
211 
215 typedef struct
216 {
217  /* forest information */
222  /* quadrant information */
227  /* neighbor information */
228  int face;
229  int subface;
231  /* internal information */
234 }
236 
242 
247 
258  p8est_connect_type_t btype);
259 
268  p8est_ghost_t * ghost,
269  p8est_mesh_params_t * params);
270 
275 
286  p8est_mesh_t * mesh,
287  p4est_locidx_t qid);
288 
289 /*** OUTDATED FUNCTION ***/
335  p8est_ghost_t * ghost,
336  p8est_mesh_t * mesh,
337  p4est_locidx_t curr_quad_id,
338  p4est_locidx_t direction,
339  sc_array_t * neighboring_quads,
340  sc_array_t * neighboring_encs,
341  sc_array_t * neighboring_qids);
342 
358  p8est_mesh_t * mesh,
360  cumulative_id,
362  which_tree,
364  quadrant_id);
365 
375  * mfn, p8est_t * p8est,
376  p8est_ghost_t * ghost,
377  p8est_mesh_t * mesh,
378  p4est_topidx_t which_tree,
380  quadrant_id);
381 
391  * mfn, p8est_t * p8est,
392  p8est_ghost_t * ghost,
393  p8est_mesh_t * mesh,
394  p4est_topidx_t which_tree,
396  quadrant);
397 
410  * mfn,
411  p4est_topidx_t * ntree,
412  p4est_locidx_t * nquad,
413  int *nface, int *nrank);
414 
423  * mfn, void *ghost_data);
424 
425 SC_EXTERN_C_END;
426 
427 #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:120
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_params_init(p8est_mesh_params_t *params)
Initialize a default p8est_mesh_params_t structure.
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.
p8est_mesh_t * p8est_mesh_new_params(p8est_t *p8est, p8est_ghost_t *ghost, p8est_mesh_params_t *params)
Create a new mesh.
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:150
Quadrants that neighbor the local domain.
Definition: p8est_ghost.h:46
This structure can be used as the status of a face neighbor iterator.
Definition: p8est_mesh.h:216
p4est_topidx_t which_tree
the current tree index
Definition: p8est_mesh.h:223
p4est_locidx_t quadrant_code
6 * (quadrant_id + tree_offset)
Definition: p8est_mesh.h:225
int subface
Hanging neighbor number in 0..3.
Definition: p8est_mesh.h:229
int face
Face number in 0..5.
Definition: p8est_mesh.h:228
p8est_ghost_t * ghost
the ghost layer of the forest
Definition: p8est_mesh.h:219
p8est_t * p4est
the forest
Definition: p8est_mesh.h:218
p4est_locidx_t quadrant_id
tree-local quadrant index
Definition: p8est_mesh.h:224
p4est_locidx_t current_qtq
track index of current neighboring quadrant
Definition: p8est_mesh.h:232
p8est_mesh_t * mesh
a mesh derived from the forest
Definition: p8est_mesh.h:220
This structure contains the different parameters of mesh creation.
Definition: p8est_mesh.h:55
int compute_tree_index
Boolean to decide whether to allocate and compute the quad_to_tree list.
Definition: p8est_mesh.h:56
int compute_level_lists
Boolean to decide whether to compute the level lists in quad_level.
Definition: p8est_mesh.h:59
p8est_connect_type_t btype
Flag indicating the connection types (face, edge, corner) stored in the mesh.
Definition: p8est_mesh.h:62
int edgehanging_corners
Boolean to decide whether to add corner neighbors across coarse edges.
Definition: p8est_mesh.h:65
This structure contains complete mesh information on a 2:1 balanced forest.
Definition: p8est_mesh.h:170
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p8est_mesh.h:181
p8est_mesh_params_t params
parameters the mesh was created with, e.g.
Definition: p8est_mesh.h:205
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p8est_mesh.h:180
p4est_locidx_t local_num_quadrants
number of process-local quadrants
Definition: p8est_mesh.h:171
sc_array_t * edge_offset
local_num_edges + 1 entries
Definition: p8est_mesh.h:193
p4est_locidx_t local_num_edges
unsame-size and tree-boundary edges
Definition: p8est_mesh.h:191
sc_array_t * corner_corner
and this one too (type int8_t)
Definition: p8est_mesh.h:203
p4est_locidx_t * quad_to_corner
8 indices for each local quad
Definition: p8est_mesh.h:200
int * ghost_to_proc
processor for each ghost quad
Definition: p8est_mesh.h:177
sc_array_t * corner_offset
local_num_corners + 1 entries
Definition: p8est_mesh.h:201
p4est_locidx_t ghost_num_quadrants
number of ghost-layer quadrants
Definition: p8est_mesh.h:172
p4est_locidx_t * quad_to_quad
one index for each of the 6 faces
Definition: p8est_mesh.h:179
sc_array_t * corner_quad
corner_offset indexes into this
Definition: p8est_mesh.h:202
sc_array_t * quad_level
Stores lists of per-level quads.
Definition: p8est_mesh.h:182
p4est_locidx_t * quad_to_edge
12 indices for each local quad
Definition: p8est_mesh.h:192
sc_array_t * edge_edge
and this one too (type int8_t)
Definition: p8est_mesh.h:195
sc_array_t * edge_quad
edge_offset indexes into this
Definition: p8est_mesh.h:194
p4est_locidx_t local_num_corners
tree-boundary corners
Definition: p8est_mesh.h:199
p4est_topidx_t * quad_to_tree
tree index for each local quad.
Definition: p8est_mesh.h:174
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:72
The p8est forest datatype.
Definition: p8est.h:146