p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p8est_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 P8EST_GHOST_H
32 #define P8EST_GHOST_H
33 
34 #include <p8est.h>
35 
36 SC_EXTERN_C_BEGIN;
37 
39 typedef struct
40 {
41  int mpisize;
42  p4est_topidx_t num_trees;
76 }
78 
91 int p8est_ghost_is_valid (p8est_t * p8est, p8est_ghost_t *ghost);
92 
93 
98 size_t p8est_ghost_memory_used (p8est_ghost_t * ghost);
99 
114  p4est_topidx_t treeid,
115  int face,
116  const p8est_quadrant_t * q);
117 
130  p8est_connect_type_t btype);
131 
133 void p8est_ghost_destroy (p8est_ghost_t * ghost);
134 
142 ssize_t p8est_ghost_bsearch (p8est_ghost_t * ghost,
143  int which_proc,
144  p4est_topidx_t which_tree,
145  const p8est_quadrant_t * q);
146 
155  int which_proc,
156  p4est_topidx_t which_tree,
157  const p8est_quadrant_t * q);
158 
184  p8est_ghost_t * ghost,
185  p4est_topidx_t treeid,
186  const p8est_quadrant_t * q,
187  int *face, int *hang,
188  int *owner_rank);
189 
211 int p8est_quadrant_exists (p8est_t * p8est,
212  p8est_ghost_t * ghost,
213  p4est_topidx_t treeid,
214  const p8est_quadrant_t * q,
215  sc_array_t * exists_arr,
216  sc_array_t * rproc_arr,
217  sc_array_t * rquad_arr);
218 
227 int p8est_is_balanced (p8est_t * p8est,
228  p8est_connect_type_t btype);
229 
235 unsigned p8est_ghost_checksum (p8est_t * p8est,
236  p8est_ghost_t * ghost);
237 
249 void p8est_ghost_exchange_data (p8est_t * p4est,
250  p8est_ghost_t * ghost,
251  void *ghost_data);
252 
264  p8est_ghost_t * ghost,
265  size_t data_size,
266  void **mirror_data,
267  void *ghost_data);
268 
286  p8est_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 p8est_ghost_expand (p8est_t * p8est,
300  p8est_ghost_t * ghost);
301 
302 SC_EXTERN_C_END;
303 
304 #endif /* !P8EST_GHOST_H */
void p8est_ghost_exchange_custom_levels(p8est_t *p8est, p8est_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.
p4est_locidx_t * mirror_tree_offsets
num_trees + 1 mirror indices
Definition: p8est_ghost.h:61
int p8est_quadrant_find_owner(p8est_t *p8est, p4est_topidx_t treeid, int face, const p8est_quadrant_t *q)
Gets the processor id of a quadrant's owner.
void p8est_ghost_exchange_data(p8est_t *p4est, p8est_ghost_t *ghost, void *ghost_data)
Transfer data for local quadrants that are ghosts to other processors.
p4est_locidx_t * proc_offsets
mpisize + 1 ghost indices
Definition: p8est_ghost.h:54
ssize_t p8est_ghost_tree_contains(p8est_ghost_t *ghost, int which_proc, p4est_topidx_t which_tree, const p8est_quadrant_t *q)
Conduct binary search for ancestor on range of the ghost layer.
p8est_connect_type_t
Characterize a type of adjacency.
Definition: p8est_connectivity.h:79
quadrants that neighbor the local domain
Definition: p8est_ghost.h:39
p8est_ghost_t * p8est_ghost_new(p8est_t *p8est, p8est_connect_type_t btype)
Builds the ghost layer.
sc_array_t ghosts
An array of quadrants which make up the ghost layer around p4est.
Definition: p8est_ghost.h:52
p4est_locidx_t * mirror_proc_front_offsets
NULL until p4est_ghost_expand is called.
Definition: p8est_ghost.h:73
p4est_locidx_t * mirror_proc_mirrors
indices into mirrors grouped by outside processor rank and ascending within each rank ...
Definition: p8est_ghost.h:62
The top-level 3D p8est interface.
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: p8est_ghost.h:60
p4est_locidx_t p8est_face_quadrant_exists(p8est_t *p8est, p8est_ghost_t *ghost, p4est_topidx_t treeid, const p8est_quadrant_t *q, int *face, int *hang, int *owner_rank)
Checks if quadrant exists in the local forest or the ghost layer.
size_t p8est_ghost_memory_used(p8est_ghost_t *ghost)
Calculate the memory usage of the ghost layer.
void p8est_ghost_exchange_custom(p8est_t *p4est, p8est_ghost_t *ghost, size_t data_size, void **mirror_data, void *ghost_data)
Transfer data for local quadrants that are ghosts to other processors.
void p8est_ghost_expand(p8est_t *p8est, p8est_ghost_t *ghost)
Expand the size of the ghost layer and mirrors by one additional layer of adjacency.
The 3D quadrant (i.e.
Definition: p8est.h:61
p8est_connect_type_t btype
which neighbors are in the ghost layer
Definition: p8est_ghost.h:43
The p8est forest datatype.
Definition: p8est.h:125
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
int p8est_is_balanced(p8est_t *p8est, p8est_connect_type_t btype)
Check a forest to see if it is balanced.
void p8est_ghost_destroy(p8est_ghost_t *ghost)
Frees all memory used for the ghost layer.
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
int p8est_ghost_is_valid(p8est_t *p8est, p8est_ghost_t *ghost)
Examine if a ghost structure is valid as desribed above.
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
p4est_locidx_t * tree_offsets
num_trees + 1 ghost indices
Definition: p8est_ghost.h:53
p4est_locidx_t * mirror_proc_offsets
mpisize + 1 indices into mirror_proc_mirrors
Definition: p8est_ghost.h:65
ssize_t p8est_ghost_bsearch(p8est_ghost_t *ghost, int which_proc, p4est_topidx_t which_tree, const p8est_quadrant_t *q)
Conduct binary search for exact match on a range of the ghost layer.
p4est_locidx_t * mirror_proc_fronts
like mirror_proc_mirrors, but limited to the outermost octants.
Definition: p8est_ghost.h:67
unsigned p8est_ghost_checksum(p8est_t *p8est, p8est_ghost_t *ghost)
Compute the parallel checksum of a ghost layer.
int p8est_quadrant_exists(p8est_t *p8est, p8est_ghost_t *ghost, p4est_topidx_t treeid, const p8est_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.