p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
p4est_communication.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) 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 
25 #ifndef P4EST_COMMUNICATION_H
26 #define P4EST_COMMUNICATION_H
27 
28 #include <p4est.h>
29 
30 SC_EXTERN_C_BEGIN;
31 
38 void p4est_comm_parallel_env_assign (p4est_t * p4est,
39  sc_MPI_Comm mpicomm);
40 
45 void p4est_comm_parallel_env_duplicate (p4est_t * p4est);
46 
49 void p4est_comm_parallel_env_release (p4est_t * p4est);
50 
57 void p4est_comm_parallel_env_replace (p4est_t * p4est,
58  sc_MPI_Comm mpicomm);
59 
62 void p4est_comm_parallel_env_get_info (p4est_t * p4est);
63 
68 int p4est_comm_parallel_env_is_null (p4est_t * p4est);
69 
78 int p4est_comm_parallel_env_reduce (p4est_t **
79  p4est_supercomm);
80 
98 int p4est_comm_parallel_env_reduce_ext (p4est_t **
99  p4est_supercomm,
101  group_add,
102  int add_to_beginning,
103  int **ranks_subcomm);
104 
109 void p4est_comm_count_quadrants (p4est_t * p4est);
110 
119 void p4est_comm_global_partition (p4est_t * p4est,
121  first_quad);
122 
133 void p4est_comm_global_first_quadrant (p4est_gloidx_t
134  global_num_quadrants,
135  int mpisize,
136  p4est_gloidx_t * gfq);
137 
144 void p4est_comm_count_pertree (p4est_t * p4est,
145  p4est_gloidx_t * pertree);
146 
152 int p4est_comm_is_empty (p4est_t * p4est, int p);
153 
160 int p4est_comm_is_contained (p4est_t * p4est,
161  p4est_locidx_t which_tree,
162  const p4est_quadrant_t * q,
163  int rank);
164 
173 int p4est_comm_is_owner (p4est_t * p4est,
174  p4est_locidx_t which_tree,
175  const p4est_quadrant_t * q,
176  int rank);
177 
183 int p4est_comm_find_owner (p4est_t * p4est,
184  p4est_locidx_t which_tree,
185  const p4est_quadrant_t * q,
186  int guess);
187 
198 void p4est_comm_tree_info (p4est_t * p4est,
199  p4est_locidx_t which_tree,
200  int full_tree[],
201  int tree_contact[],
202  const p4est_quadrant_t ** firstq,
203  const p4est_quadrant_t ** nextq);
204 
213 int p4est_comm_neighborhood_owned (p4est_t * p4est,
214  p4est_locidx_t which_tree,
215  int full_tree[],
216  int tree_contact[],
217  p4est_quadrant_t * q);
218 
225 int p4est_comm_sync_flag (p4est_t * p4est,
226  int flag, sc_MPI_Op operation);
227 
237 unsigned p4est_comm_checksum (p4est_t * p4est,
238  unsigned local_crc,
239  size_t local_bytes);
240 
248 unsigned p4est_comm_checksum_partition (p4est_t * p4est,
249  unsigned local_crc,
250  size_t local_bytes);
251 
254 {
255  int variable;
256  int num_senders;
257  int num_receivers;
258  sc_MPI_Request *recv_req;
259  sc_MPI_Request *send_req;
260 }
262 
290 void p4est_transfer_fixed (const p4est_gloidx_t * dest_gfq,
291  const p4est_gloidx_t * src_gfq,
292  sc_MPI_Comm mpicomm, int tag,
293  void *dest_data,
294  const void *src_data,
295  size_t data_size);
296 
310 int p4est_bsearch_partition (p4est_gloidx_t target,
311  const p4est_gloidx_t * gfq,
312  int nmemb);
313 
342 p4est_transfer_context_t *p4est_transfer_fixed_begin (const p4est_gloidx_t *
343  dest_gfq,
344  const p4est_gloidx_t *
345  src_gfq,
346  sc_MPI_Comm mpicomm,
347  int tag,
348  void *dest_data,
349  const void *src_data,
350  size_t data_size);
351 
357 void p4est_transfer_fixed_end (p4est_transfer_context_t * tc);
358 
400 void p4est_transfer_custom (const p4est_gloidx_t * dest_gfq,
401  const p4est_gloidx_t * src_gfq,
402  sc_MPI_Comm mpicomm, int tag,
403  void *dest_data,
404  const int *dest_sizes,
405  const void *src_data,
406  const int *src_sizes);
407 
451 p4est_transfer_context_t *p4est_transfer_custom_begin (const p4est_gloidx_t *
452  dest_gfq,
453  const p4est_gloidx_t *
454  src_gfq,
455  sc_MPI_Comm mpicomm,
456  int tag,
457  void *dest_data,
458  const int *dest_sizes,
459  const void *src_data,
460  const int *src_sizes);
461 
467 void p4est_transfer_custom_end (p4est_transfer_context_t * tc);
468 
513 void p4est_transfer_items
514  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
515  sc_MPI_Comm mpicomm, int tag,
516  void *dest_data, const int *dest_counts,
517  const void *src_data, const int *src_counts, size_t item_size);
518 
526 p4est_transfer_context_t *p4est_transfer_items_begin
527  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
528  sc_MPI_Comm mpicomm, int tag,
529  void *dest_data, const int *dest_counts,
530  const void *src_data, const int *src_counts, size_t item_size);
531 
537 void p4est_transfer_items_end (p4est_transfer_context_t * tc);
538 
548 void p4est_transfer_end (p4est_transfer_context_t * tc);
549 
550 SC_EXTERN_C_END;
551 
552 #endif /* !P4EST_COMMUNICATION_H */
The top-level 2D p4est interface.
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:106
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
int sc_MPI_Group
sc3_MPI_Comm_t sc_MPI_Comm
int sc_MPI_Request
sc3_MPI_Op_t sc_MPI_Op
The 2D quadrant datatype.
Definition: p4est.h:72
Context data to allow for split begin/end data transfer.
Definition: p4est_communication.h:254
The p4est forest datatype.
Definition: p4est.h:136