p4est
1.0
|
00001 /* 00002 This file is part of p4est. 00003 p4est is a C library to manage a collection (a forest) of multiple 00004 connected adaptive quadtrees or octrees in parallel. 00005 00006 Copyright (C) 2010 The University of Texas System 00007 Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac 00008 00009 p4est is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 p4est is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with p4est; if not, write to the Free Software Foundation, Inc., 00021 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 */ 00023 00031 #ifndef P4EST_ITERATE_H 00032 #define P4EST_ITERATE_H 00033 00034 #include <p4est.h> 00035 #include <p4est_ghost.h> 00036 00037 SC_EXTERN_C_BEGIN; 00038 00046 typedef struct p4est_iter_volume_info 00047 { 00048 p4est_t *p4est; 00049 p4est_ghost_t *ghost_layer; 00050 p4est_quadrant_t *quad; 00051 p4est_locidx_t quadid; 00053 p4est_topidx_t treeid; 00054 } 00055 p4est_iter_volume_info_t; 00056 00062 typedef void (*p4est_iter_volume_t) (p4est_iter_volume_info_t * info, 00063 void *user_data); 00064 00074 typedef struct p4est_iter_face_side 00075 { 00076 p4est_topidx_t treeid; 00077 int8_t face; 00079 int8_t is_hanging; 00081 union p4est_iter_face_side_data 00082 { 00083 struct 00084 { 00085 int8_t is_ghost; 00086 p4est_quadrant_t *quad; 00087 p4est_locidx_t quadid; 00088 } 00089 full; 00091 struct 00092 { 00093 int8_t is_ghost[2]; 00094 p4est_quadrant_t *quad[2]; 00095 p4est_locidx_t quadid[2]; 00096 } 00097 hanging; 00099 } 00100 is; 00101 } 00102 p4est_iter_face_side_t; 00103 00115 typedef struct p4est_iter_face_info 00116 { 00117 p4est_t *p4est; 00118 p4est_ghost_t *ghost_layer; 00119 int8_t orientation; 00122 int8_t tree_boundary; 00124 sc_array_t sides; /* array of p4est_iter_face_side_t type */ 00125 } 00126 p4est_iter_face_info_t; 00127 00138 typedef void (*p4est_iter_face_t) (p4est_iter_face_info_t * info, 00139 void *user_data); 00140 00151 typedef struct p4est_iter_corner_side 00152 { 00153 p4est_topidx_t treeid; 00154 int8_t corner; 00156 int8_t is_ghost; 00157 p4est_quadrant_t *quad; 00158 p4est_locidx_t quadid; 00159 int8_t faces[2]; 00160 } 00161 p4est_iter_corner_side_t; 00162 00172 typedef struct p4est_iter_corner_info 00173 { 00174 p4est_t *p4est; 00175 p4est_ghost_t *ghost_layer; 00176 int8_t tree_boundary; 00178 sc_array_t sides; 00179 } 00180 p4est_iter_corner_info_t; 00181 00194 typedef void (*p4est_iter_corner_t) (p4est_iter_corner_info_t * info, 00195 void *user_data); 00196 00232 void p4est_iterate (p4est_t * p4est, 00233 p4est_ghost_t * ghost_layer, 00234 void *user_data, 00235 p4est_iter_volume_t iter_volume, 00236 p4est_iter_face_t iter_face, 00237 p4est_iter_corner_t iter_corner); 00238 00241 /*@unused@*/ 00242 static inline p4est_iter_corner_side_t * 00243 p4est_iter_cside_array_index_int (sc_array_t * array, int it) 00244 { 00245 P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_corner_side_t)); 00246 P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count); 00247 00248 return (p4est_iter_corner_side_t *) 00249 (array->array + sizeof (p4est_iter_corner_side_t) * it); 00250 } 00251 00254 /*@unused@*/ 00255 static inline p4est_iter_corner_side_t * 00256 p4est_iter_cside_array_index (sc_array_t * array, size_t it) 00257 { 00258 P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_corner_side_t)); 00259 P4EST_ASSERT (it < array->elem_count); 00260 00261 return (p4est_iter_corner_side_t *) 00262 (array->array + sizeof (p4est_iter_corner_side_t) * it); 00263 } 00264 00267 /*@unused@*/ 00268 static inline p4est_iter_face_side_t * 00269 p4est_iter_fside_array_index_int (sc_array_t * array, int it) 00270 { 00271 P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_face_side_t)); 00272 P4EST_ASSERT (it >= 0 && (size_t) it < array->elem_count); 00273 00274 return (p4est_iter_face_side_t *) 00275 (array->array + sizeof (p4est_iter_face_side_t) * it); 00276 } 00277 00280 /*@unused@*/ 00281 static inline p4est_iter_face_side_t * 00282 p4est_iter_fside_array_index (sc_array_t * array, size_t it) 00283 { 00284 P4EST_ASSERT (array->elem_size == sizeof (p4est_iter_face_side_t)); 00285 P4EST_ASSERT (it < array->elem_count); 00286 00287 return (p4est_iter_face_side_t *) 00288 (array->array + sizeof (p4est_iter_face_side_t) * it); 00289 } 00290 00291 SC_EXTERN_C_END; 00292 00293 #endif /* !P4EST_ITERATE_H */