p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
p8est_iterate.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_ITERATE_H
33#define P8EST_ITERATE_H
34
35#include <p8est_ghost.h>
36
37SC_EXTERN_C_BEGIN;
38
47{
49 p8est_ghost_t *ghost_layer;
54}
56
63 void *user_data);
64
73{
75 int8_t face;
77 int8_t is_hanging;
80 {
81 struct
82 {
83 int8_t is_ghost;
86 }
87 full;
89 struct
90 {
91 int8_t is_ghost[4];
94 }
95 hanging;
97 }
98 is;
99}
101
114{
115 p8est_t *p4est;
116 p8est_ghost_t *ghost_layer;
117 int8_t orientation;
122 sc_array_t sides; /* array of p8est_iter_face_side_t type */
123}
125
137 void *user_data);
138
139/* The information that is available to the user-defined p8est_iter_edge_t
140 * callback.
141 *
142 * If a \a quad is local (\a is_ghost is false), then its \a quadid indexes
143 * the tree's quadrant array; otherwise, it indexes the ghosts array. If the
144 * edge is hanging, then the quadrants are listed in z-order. If an edge is in
145 * the interior of a tree, orientation is 0; if an edge is between trees,
146 * orientation is the same as edge orientation in the connectivity. If a
147 * quadrant should be present, but it is not included in the ghost layer, then
148 * quad = NULL, is_ghost is true, and quadid = -1.
149 *
150 * the \a faces field provides some additional information about the local
151 * neighborhood: if side[i]->faces[j] == side[k]->faces[l], this indicates that
152 * there is a common face between these two sides of the edge.
153 */
155{
157 int8_t edge;
159 int8_t orientation;
163 int8_t is_hanging;
166 {
167 struct
168 {
169 int8_t is_ghost;
172 }
173 full;
176 struct
177 {
178 int8_t is_ghost[2];
181 }
182 hanging;
184 }
185 is;
186 int8_t faces[2];
187}
189
198{
199 p8est_t *p4est;
200 p8est_ghost_t *ghost_layer;
203 sc_array_t sides;
204}
206
218 void *user_data);
219
220/* Information about one side of a corner in the forest. If a \a quad is local,
221 * then its \a quadid indexes the tree's quadrant array; otherwise, it indexes
222 * the ghosts array.
223 *
224 * the \a faces and \a edges field provides some additional information about
225 * the local neighborhood: if side[i]->faces[j] == side[k]->faces[l], this
226 * indicates that there is a common face between these two sides of the
227 * corner.
228 */
230{
232 int8_t corner;
234 int8_t is_ghost;
235 p8est_quadrant_t *quad;
237 int8_t faces[3];
238 int8_t edges[3];
239}
241
252{
253 p8est_t *p4est;
254 p8est_ghost_t *ghost_layer;
257 sc_array_t sides;
258}
260
274 void *user_data);
275
316 p8est_ghost_t * ghost_layer,
317 void *user_data,
318 p8est_iter_volume_t iter_volume,
319 p8est_iter_face_t iter_face,
320 p8est_iter_edge_t iter_edge,
321 p8est_iter_corner_t iter_corner);
322
325/*@unused@*/
326static inline p8est_iter_corner_side_t *
327p8est_iter_cside_array_index_int (sc_array_t * array, int it)
328{
329 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_corner_side_t));
330 P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
331
332 return (p8est_iter_corner_side_t *)
333 (array->array + sizeof (p8est_iter_corner_side_t) * (size_t) it);
334}
335
338/*@unused@*/
339static inline p8est_iter_corner_side_t *
340p8est_iter_cside_array_index (sc_array_t * array, size_t it)
341{
342 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_corner_side_t));
343 P4EST_ASSERT (it < array->elem_count);
344
345 return (p8est_iter_corner_side_t *)
346 (array->array + sizeof (p8est_iter_corner_side_t) * it);
347}
348
351/*@unused@*/
352static inline p8est_iter_edge_side_t *
353p8est_iter_eside_array_index_int (sc_array_t * array, int it)
354{
355 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_edge_side_t));
356 P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
357
358 return (p8est_iter_edge_side_t *)
359 (array->array + sizeof (p8est_iter_edge_side_t) * (size_t) it);
360}
361
364/*@unused@*/
365static inline p8est_iter_edge_side_t *
366p8est_iter_eside_array_index (sc_array_t * array, size_t it)
367{
368 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_edge_side_t));
369 P4EST_ASSERT (it < array->elem_count);
370
371 return (p8est_iter_edge_side_t *)
372 (array->array + sizeof (p8est_iter_edge_side_t) * it);
373}
374
377/*@unused@*/
378static inline p8est_iter_face_side_t *
379p8est_iter_fside_array_index_int (sc_array_t * array, int it)
380{
381 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_face_side_t));
382 P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
383
384 return (p8est_iter_face_side_t *)
385 (array->array + sizeof (p8est_iter_face_side_t) * (size_t) it);
386}
387
390/*@unused@*/
391static inline p8est_iter_face_side_t *
392p8est_iter_fside_array_index (sc_array_t * array, size_t it)
393{
394 P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_face_side_t));
395 P4EST_ASSERT (it < array->elem_count);
396
397 return (p8est_iter_face_side_t *)
398 (array->array + sizeof (p8est_iter_face_side_t) * it);
399}
400
401SC_EXTERN_C_END;
402
403#endif /* !P8EST_ITERATE_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
passing quadrants and data to neighboring processes
struct p8est_iter_volume_info p8est_iter_volume_info_t
The information that is available to the user-defined p8est_iter_volume_t callback function.
struct p8est_iter_face_side p8est_iter_face_side_t
Information about one side of a face in the forest.
void(* p8est_iter_edge_t)(p8est_iter_edge_info_t *info, void *user_data)
The prototype for a function that p8est_iterate will execute wherever the edge is an edge of all quad...
Definition: p8est_iterate.h:217
struct p8est_iter_corner_info p8est_iter_corner_info_t
The information that is available to the user-defined p8est_iter_corner_t callback.
void(* p8est_iter_corner_t)(p8est_iter_corner_info_t *info, void *user_data)
The prototype for a function that p8est_iterate will execute wherever the corner is a corner for all ...
Definition: p8est_iterate.h:273
void(* p8est_iter_volume_t)(p8est_iter_volume_info_t *info, void *user_data)
The prototype for a function that p8est_iterate() will execute at every quadrant local to the current...
Definition: p8est_iterate.h:62
void(* p8est_iter_face_t)(p8est_iter_face_info_t *info, void *user_data)
The prototype for a function that p8est_iterate() will execute wherever two quadrants share a face: t...
Definition: p8est_iterate.h:136
void p8est_iterate(p8est_t *p4est, p8est_ghost_t *ghost_layer, void *user_data, p8est_iter_volume_t iter_volume, p8est_iter_face_t iter_face, p8est_iter_edge_t iter_edge, p8est_iter_corner_t iter_corner)
Execute the user-supplied callback functions at every volume, face, edge and corner in the local fore...
struct p8est_iter_edge_info p8est_iter_edge_info_t
The information about all sides of an edge in the forest.
struct p8est_iter_face_info p8est_iter_face_info_t
The information that is available to the user-defined p8est_iter_face_t callback.
The p4est forest datatype.
Definition: p4est.h:136
quadrants that neighbor the local domain
Definition: p8est_ghost.h:41
The information that is available to the user-defined p8est_iter_corner_t callback.
Definition: p8est_iterate.h:252
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:255
sc_array_t sides
array of p8est_iter_corner_side_t type
Definition: p8est_iterate.h:257
Definition: p8est_iterate.h:230
p4est_locidx_t quadid
the index in the tree or ghost array
Definition: p8est_iterate.h:236
int8_t corner
which of the quadrant's corners touches this corner
Definition: p8est_iterate.h:232
int8_t faces[3]
internal work data
Definition: p8est_iterate.h:237
int8_t edges[3]
internal work data
Definition: p8est_iterate.h:238
p4est_topidx_t treeid
the tree that contains quad
Definition: p8est_iterate.h:231
int8_t is_ghost
boolean: local (0) or ghost (1)
Definition: p8est_iterate.h:234
The information about all sides of an edge in the forest.
Definition: p8est_iterate.h:198
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:201
sc_array_t sides
array of p8est_iter_edge_side_t type
Definition: p8est_iterate.h:203
Definition: p8est_iterate.h:155
int8_t edge
which quadrant side the edge touches
Definition: p8est_iterate.h:157
int8_t orientation
the orientation of each quadrant relative to this edge, as in the definition of p8est_connectivity_t
Definition: p8est_iterate.h:159
int8_t is_hanging
boolean: one full quad (0) or two smaller quads (1)
Definition: p8est_iterate.h:163
p4est_topidx_t treeid
the tree on this side
Definition: p8est_iterate.h:156
The information that is available to the user-defined p8est_iter_face_t callback.
Definition: p8est_iterate.h:114
int8_t orientation
the orientation of the sides to each other, as in the definition of p8est_connectivity_t
Definition: p8est_iterate.h:117
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:120
Information about one side of a face in the forest.
Definition: p8est_iterate.h:73
int8_t face
which quadrant side the face touches
Definition: p8est_iterate.h:75
p4est_topidx_t treeid
the tree on this side
Definition: p8est_iterate.h:74
int8_t is_hanging
boolean: one full quad (0) or four smaller quads (1)
Definition: p8est_iterate.h:77
The information that is available to the user-defined p8est_iter_volume_t callback function.
Definition: p8est_iterate.h:47
p8est_quadrant_t * quad
the quadrant of the callback
Definition: p8est_iterate.h:50
p4est_locidx_t quadid
id in quad's tree array (see p8est_tree_t)
Definition: p8est_iterate.h:51
p4est_topidx_t treeid
the tree containing quad
Definition: p8est_iterate.h:53
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:68
The p8est forest datatype.
Definition: p8est.h:132
struct p8est_iter_edge_side::p8est_iter_edge_side_data::@21 hanging
if is_hanging = 1, use is.hanging to access per-quadrant data
p8est_quadrant_t * quad
the actual quadrant
Definition: p8est_iterate.h:170
p4est_locidx_t quadid
index in tree or ghost array
Definition: p8est_iterate.h:171
struct p8est_iter_edge_side::p8est_iter_edge_side_data::@20 full
if is_hanging = 0, use is.full to access per-quadrant data
int8_t is_ghost
boolean: local (0) or ghost (1)
Definition: p8est_iterate.h:169
struct p8est_iter_face_side::p8est_iter_face_side_data::@18 full
if is_hanging = 0, use is.full to access per-quadrant data
p8est_quadrant_t * quad
the actual quadrant
Definition: p8est_iterate.h:84
int8_t is_ghost
boolean: local (0) or ghost (1)
Definition: p8est_iterate.h:83
struct p8est_iter_face_side::p8est_iter_face_side_data::@19 hanging
if is_hanging = 1, use is.hanging to access per-quadrant data
p4est_locidx_t quadid
index in tree or ghost array
Definition: p8est_iterate.h:85