p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p4est_ghost.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  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
8 
9  p4est is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with p4est; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 
31 #ifndef P4EST_GHOST_H
32 #define P4EST_GHOST_H
33 
34 #include <p4est.h>
35 
36 SC_EXTERN_C_BEGIN;
37 
39 typedef struct
40 {
41  int mpisize;
42  p4est_topidx_t num_trees;
77 }
79 
92 int p4est_ghost_is_valid (p4est_t *p4est, p4est_ghost_t * ghost);
93 
98 size_t p4est_ghost_memory_used (p4est_ghost_t * ghost);
99 
114  p4est_topidx_t treeid,
115  int face,
116  const p4est_quadrant_t * q);
117 
130  p4est_connect_type_t btype);
131 
133 void p4est_ghost_destroy (p4est_ghost_t * ghost);
134 
142 ssize_t p4est_ghost_bsearch (p4est_ghost_t * ghost,
143  int which_proc,
144  p4est_topidx_t which_tree,
145  const p4est_quadrant_t * q);
146 
154 ssize_t p4est_ghost_contains (p4est_ghost_t * ghost,
155  int which_proc,
156  p4est_topidx_t which_tree,
157  const p4est_quadrant_t * q);
158 
184  p4est_ghost_t * ghost,
185  p4est_topidx_t treeid,
186  const p4est_quadrant_t * q,
187  int *face, int *hang,
188  int *owner_rank);
189 
211 int p4est_quadrant_exists (p4est_t * p4est,
212  p4est_ghost_t * ghost,
213  p4est_topidx_t treeid,
214  const p4est_quadrant_t * q,
215  sc_array_t * exists_arr,
216  sc_array_t * rproc_arr,
217  sc_array_t * rquad_arr);
218 
227 int p4est_is_balanced (p4est_t * p4est,
228  p4est_connect_type_t btype);
229 
235 unsigned p4est_ghost_checksum (p4est_t * p4est,
236  p4est_ghost_t * ghost);
237 
249 void p4est_ghost_exchange_data (p4est_t * p4est,
250  p4est_ghost_t * ghost,
251  void *ghost_data);
252 
264  p4est_ghost_t * ghost,
265  size_t data_size,
266  void **mirror_data,
267  void *ghost_data);
268 
286  p4est_ghost_t * ghost,
287  int minlevel,
288  int maxlevel,
289  size_t data_size,
290  void **mirror_data,
291  void *ghost_data);
292 
299 void p4est_ghost_expand (p4est_t * p4est,
300  p4est_ghost_t * ghost);
301 
302 
303 SC_EXTERN_C_END;
304 
305 #endif /* !P4EST_GHOST_H */
unsigned p4est_ghost_checksum(p4est_t *p4est, p4est_ghost_t *ghost)
Compute the parallel checksum of a ghost layer.
Definition: p4est_ghost.c:2237
quadrants that neighbor the local domain
Definition: p4est_ghost.h:39
p4est_locidx_t * mirror_proc_mirrors
indices into mirrors grouped by outside processor rank and ascending within each rank ...
Definition: p4est_ghost.h:62
p4est_locidx_t * tree_offsets
num_trees + 1 ghost indices
Definition: p4est_ghost.h:53
ssize_t p4est_ghost_contains(p4est_ghost_t *ghost, int which_proc, p4est_topidx_t which_tree, const p4est_quadrant_t *q)
Conduct binary search for ancestor on range of the ghost layer.
Definition: p4est_ghost.c:281
p4est_locidx_t * proc_offsets
mpisize + 1 ghost indices
Definition: p4est_ghost.h:54
void p4est_ghost_destroy(p4est_ghost_t *ghost)
Frees all memory used for the ghost layer.
Definition: p4est_ghost.c:2215
size_t p4est_ghost_memory_used(p4est_ghost_t *ghost)
Calculate the memory usage of the ghost layer.
Definition: p4est_ghost.c:57
void p4est_ghost_expand(p4est_t *p4est, p4est_ghost_t *ghost)
Expand the size of the ghost layer and mirrors by one additional layer of adjacency.
Definition: p4est_ghost.c:3765
void p4est_ghost_exchange_custom(p4est_t *p4est, p4est_ghost_t *ghost, size_t data_size, void **mirror_data, void *ghost_data)
Transfer data for local quadrants that are ghosts to other processors.
Definition: p4est_ghost.c:2341
p4est_locidx_t * mirror_proc_fronts
like mirror_proc_mirrors, but limited to the outermost octants.
Definition: p4est_ghost.h:68
The p4est forest datatype.
Definition: p4est.h:129
The top-level 2D p4est interface.
int p4est_is_balanced(p4est_t *p4est, p4est_connect_type_t btype)
Check a forest to see if it is balanced.
Definition: p4est_ghost.c:852
p4est_locidx_t * mirror_proc_front_offsets
NULL until p4est_ghost_expand is called.
Definition: p4est_ghost.h:74
p4est_connect_type_t btype
which neighbors are in the ghost layer
Definition: p4est_ghost.h:43
p4est_locidx_t * mirror_tree_offsets
num_trees + 1 mirror indices
Definition: p4est_ghost.h:61
ssize_t p4est_ghost_bsearch(p4est_ghost_t *ghost, int which_proc, p4est_topidx_t which_tree, const p4est_quadrant_t *q)
Conduct binary search for exact match on a range of the ghost layer.
Definition: p4est_ghost.c:257
p4est_ghost_t * p4est_ghost_new(p4est_t *p4est, p4est_connect_type_t btype)
Builds the ghost layer.
Definition: p4est_ghost.c:2209
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
sc_array_t mirrors
An array of local quadrants that touch the parallel boundary from the inside, i.e., that are ghosts in the perspective of at least one other processor.
Definition: p4est_ghost.h:60
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:77
int p4est_quadrant_exists(p4est_t *p4est, p4est_ghost_t *ghost, p4est_topidx_t treeid, const p4est_quadrant_t *q, sc_array_t *exists_arr, sc_array_t *rproc_arr, sc_array_t *rquad_arr)
Checks if quadrant exists in the local forest or the ghost layer.
Definition: p4est_ghost.c:312
void p4est_ghost_exchange_custom_levels(p4est_t *p4est, p4est_ghost_t *ghost, int minlevel, int maxlevel, size_t data_size, void **mirror_data, void *ghost_data)
Transfer data for local quadrants that are ghosts to other processors.
Definition: p4est_ghost.c:2415
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
p4est_locidx_t * mirror_proc_offsets
mpisize + 1 indices into mirror_proc_mirrors
Definition: p4est_ghost.h:65
int p4est_ghost_is_valid(p4est_t *p4est, p4est_ghost_t *ghost)
Examine if a ghost structure is valid.
Definition: p4est_ghost.c:3778
p4est_locidx_t p4est_face_quadrant_exists(p4est_t *p4est, p4est_ghost_t *ghost, p4est_topidx_t treeid, const p4est_quadrant_t *q, int *face, int *hang, int *owner_rank)
Checks if quadrant exists in the local forest or the ghost layer.
Definition: p4est_ghost.c:541
The 2D quadrant datatype.
Definition: p4est.h:65
int p4est_quadrant_find_owner(p4est_t *p4est, p4est_topidx_t treeid, int face, const p4est_quadrant_t *q)
Gets the processor id of a quadrant's owner.
Definition: p4est_ghost.c:80
void p4est_ghost_exchange_data(p4est_t *p4est, p4est_ghost_t *ghost, void *ghost_data)
Transfer data for local quadrants that are ghosts to other processors.
Definition: p4est_ghost.c:2297
sc_array_t ghosts
An array of quadrants which make up the ghost layer around p4est.
Definition: p4est_ghost.h:52