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_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 
37 SC_EXTERN_C_BEGIN;
38 
46 typedef struct p8est_iter_volume_info
47 {
48  p8est_t *p4est;
49  p8est_ghost_t *ghost_layer;
54 }
56 
63  void *user_data);
64 
67 {
68  int8_t is_ghost;
72 }
74 
77 {
78  int8_t is_ghost[4];
81 }
83 
91 typedef struct p8est_iter_face_side
92 {
94  int8_t face;
96  int8_t is_hanging;
99  {
102 
105  }
106  is;
107 }
109 
121 typedef struct p8est_iter_face_info
122 {
123  p8est_t *p4est;
124  p8est_ghost_t *ghost_layer;
125  int8_t orientation;
128  int8_t tree_boundary;
130  sc_array_t sides; /* array of p8est_iter_face_side_t type */
131 }
133 
145  void *user_data);
146 
149 {
150  int8_t is_ghost;
154 }
156 
159 {
160  int8_t is_ghost[2];
163 }
165 
166 /* The information that is available to the user-defined p8est_iter_edge_t
167  * callback.
168  *
169  * If a \a quad is local (\a is_ghost is false), then its \a quadid indexes
170  * the tree's quadrant array; otherwise, it indexes the ghosts array. If the
171  * edge is hanging, then the quadrants are listed in z-order. If an edge is in
172  * the interior of a tree, orientation is 0; if an edge is between trees,
173  * orientation is the same as edge orientation in the connectivity. If a
174  * quadrant should be present, but it is not included in the ghost layer, then
175  * quad = NULL, is_ghost is true, and quadid = -1.
176  *
177  * the \a faces field provides some additional information about the local
178  * neighborhood: if side[i]->faces[j] == side[k]->faces[l], this indicates that
179  * there is a common face between these two sides of the edge.
180  */
181 typedef struct p8est_iter_edge_side
182 {
184  int8_t edge;
186  int8_t orientation;
190  int8_t is_hanging;
193  {
196 
199  }
200  is;
201  int8_t faces[2];
202 }
204 
212 typedef struct p8est_iter_edge_info
213 {
214  p8est_t *p4est;
215  p8est_ghost_t *ghost_layer;
216  int8_t tree_boundary;
218  sc_array_t sides;
219 }
221 
233  void *user_data);
234 
235 /* Information about one side of a corner in the forest. If a \a quad is local,
236  * then its \a quadid indexes the tree's quadrant array; otherwise, it indexes
237  * the ghosts array.
238  *
239  * the \a faces and \a edges field provides some additional information about
240  * the local neighborhood: if side[i]->faces[j] == side[k]->faces[l], this
241  * indicates that there is a common face between these two sides of the
242  * corner.
243  */
245 {
247  int8_t corner;
249  int8_t is_ghost;
250  p8est_quadrant_t *quad;
252  int8_t faces[3];
253  int8_t edges[3];
254 }
256 
267 {
268  p8est_t *p4est;
269  p8est_ghost_t *ghost_layer;
270  int8_t tree_boundary;
272  sc_array_t sides;
273 }
275 
289  void *user_data);
290 
331  p8est_ghost_t * ghost_layer,
332  void *user_data,
333  p8est_iter_volume_t iter_volume,
334  p8est_iter_face_t iter_face,
335  p8est_iter_edge_t iter_edge,
336  p8est_iter_corner_t iter_corner);
337 
340 /*@unused@*/
341 static inline p8est_iter_corner_side_t *
342 p8est_iter_cside_array_index_int (sc_array_t * array, int it)
343 {
344  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_corner_side_t));
345  P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
346 
347  return (p8est_iter_corner_side_t *)
348  (array->array + sizeof (p8est_iter_corner_side_t) * (size_t) it);
349 }
350 
353 /*@unused@*/
354 static inline p8est_iter_corner_side_t *
355 p8est_iter_cside_array_index (sc_array_t * array, size_t it)
356 {
357  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_corner_side_t));
358  P4EST_ASSERT (it < array->elem_count);
359 
360  return (p8est_iter_corner_side_t *)
361  (array->array + sizeof (p8est_iter_corner_side_t) * it);
362 }
363 
366 /*@unused@*/
367 static inline p8est_iter_edge_side_t *
368 p8est_iter_eside_array_index_int (sc_array_t * array, int it)
369 {
370  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_edge_side_t));
371  P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
372 
373  return (p8est_iter_edge_side_t *)
374  (array->array + sizeof (p8est_iter_edge_side_t) * (size_t) it);
375 }
376 
379 /*@unused@*/
380 static inline p8est_iter_edge_side_t *
381 p8est_iter_eside_array_index (sc_array_t * array, size_t it)
382 {
383  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_edge_side_t));
384  P4EST_ASSERT (it < array->elem_count);
385 
386  return (p8est_iter_edge_side_t *)
387  (array->array + sizeof (p8est_iter_edge_side_t) * it);
388 }
389 
392 /*@unused@*/
393 static inline p8est_iter_face_side_t *
394 p8est_iter_fside_array_index_int (sc_array_t * array, int it)
395 {
396  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_face_side_t));
397  P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
398 
399  return (p8est_iter_face_side_t *)
400  (array->array + sizeof (p8est_iter_face_side_t) * (size_t) it);
401 }
402 
405 /*@unused@*/
406 static inline p8est_iter_face_side_t *
407 p8est_iter_fside_array_index (sc_array_t * array, size_t it)
408 {
409  P4EST_ASSERT (array->elem_size == sizeof (p8est_iter_face_side_t));
410  P4EST_ASSERT (it < array->elem_count);
411 
412  return (p8est_iter_face_side_t *)
413  (array->array + sizeof (p8est_iter_face_side_t) * it);
414 }
415 
416 SC_EXTERN_C_END;
417 
418 #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:232
struct p8est_iter_corner_info p8est_iter_corner_info_t
The information that is available to the user-defined p8est_iter_corner_t callback.
struct p8est_iter_edge_side_full p8est_iter_edge_side_full_t
Shortcut to access full edge information.
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:288
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:144
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_face_side_hanging p8est_iter_face_side_hanging_t
Shortcut to access hanging face information.
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_side_full p8est_iter_face_side_full_t
Shortcut to access full face information.
struct p8est_iter_face_info p8est_iter_face_info_t
The information that is available to the user-defined p8est_iter_face_t callback.
struct p8est_iter_edge_side_hanging p8est_iter_edge_side_hanging_t
Shortcut to access hanging edge information.
The p4est forest datatype.
Definition: p4est.h:150
Quadrants that neighbor the local domain.
Definition: p8est_ghost.h:46
The information that is available to the user-defined p8est_iter_corner_t callback.
Definition: p8est_iterate.h:267
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:270
sc_array_t sides
array of p8est_iter_corner_side_t type
Definition: p8est_iterate.h:272
Definition: p8est_iterate.h:245
p4est_locidx_t quadid
the index in the tree or ghost array
Definition: p8est_iterate.h:251
int8_t corner
which of the quadrant's corners touches this corner
Definition: p8est_iterate.h:247
int8_t faces[3]
internal work data
Definition: p8est_iterate.h:252
int8_t edges[3]
internal work data
Definition: p8est_iterate.h:253
p4est_topidx_t treeid
the tree that contains quad
Definition: p8est_iterate.h:246
int8_t is_ghost
boolean: local (0) or ghost (1)
Definition: p8est_iterate.h:249
The information about all sides of an edge in the forest.
Definition: p8est_iterate.h:213
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:216
sc_array_t sides
array of p8est_iter_edge_side_t type
Definition: p8est_iterate.h:218
Shortcut to access full edge information.
Definition: p8est_iterate.h:149
p8est_quadrant_t * quad
the actual quadrant
Definition: p8est_iterate.h:151
p4est_locidx_t quadid
index in tree or ghost array
Definition: p8est_iterate.h:152
int8_t is_ghost
boolean: local (0) or ghost
Definition: p8est_iterate.h:150
Shortcut to access hanging edge information.
Definition: p8est_iterate.h:159
p4est_locidx_t quadid[2]
index in tree or ghost array
Definition: p8est_iterate.h:162
p8est_quadrant_t * quad[2]
the actual quadrant
Definition: p8est_iterate.h:161
int8_t is_ghost[2]
boolean: local (0) or ghost
Definition: p8est_iterate.h:160
Definition: p8est_iterate.h:182
int8_t edge
which quadrant side the edge touches
Definition: p8est_iterate.h:184
int8_t orientation
the orientation of each quadrant relative to this edge, as in the definition of p8est_connectivity_t
Definition: p8est_iterate.h:186
int8_t is_hanging
boolean: one full quad (0) or two smaller quads (1)
Definition: p8est_iterate.h:190
p4est_topidx_t treeid
the tree on this side
Definition: p8est_iterate.h:183
The information that is available to the user-defined p8est_iter_face_t callback.
Definition: p8est_iterate.h:122
int8_t orientation
the orientation of the sides to each other, as in the definition of p8est_connectivity_t
Definition: p8est_iterate.h:125
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p8est_iterate.h:128
Shortcut to access full face information.
Definition: p8est_iterate.h:67
int8_t is_ghost
boolean: local (0) or ghost
Definition: p8est_iterate.h:68
p8est_quadrant_t * quad
the actual quadrant
Definition: p8est_iterate.h:69
p4est_locidx_t quadid
index in tree or ghost array
Definition: p8est_iterate.h:70
Shortcut to access hanging face information.
Definition: p8est_iterate.h:77
int8_t is_ghost[4]
boolean: local (0) or ghost
Definition: p8est_iterate.h:78
p8est_quadrant_t * quad[4]
the actual quadrant
Definition: p8est_iterate.h:79
p4est_locidx_t quadid[4]
index in tree or ghost array
Definition: p8est_iterate.h:80
Information about one side of a face in the forest.
Definition: p8est_iterate.h:92
int8_t face
which quadrant side the face touches
Definition: p8est_iterate.h:94
p4est_topidx_t treeid
the tree on this side
Definition: p8est_iterate.h:93
int8_t is_hanging
boolean: one full quad (0) or four smaller quads (1)
Definition: p8est_iterate.h:96
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:72
The p8est forest datatype.
Definition: p8est.h:146
p8est_iter_edge_side_hanging_t hanging
if is_hanging, use is.hanging to access per-quadrant data
Definition: p8est_iterate.h:198
p8est_iter_edge_side_full_t full
if !is_hanging, use is.full to access per-quadrant data
Definition: p8est_iterate.h:195
p8est_iter_face_side_full_t full
if !is_hanging, use is.full to access per-quadrant data
Definition: p8est_iterate.h:101
p8est_iter_face_side_hanging_t hanging
if is_hanging, use is.hanging to access per-quadrant data
Definition: p8est_iterate.h:104