p4est  2.8.643-dbc7-dirty
p4est is a software library for parallel adaptive mesh refinement.
p8est_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 P8EST_COMMUNICATION_H
26 #define P8EST_COMMUNICATION_H
27 
28 #include <p8est.h>
29 
30 SC_EXTERN_C_BEGIN;
31 
38 void p8est_comm_parallel_env_assign (p8est_t * p8est,
39  sc_MPI_Comm mpicomm);
40 
45 void p8est_comm_parallel_env_duplicate (p8est_t * p8est);
46 
49 void p8est_comm_parallel_env_release (p8est_t * p8est);
50 
57 void p8est_comm_parallel_env_replace (p8est_t * p8est,
58  sc_MPI_Comm mpicomm);
59 
62 void p8est_comm_parallel_env_get_info (p8est_t * p8est);
63 
68 int p8est_comm_parallel_env_is_null (p8est_t * p8est);
69 
78 int p8est_comm_parallel_env_reduce (p8est_t **
79  p8est_supercomm);
80 
98 int p8est_comm_parallel_env_reduce_ext (p8est_t **
99  p8est_supercomm,
101  group_add,
102  int add_to_beginning,
103  int **ranks_subcomm);
104 
109 void p8est_comm_count_quadrants (p8est_t * p8est);
110 
119 void p8est_comm_global_partition (p8est_t * p8est,
121  first_quad);
122 
133 void p8est_comm_global_first_quadrant (p4est_gloidx_t
134  global_num_quadrants,
135  int mpisize,
136  p4est_gloidx_t * gfq);
137 
144 void p8est_comm_count_pertree (p8est_t * p8est,
145  p4est_gloidx_t * pertree);
146 
152 int p8est_comm_is_empty (p8est_t * p8est, int p);
153 
160 int p8est_comm_is_contained (p8est_t * p8est,
161  p4est_locidx_t which_tree,
162  const p8est_quadrant_t * q,
163  int rank);
164 
173 int p8est_comm_is_owner (p8est_t * p8est,
174  p4est_locidx_t which_tree,
175  const p8est_quadrant_t * q,
176  int rank);
177 
183 int p8est_comm_find_owner (p8est_t * p8est,
184  p4est_locidx_t which_tree,
185  const p8est_quadrant_t * q,
186  int guess);
187 
198 void p8est_comm_tree_info (p8est_t * p8est,
199  p4est_locidx_t which_tree,
200  int full_tree[],
201  int tree_contact[],
202  const p8est_quadrant_t ** firstq,
203  const p8est_quadrant_t ** nextq);
204 
213 int p8est_comm_neighborhood_owned (p8est_t * p8est,
214  p4est_locidx_t which_tree,
215  int full_tree[],
216  int tree_contact[],
217  p8est_quadrant_t * q);
218 
225 int p8est_comm_sync_flag (p8est_t * p8est,
226  int flag, sc_MPI_Op operation);
227 
237 unsigned p8est_comm_checksum (p8est_t * p8est,
238  unsigned local_crc,
239  size_t local_bytes);
240 
248 unsigned p8est_comm_checksum_partition (p8est_t * p8est,
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 
287 void p8est_transfer_fixed (const p4est_gloidx_t * dest_gfq,
288  const p4est_gloidx_t * src_gfq,
289  sc_MPI_Comm mpicomm, int tag,
290  void *dest_data,
291  const void *src_data,
292  size_t data_size);
293 
307 int p8est_bsearch_partition (p4est_gloidx_t target,
308  const p4est_gloidx_t * gfq,
309  int nmemb);
310 
337 p8est_transfer_context_t *p8est_transfer_fixed_begin (const p4est_gloidx_t *
338  dest_gfq,
339  const p4est_gloidx_t *
340  src_gfq,
341  sc_MPI_Comm mpicomm,
342  int tag,
343  void *dest_data,
344  const void *src_data,
345  size_t data_size);
346 
352 void p8est_transfer_fixed_end (p8est_transfer_context_t * tc);
353 
391 void p8est_transfer_custom (const p4est_gloidx_t * dest_gfq,
392  const p4est_gloidx_t * src_gfq,
393  sc_MPI_Comm mpicomm, int tag,
394  void *dest_data,
395  const int *dest_sizes,
396  const void *src_data,
397  const int *src_sizes);
398 
440 p8est_transfer_context_t *p8est_transfer_custom_begin (const p4est_gloidx_t *
441  dest_gfq,
442  const p4est_gloidx_t *
443  src_gfq,
444  sc_MPI_Comm mpicomm,
445  int tag,
446  void *dest_data,
447  const int *dest_sizes,
448  const void *src_data,
449  const int *src_sizes);
450 
456 void p8est_transfer_custom_end (p8est_transfer_context_t * tc);
457 
502 void p8est_transfer_items
503  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
504  sc_MPI_Comm mpicomm, int tag,
505  void *dest_data, const int *dest_counts,
506  const void *src_data, const int *src_counts, size_t item_size);
507 
515 p8est_transfer_context_t *p8est_transfer_items_begin
516  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
517  sc_MPI_Comm mpicomm, int tag,
518  void *dest_data, const int *dest_counts,
519  const void *src_data, const int *src_counts, size_t item_size);
520 
526 void p8est_transfer_items_end (p8est_transfer_context_t * tc);
527 
537 void p8est_transfer_end (p8est_transfer_context_t * tc);
538 
539 SC_EXTERN_C_END;
540 
541 #endif /* !P8EST_COMMUNICATION_H */
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
The top-level 3D p8est interface.
int sc_MPI_Group
sc3_MPI_Comm_t sc_MPI_Comm
int sc_MPI_Request
sc3_MPI_Op_t sc_MPI_Op
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:68
Context data to allow for split begin/end data transfer.
Definition: p8est_communication.h:254
The p8est forest datatype.
Definition: p8est.h:132