p4est 2.8.6
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
44#ifndef P4EST_MESH_H
45#define P4EST_MESH_H
46
47#include <p4est_ghost.h>
48
49SC_EXTERN_C_BEGIN;
50
54typedef struct
55{
65}
67
129typedef struct
130{
140 int8_t *quad_to_face;
141 sc_array_t *quad_to_half;
143 sc_array_t *quad_level;
150 /* These members are NULL if btype in params is < P8EST_CONNECT_CORNER and can
151 * be requested in \ref p4est_mesh_new. */
154 sc_array_t *corner_offset;
155 sc_array_t *corner_quad;
156 sc_array_t *corner_corner;
162}
164
168typedef struct
169{
170 /* forest information */
175 /* quadrant information */
180 /* neighbor information */
181 int face;
184 /* internal information */
187}
189
195
200
210 p4est_ghost_t * ghost,
212
221 p4est_ghost_t * ghost,
222 p4est_mesh_params_t * params);
223
228
239 p4est_mesh_t * mesh,
240 p4est_locidx_t qid);
241
242/*** OUTDATED FUNCTION ***/
286 p4est_ghost_t * ghost,
287 p4est_mesh_t * mesh,
288 p4est_locidx_t curr_quad_id,
289 p4est_locidx_t direction,
290 sc_array_t * neighboring_quads,
291 sc_array_t * neighboring_encs,
292 sc_array_t * neighboring_qids);
293
309 p4est_mesh_t * mesh,
311 cumulative_id,
313 which_tree,
315 quadrant_id);
316
326 * mfn, p4est_t * p4est,
327 p4est_ghost_t * ghost,
328 p4est_mesh_t * mesh,
329 p4est_topidx_t which_tree,
331 quadrant_id);
332
342 * mfn, p4est_t * p4est,
343 p4est_ghost_t * ghost,
344 p4est_mesh_t * mesh,
345 p4est_topidx_t which_tree,
347 quadrant);
348
361 * mfn,
362 p4est_topidx_t * ntree,
363 p4est_locidx_t * nquad,
364 int *nface, int *nrank);
365
374 * mfn, void *ghost_data);
375
376SC_EXTERN_C_END;
377
378#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:113
passing quadrants and data to neighboring processes
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_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.
void p4est_mesh_params_init(p4est_mesh_params_t *params)
Initialize a default p4est_mesh_params_t 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_mesh_t * p4est_mesh_new_params(p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_params_t *params)
Create a new mesh.
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_mesh_t * p4est_mesh_new(p4est_t *p4est, p4est_ghost_t *ghost, p4est_connect_type_t btype)
Create a p4est_mesh structure.
size_t p4est_mesh_memory_used(p4est_mesh_t *mesh)
Calculate the memory usage of the mesh structure.
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_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.
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:169
p4est_locidx_t quadrant_code
4 * (quadrant_id + tree_offset)
Definition: p4est_mesh.h:178
p4est_topidx_t which_tree
the current tree index
Definition: p4est_mesh.h:176
p4est_t * p4est
the forest
Definition: p4est_mesh.h:171
int subface
Hanging neighbor number in 0..1.
Definition: p4est_mesh.h:182
p4est_mesh_t * mesh
a mesh derived from the forest
Definition: p4est_mesh.h:173
p4est_ghost_t * ghost
the ghost layer of the forest
Definition: p4est_mesh.h:172
p4est_locidx_t quadrant_id
tree-local quadrant index
Definition: p4est_mesh.h:177
p4est_locidx_t current_qtq
track index of current neighboring quadrant
Definition: p4est_mesh.h:185
int face
Face number in 0..3.
Definition: p4est_mesh.h:181
This structure contains the different parameters of mesh creation.
Definition: p4est_mesh.h:55
p4est_connect_type_t btype
Flag indicating the connection types (face, edge, corner) stored in the mesh.
Definition: p4est_mesh.h:62
int compute_tree_index
Boolean to decide whether to allocate and compute the quad_to_tree list.
Definition: p4est_mesh.h:56
int compute_level_lists
Boolean to decide whether to compute the level lists in quad_level.
Definition: p4est_mesh.h:59
This structure contains complete mesh information on a 2:1 balanced forest.
Definition: p4est_mesh.h:130
sc_array_t * corner_corner
and this one too (type int8_t)
Definition: p4est_mesh.h:156
p4est_locidx_t local_num_quadrants
number of process-local quadrants
Definition: p4est_mesh.h:131
p4est_locidx_t * quad_to_quad
one index for each of the 4 faces
Definition: p4est_mesh.h:139
sc_array_t * quad_level
Stores lists of per-level quads.
Definition: p4est_mesh.h:143
p4est_mesh_params_t params
parameters the mesh was created with, e.g.
Definition: p4est_mesh.h:158
sc_array_t * quad_to_half
stores half-size neighbors
Definition: p4est_mesh.h:141
p4est_topidx_t * quad_to_tree
tree index for each local quad.
Definition: p4est_mesh.h:134
sc_array_t * corner_offset
local_num_corners + 1 entries
Definition: p4est_mesh.h:154
sc_array_t * corner_quad
corner_offset indexes into this
Definition: p4est_mesh.h:155
p4est_locidx_t * quad_to_corner
4 indices for each local quad
Definition: p4est_mesh.h:153
int8_t * quad_to_face
encodes orientation/2:1 status
Definition: p4est_mesh.h:140
p4est_locidx_t ghost_num_quadrants
number of ghost-layer quadrants
Definition: p4est_mesh.h:132
int * ghost_to_proc
processor for each ghost quad
Definition: p4est_mesh.h:137
p4est_locidx_t local_num_corners
tree-boundary corners
Definition: p4est_mesh.h:152
The 2D quadrant datatype.
Definition: p4est.h:72
The p4est forest datatype.
Definition: p4est.h:136