p4est  2.8.7
p4est is a software library for parallel adaptive mesh refinement.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
p8est_communication.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 P8EST_COMMUNICATION_H
33 #define P8EST_COMMUNICATION_H
34 
35 #include <p8est.h>
36 
37 SC_EXTERN_C_BEGIN;
38 
53  const p4est_gloidx_t * gfq,
54  int nmemb);
55 
63  sc_MPI_Comm mpicomm);
64 
70 
74 
82  sc_MPI_Comm mpicomm);
83 
87 
93 
103  p8est_supercomm);
104 
123  p8est_supercomm,
124  sc_MPI_Group
125  group_add,
126  int add_to_beginning,
127  int **ranks_subcomm);
128 
134 
145  first_quad);
146 
158  global_num_quadrants,
159  int mpisize,
160  p4est_gloidx_t * gfq);
161 
169  p4est_gloidx_t * pertree);
170 
177 
186  int num_procs, int p);
187 
196  int num_procs, int p);
197 
205  p4est_locidx_t which_tree,
206  const p8est_quadrant_t * q,
207  int rank);
208 
220  p4est_locidx_t which_tree,
221  const p8est_quadrant_t *q,
222  int rank);
223 
238  (const p8est_quadrant_t *gfp, int num_procs, p4est_topidx_t num_trees,
239  p4est_locidx_t which_tree, const p8est_quadrant_t *q, int rank);
240 
247  p4est_locidx_t which_tree,
248  const p8est_quadrant_t * q,
249  int guess);
250 
262  p4est_locidx_t which_tree,
263  int full_tree[],
264  int tree_contact[],
265  const p8est_quadrant_t ** firstq,
266  const p8est_quadrant_t ** nextq);
267 
277  p4est_locidx_t which_tree,
278  int full_tree[],
279  int tree_contact[],
280  p8est_quadrant_t * q);
281 
289  int flag, sc_MPI_Op operation);
290 
301  unsigned local_crc,
302  size_t local_bytes);
303 
306 {
307  int variable;
308  int num_senders;
309  int num_receivers;
310  sc_MPI_Request *recv_req;
311  sc_MPI_Request *send_req;
312 }
314 
339 void p8est_transfer_fixed (const p4est_gloidx_t * dest_gfq,
340  const p4est_gloidx_t * src_gfq,
341  sc_MPI_Comm mpicomm, int tag,
342  void *dest_data,
343  const void *src_data,
344  size_t data_size);
345 
373  dest_gfq,
374  const p4est_gloidx_t *
375  src_gfq,
376  sc_MPI_Comm mpicomm,
377  int tag,
378  void *dest_data,
379  const void *src_data,
380  size_t data_size);
381 
388 
426 void p8est_transfer_custom (const p4est_gloidx_t * dest_gfq,
427  const p4est_gloidx_t * src_gfq,
428  sc_MPI_Comm mpicomm, int tag,
429  void *dest_data,
430  const int *dest_sizes,
431  const void *src_data,
432  const int *src_sizes);
433 
476  dest_gfq,
477  const p4est_gloidx_t *
478  src_gfq,
479  sc_MPI_Comm mpicomm,
480  int tag,
481  void *dest_data,
482  const int *dest_sizes,
483  const void *src_data,
484  const int *src_sizes);
485 
492 
538  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
539  sc_MPI_Comm mpicomm, int tag,
540  void *dest_data, const int *dest_counts,
541  const void *src_data, const int *src_counts, size_t item_size);
542 
551  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
552  sc_MPI_Comm mpicomm, int tag,
553  void *dest_data, const int *dest_counts,
554  const void *src_data, const int *src_counts, size_t item_size);
555 
562 
573 
574 SC_EXTERN_C_END;
575 
576 #endif /* !P8EST_COMMUNICATION_H */
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
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
The top-level 3D p8est interface.
int p8est_comm_neighborhood_owned(p8est_t *p8est, p4est_locidx_t which_tree, int full_tree[], int tree_contact[], p8est_quadrant_t *q)
Test if the 3x3 neighborhood of a quadrant is owned by this processor.
int p8est_comm_is_empty(p8est_t *p8est, int p)
Query whether a processor has no quadrants.
int p8est_comm_parallel_env_reduce(p8est_t **p8est_supercomm)
Reduce MPI communicator to non-empty ranks (i.e., nonzero quadrant counts).
int p8est_comm_parallel_env_is_null(p8est_t *p8est)
Check if the MPI communicator is valid.
void p8est_comm_count_quadrants(p8est_t *p8est)
Calculate the number and partition of quadrants.
struct p8est_transfer_context p8est_transfer_context_t
Context data to allow for split begin/end data transfer.
void p8est_comm_parallel_env_release(p8est_t *p8est)
Release MPI communicator if it is owned by p8est.
int p8est_comm_is_contained(p8est_t *p8est, p4est_locidx_t which_tree, const p8est_quadrant_t *q, int rank)
Test whether a quadrant is fully contained in a rank's owned region.
void p8est_comm_parallel_env_assign(p8est_t *p8est, sc_MPI_Comm mpicomm)
Assign an MPI communicator to p8est; retrieve parallel environment.
p8est_transfer_context_t * p8est_transfer_items_begin(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const int *dest_counts, const void *src_data, const int *src_counts, size_t item_size)
Initiate a variable-count item transfer between partitions.
void p8est_comm_count_pertree(p8est_t *p8est, p4est_gloidx_t *pertree)
Compute and distribute the cumulative number of quadrants per tree.
int p8est_comm_is_owner(p8est_t *p8est, p4est_locidx_t which_tree, const p8est_quadrant_t *q, int rank)
Test ownership of a quadrant via p8est->global_first_position.
void p8est_comm_parallel_env_get_info(p8est_t *p8est)
Retrieve parallel environment information.
int p8est_comm_is_owner_gfp(const p8est_quadrant_t *gfp, int num_procs, p4est_topidx_t num_trees, p4est_locidx_t which_tree, const p8est_quadrant_t *q, int rank)
Test ownership of a quadrant via a global_first_position array.
int p8est_comm_is_empty_gfp(const p8est_quadrant_t *gfp, int num_procs, int p)
Query whether a processor has no quadrants.
void p8est_transfer_items(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const int *dest_counts, const void *src_data, const int *src_counts, size_t item_size)
Transfer variable-count item data between partitions.
int p8est_comm_parallel_env_reduce_ext(p8est_t **p8est_supercomm, sc_MPI_Group group_add, int add_to_beginning, int **ranks_subcomm)
Reduce MPI communicator to non-empty ranks and add a group of ranks that will remain in the reduced c...
void p8est_transfer_custom(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const int *dest_sizes, const void *src_data, const int *src_sizes)
Transfer variable-size quadrant data between partitions.
void p8est_transfer_end(p8est_transfer_context_t *tc)
Complete any of the transfer_begin functions.
void p8est_transfer_items_end(p8est_transfer_context_t *tc)
Complete a variable-count item transfer between partitions.
void p8est_comm_global_first_quadrant(p4est_gloidx_t global_num_quadrants, int mpisize, p4est_gloidx_t *gfq)
Calculate the global fist quadrant array for a uniform partition.
int p8est_comm_find_owner(p8est_t *p8est, p4est_locidx_t which_tree, const p8est_quadrant_t *q, int guess)
Searches the owner of a quadrant via p8est->global_first_position.
void p8est_transfer_fixed(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const void *src_data, size_t data_size)
Transfer data associated with one forest partition to another.
void p8est_comm_global_partition(p8est_t *p8est, p8est_quadrant_t *first_quad)
Distribute the global partition boundaries.
p8est_transfer_context_t * p8est_transfer_fixed_begin(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const void *src_data, size_t data_size)
Initiate a fixed-size data transfer between partitions.
void p8est_transfer_custom_end(p8est_transfer_context_t *tc)
Complete a variable-size data transfer between partitions.
int p8est_comm_is_empty_gfq(const p4est_gloidx_t *gfq, int num_procs, int p)
Query whether a processor has no quadrants.
void p8est_comm_tree_info(p8est_t *p8est, p4est_locidx_t which_tree, int full_tree[], int tree_contact[], const p8est_quadrant_t **firstq, const p8est_quadrant_t **nextq)
Computes information about a tree being fully owned.
void p8est_comm_parallel_env_duplicate(p8est_t *p8est)
Duplicate MPI communicator and replace the current one by the duplicate.
void p8est_comm_parallel_env_replace(p8est_t *p8est, sc_MPI_Comm mpicomm)
Replace the current MPI communicator by the one provided as input.
int p8est_comm_sync_flag(p8est_t *p8est, int flag, sc_MPI_Op operation)
Evaluates true/false of a flag among processors.
void p8est_transfer_fixed_end(p8est_transfer_context_t *tc)
Complete a fixed-size data transfer between partitions.
int p8est_bsearch_partition(p4est_gloidx_t target, const p4est_gloidx_t *gfq, int nmemb)
Given target, find index p such that gfq[p] <= target < gfq[p + 1].
p8est_transfer_context_t * p8est_transfer_custom_begin(const p4est_gloidx_t *dest_gfq, const p4est_gloidx_t *src_gfq, sc_MPI_Comm mpicomm, int tag, void *dest_data, const int *dest_sizes, const void *src_data, const int *src_sizes)
Initiate a variable-size data transfer between partitions.
unsigned p8est_comm_checksum(p8est_t *p8est, unsigned local_crc, size_t local_bytes)
Compute a parallel partition-independent checksum out of local checksums.
The 3D quadrant (i.e., octant) datatype.
Definition: p8est.h:72
Context data to allow for split begin/end data transfer.
Definition: p8est_communication.h:306
The p8est forest datatype.
Definition: p8est.h:146