p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
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  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_GHOST_H
33 #define P4EST_GHOST_H
34 
35 #include <p4est.h>
36 
37 SC_EXTERN_C_BEGIN;
38 
40 typedef struct
41 {
42  int mpisize;
43  p4est_topidx_t num_trees;
78 }
80 
94  p4est_ghost_t * ghost);
95 
101 
116  p4est_topidx_t treeid,
117  int face,
118  const p4est_quadrant_t * q);
119 
132  p4est_connect_type_t btype);
133 
136 
145  int which_proc,
146  p4est_topidx_t which_tree,
147  const p4est_quadrant_t * q);
148 
157  int which_proc,
158  p4est_topidx_t which_tree,
159  const p4est_quadrant_t * q);
160 
186  p4est_ghost_t * ghost,
187  p4est_topidx_t treeid,
188  const p4est_quadrant_t * q,
189  int *face, int *hang,
190  int *owner_rank);
191 
214  p4est_ghost_t * ghost,
215  p4est_topidx_t treeid,
216  const p4est_quadrant_t * q,
217  sc_array_t * exists_arr,
218  sc_array_t * rproc_arr,
219  sc_array_t * rquad_arr);
220 
230  p4est_connect_type_t btype);
231 
238  p4est_ghost_t * ghost);
239 
252  p4est_ghost_t * ghost,
253  void *ghost_data);
254 
256 typedef struct p4est_ghost_exchange
257 {
258  int is_custom;
259  int is_levels;
260  p4est_t *p4est;
261  p4est_ghost_t *ghost;
262  int minlevel, maxlevel;
263  size_t data_size;
264  void *ghost_data;
265  int *qactive, *qbuffer;
266  sc_array_t requests, sbuffers;
267  sc_array_t rrequests, rbuffers;
268 }
270 
280  (p4est_t * p4est, p4est_ghost_t * ghost, void *ghost_data);
281 
288  (p4est_ghost_exchange_t * exc);
289 
301  p4est_ghost_t * ghost,
302  size_t data_size,
303  void **mirror_data,
304  void *ghost_data);
305 
318  (p4est_t * p4est, p4est_ghost_t * ghost,
319  size_t data_size, void **mirror_data, void *ghost_data);
320 
327  (p4est_ghost_exchange_t * exc);
328 
346  p4est_ghost_t * ghost,
347  int minlevel,
348  int maxlevel,
349  size_t data_size,
350  void **mirror_data,
351  void *ghost_data);
352 
365  (p4est_t * p4est, p4est_ghost_t * ghost, int minlevel, int maxlevel,
366  size_t data_size, void **mirror_data, void *ghost_data);
367 
374  (p4est_ghost_exchange_t * exc);
375 
383  p4est_ghost_t * ghost);
384 
385 SC_EXTERN_C_END;
386 
387 #endif /* !P4EST_GHOST_H */
The top-level 2D p4est interface.
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
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:88
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.
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.
p4est_ghost_t * p4est_ghost_new(p4est_t *p4est, p4est_connect_type_t btype)
Builds the ghost layer.
int p4est_ghost_is_valid(p4est_t *p4est, p4est_ghost_t *ghost)
Examine if a ghost structure is valid.
p4est_ghost_exchange_t * p4est_ghost_exchange_custom_levels_begin(p4est_t *p4est, p4est_ghost_t *ghost, int minlevel, int maxlevel, size_t data_size, void **mirror_data, void *ghost_data)
Begin an asynchronous ghost data exchange by posting messages.
void p4est_ghost_destroy(p4est_ghost_t *ghost)
Frees all memory used for the ghost layer.
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.
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.
void p4est_ghost_exchange_custom_end(p4est_ghost_exchange_t *exc)
Complete an asynchronous ghost data exchange.
struct p4est_ghost_exchange p4est_ghost_exchange_t
Transient storage for asynchronous ghost exchange.
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.
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.
p4est_ghost_exchange_t * p4est_ghost_exchange_custom_begin(p4est_t *p4est, p4est_ghost_t *ghost, size_t data_size, void **mirror_data, void *ghost_data)
Begin an asynchronous ghost data exchange by posting messages.
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.
void p4est_ghost_exchange_custom_levels_end(p4est_ghost_exchange_t *exc)
Complete an asynchronous ghost data exchange.
unsigned p4est_ghost_checksum(p4est_t *p4est, p4est_ghost_t *ghost)
Compute the parallel checksum of a ghost layer.
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.
void p4est_ghost_exchange_data_end(p4est_ghost_exchange_t *exc)
Complete an asynchronous ghost data exchange.
p4est_ghost_exchange_t * p4est_ghost_exchange_data_begin(p4est_t *p4est, p4est_ghost_t *ghost, void *ghost_data)
Begin an asynchronous ghost data exchange by posting messages.
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.
int p4est_is_balanced(p4est_t *p4est, p4est_connect_type_t btype)
Check a forest to see if it is balanced.
size_t p4est_ghost_memory_used(p4est_ghost_t *ghost)
Calculate the memory usage of the ghost layer.
Transient storage for asynchronous ghost exchange.
Definition: p4est_ghost.h:257
int is_levels
Are we restricted to levels or not.
Definition: p4est_ghost.h:259
int maxlevel
Meaningful with is_levels.
Definition: p4est_ghost.h:262
int is_custom
False for p4est_ghost_exchange_data.
Definition: p4est_ghost.h:258
quadrants that neighbor the local domain
Definition: p4est_ghost.h:41
p4est_connect_type_t btype
which neighbors are in the ghost layer
Definition: p4est_ghost.h:44
p4est_locidx_t * mirror_proc_front_offsets
NULL until p4est_ghost_expand is called.
Definition: p4est_ghost.h:75
p4est_locidx_t * proc_offsets
mpisize + 1 ghost indices
Definition: p4est_ghost.h:55
p4est_locidx_t * mirror_proc_mirrors
indices into mirrors grouped by outside processor rank and ascending within each rank
Definition: p4est_ghost.h:63
sc_array_t mirrors
An array of local quadrants that touch the parallel boundary from the inside, i.e....
Definition: p4est_ghost.h:61
p4est_locidx_t * mirror_proc_fronts
like mirror_proc_mirrors, but limited to the outermost octants.
Definition: p4est_ghost.h:69
p4est_locidx_t * mirror_tree_offsets
num_trees + 1 mirror indices
Definition: p4est_ghost.h:62
sc_array_t ghosts
An array of quadrants which make up the ghost layer around p4est.
Definition: p4est_ghost.h:53
p4est_locidx_t * mirror_proc_offsets
mpisize + 1 indices into mirror_proc_mirrors
Definition: p4est_ghost.h:66
p4est_locidx_t * tree_offsets
num_trees + 1 ghost indices
Definition: p4est_ghost.h:54
The 2D quadrant datatype.
Definition: p4est.h:72
The p4est forest datatype.
Definition: p4est.h:136