p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p8est_wrap.h
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) 2012 Carsten Burstedde
7 
8  p4est is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  p4est is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with p4est; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef P8EST_WRAP_H
24 #define P8EST_WRAP_H
25 
26 #include <p8est_mesh.h>
27 
28 SC_EXTERN_C_BEGIN;
29 
30 /*** COMPLETE INTERNAL STATE OF P4EST ***/
31 
32 typedef enum p8est_wrap_flags
33 {
34  P8EST_WRAP_NONE = 0,
35  P8EST_WRAP_REFINE = 0x01,
36  P8EST_WRAP_COARSEN = 0x02
37 }
38 p8est_wrap_flags_t;
39 
40 typedef struct p8est_wrap
41 {
42  /* this member is never used or changed by p8est_wrap */
43  void *user_pointer;
45  /* these members are considered public and read-only */
46  int p4est_dim;
47  int p4est_half;
48  int p4est_faces;
49  int p4est_children;
53  /* anything below here is considered private und should not be touched */
54  int weight_exponent;
55  uint8_t *flags, *temp_flags;
56  p4est_locidx_t num_refine_flags, inside_counter, num_replaced;
57 
58  /* for ghost and mesh use p4est_wrap_get_ghost, _mesh declared below */
59  p8est_ghost_t *ghost;
60  p8est_mesh_t *mesh;
61  p8est_ghost_t *ghost_aux;
62  p8est_mesh_t *mesh_aux;
63  int match_aux;
64 }
66 
73 p8est_wrap_t *p8est_wrap_new_conn (sc_MPI_Comm mpicomm,
74  p8est_connectivity_t * conn,
75  int initial_level);
76 
80 p8est_wrap_t *p8est_wrap_new_unitcube (sc_MPI_Comm mpicomm,
81  int initial_level);
82 p8est_wrap_t *p8est_wrap_new_rotwrap (sc_MPI_Comm mpicomm,
83  int initial_level);
84 
86 p8est_wrap_t *p8est_wrap_new_world (int initial_level);
87 void p8est_wrap_destroy (p8est_wrap_t * pp);
88 
93 p8est_ghost_t *p8est_wrap_get_ghost (p8est_wrap_t * pp);
94 
99 p8est_mesh_t *p8est_wrap_get_mesh (p8est_wrap_t * pp);
100 
107 void p8est_wrap_mark_refine (p8est_wrap_t * pp,
108  p4est_topidx_t which_tree,
109  p4est_locidx_t which_quad);
110 
117 void p8est_wrap_mark_coarsen (p8est_wrap_t * pp,
118  p4est_topidx_t which_tree,
119  p4est_locidx_t which_quad);
120 
130 int p8est_wrap_adapt (p8est_wrap_t * pp);
131 
144 int p8est_wrap_partition (p8est_wrap_t * pp,
145  int weight_exponent);
146 
152 void p8est_wrap_complete (p8est_wrap_t * pp);
153 
154 /*** ITERATOR OVER THE FOREST LEAVES ***/
155 
156 typedef struct p8est_wrap_leaf
157 {
158  p8est_wrap_t *pp;
159  int level;
160  p4est_topidx_t which_tree;
161  p4est_locidx_t which_quad;
162  p4est_locidx_t total_quad;
163  p8est_tree_t *tree;
164  p8est_quadrant_t *quad;
165  double lowerleft[3];
166  double upperright[3];
167 }
169 
170 /* Create an iterator over the leaves in the forest.
171  * Returns a newly allocated state containing the first leaf,
172  * or NULL if the local partition of the tree is empty.
173  */
174 p8est_wrap_leaf_t *p8est_wrap_leaf_first (p8est_wrap_t * pp);
175 
176 /* Move the forest leaf iterator forward.
177  * Returns the state that was input with information for the next leaf,
178  * or NULL and deallocates the input if called with the last leaf.
179  */
180 p8est_wrap_leaf_t *p8est_wrap_leaf_next (p8est_wrap_leaf_t * leaf);
181 
182 SC_EXTERN_C_END;
183 
184 #endif /* !P8EST_WRAP_H */
Definition: p8est_wrap.h:156
This structure contains complete mesh information on the forest.
Definition: p8est_mesh.h:89
quadrants that neighbor the local domain
Definition: p8est_ghost.h:39
Definition: p8est_wrap.h:40
forest topology in a conventional mesh format
This structure holds the 3D inter-tree connectivity information.
Definition: p8est_connectivity.h:158
The 3D quadrant (i.e.
Definition: p8est.h:61
The p8est forest datatype.
Definition: p8est.h:125
p8est_t * p4est
p4est->user_pointer is used internally
Definition: p8est_wrap.h:51
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
The p8est tree datatype.
Definition: p8est.h:104
void * user_pointer
Convenience member for users.
Definition: p8est_wrap.h:43