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
p4est_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 P4EST_ITERATE_H
33 #define P4EST_ITERATE_H
34 
35 #include <p4est_ghost.h>
36 
37 SC_EXTERN_C_BEGIN;
38 
46 typedef struct p4est_iter_volume_info
47 {
48  p4est_t *p4est;
49  p4est_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[2];
81 }
83 
93 typedef struct p4est_iter_face_side
94 {
96  int8_t face;
98  int8_t is_hanging;
101  {
104 
107  }
108  is;
109 }
111 
123 typedef struct p4est_iter_face_info
124 {
125  p4est_t *p4est;
126  p4est_ghost_t *ghost_layer;
127  int8_t orientation;
130  int8_t tree_boundary;
132  sc_array_t sides; /* array of p4est_iter_face_side_t type */
133 }
135 
147  void *user_data);
148 
160 {
162  int8_t corner;
164  int8_t is_ghost;
165  p4est_quadrant_t *quad;
167  int8_t faces[2];
168 }
170 
181 {
182  p4est_t *p4est;
183  p4est_ghost_t *ghost_layer;
184  int8_t tree_boundary;
186  sc_array_t sides;
187 }
189 
203  void *user_data);
204 
241  p4est_ghost_t * ghost_layer,
242  void *user_data,
243  p4est_iter_volume_t iter_volume,
244  p4est_iter_face_t iter_face,
245  p4est_iter_corner_t iter_corner);
246 
249 /*@unused@*/
250 static inline p4est_iter_corner_side_t *
251 p4est_iter_cside_array_index_int (sc_array_t * array, int it)
252 {
253  P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_corner_side_t));
254  P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
255 
256  return (p4est_iter_corner_side_t *)
257  (array->array + sizeof (p4est_iter_corner_side_t) * (size_t) it);
258 }
259 
262 /*@unused@*/
263 static inline p4est_iter_corner_side_t *
264 p4est_iter_cside_array_index (sc_array_t * array, size_t it)
265 {
266  P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_corner_side_t));
267  P4EST_ASSERT (it < array->elem_count);
268 
269  return (p4est_iter_corner_side_t *)
270  (array->array + sizeof (p4est_iter_corner_side_t) * it);
271 }
272 
275 /*@unused@*/
276 static inline p4est_iter_face_side_t *
277 p4est_iter_fside_array_index_int (sc_array_t * array, int it)
278 {
279  P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_face_side_t));
280  P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count);
281 
282  return (p4est_iter_face_side_t *)
283  (array->array + sizeof (p4est_iter_face_side_t) * (size_t) it);
284 }
285 
288 /*@unused@*/
289 static inline p4est_iter_face_side_t *
290 p4est_iter_fside_array_index (sc_array_t * array, size_t it)
291 {
292  P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_face_side_t));
293  P4EST_ASSERT (it < array->elem_count);
294 
295  return (p4est_iter_face_side_t *)
296  (array->array + sizeof (p4est_iter_face_side_t) * it);
297 }
298 
299 SC_EXTERN_C_END;
300 
301 #endif /* !P4EST_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 p4est_iter_face_side_hanging p4est_iter_face_side_hanging_t
Shortcut to access hanging face information.
void(* p4est_iter_corner_t)(p4est_iter_corner_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute wherever quadrants meet at a conformal c...
Definition: p4est_iterate.h:202
struct p4est_iter_face_info p4est_iter_face_info_t
The information that is available to the user-defined p4est_iter_face_t callback.
struct p4est_iter_volume_info p4est_iter_volume_info_t
The information that is available to the user-defined p4est_iter_volume_t callback function.
struct p4est_iter_corner_info p4est_iter_corner_info_t
The information that is available to the user-defined p4est_iter_corner_t callback.
struct p4est_iter_corner_side p4est_iter_corner_side_t
Information about one side of a corner in the forest.
void p4est_iterate(p4est_t *p4est, p4est_ghost_t *ghost_layer, void *user_data, p4est_iter_volume_t iter_volume, p4est_iter_face_t iter_face, p4est_iter_corner_t iter_corner)
Execute user supplied callbacks at every volume, face, and corner in the local forest.
void(* p4est_iter_volume_t)(p4est_iter_volume_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute at every quadrant local to the current p...
Definition: p4est_iterate.h:62
void(* p4est_iter_face_t)(p4est_iter_face_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute wherever two quadrants share a face: the...
Definition: p4est_iterate.h:146
struct p4est_iter_face_side_full p4est_iter_face_side_full_t
Shortcut to access full face information.
struct p4est_iter_face_side p4est_iter_face_side_t
Information about one side of a face in the forest.
Quadrants that neighbor the local domain.
Definition: p4est_ghost.h:46
The information that is available to the user-defined p4est_iter_corner_t callback.
Definition: p4est_iterate.h:181
sc_array_t sides
array of type p4est_iter_corner_side_t type
Definition: p4est_iterate.h:186
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p4est_iterate.h:184
Information about one side of a corner in the forest.
Definition: p4est_iterate.h:160
p4est_locidx_t quadid
the index in the tree or ghost array
Definition: p4est_iterate.h:166
int8_t corner
which of the quadrant's corners touches this corner
Definition: p4est_iterate.h:162
p4est_topidx_t treeid
the tree that contains quad
Definition: p4est_iterate.h:161
int8_t faces[2]
internal work data
Definition: p4est_iterate.h:167
int8_t is_ghost
boolean: local (0) or ghost (1)
Definition: p4est_iterate.h:164
The information that is available to the user-defined p4est_iter_face_t callback.
Definition: p4est_iterate.h:124
int8_t orientation
the orientation of the sides to each other, as in the definition of p4est_connectivity_t
Definition: p4est_iterate.h:127
int8_t tree_boundary
boolean: interior face (0), tree boundary face (true)
Definition: p4est_iterate.h:130
Shortcut to access full face information.
Definition: p4est_iterate.h:67
p4est_quadrant_t * quad
the actual quadrant
Definition: p4est_iterate.h:69
p4est_locidx_t quadid
index in tree or ghost array
Definition: p4est_iterate.h:70
int8_t is_ghost
boolean: local (0) or ghost
Definition: p4est_iterate.h:68
Shortcut to access hanging face information.
Definition: p4est_iterate.h:77
p4est_quadrant_t * quad[2]
the actual quadrant
Definition: p4est_iterate.h:79
int8_t is_ghost[2]
boolean: local (0) or ghost
Definition: p4est_iterate.h:78
p4est_locidx_t quadid[2]
index in tree or ghost array
Definition: p4est_iterate.h:80
Information about one side of a face in the forest.
Definition: p4est_iterate.h:94
int8_t face
which quadrant side the face touches
Definition: p4est_iterate.h:96
p4est_topidx_t treeid
the tree on this side
Definition: p4est_iterate.h:95
int8_t is_hanging
boolean: one full quad (0) or two smaller quads (1)
Definition: p4est_iterate.h:98
The information that is available to the user-defined p4est_iter_volume_t callback function.
Definition: p4est_iterate.h:47
p4est_quadrant_t * quad
the quadrant of the callback
Definition: p4est_iterate.h:50
p4est_locidx_t quadid
id in quad's tree array (see p4est_tree_t)
Definition: p4est_iterate.h:51
p4est_topidx_t treeid
the tree containing quad
Definition: p4est_iterate.h:53
The 2D quadrant datatype.
Definition: p4est.h:76
The p4est forest datatype.
Definition: p4est.h:150
p4est_iter_face_side_hanging_t hanging
if is_hanging, use is.hanging to access per-quadrant data
Definition: p4est_iterate.h:106
p4est_iter_face_side_full_t full
if !is_hanging, use is.full to access per-quadrant data
Definition: p4est_iterate.h:103