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
p4est_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 P4EST_COMMUNICATION_H
33 #define P4EST_COMMUNICATION_H
34 
35 #include <p4est.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  p4est_supercomm);
104 
123  p4est_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 p4est_quadrant_t * q,
207  int rank);
208 
220  p4est_locidx_t which_tree,
221  const p4est_quadrant_t *q,
222  int rank);
223 
238  (const p4est_quadrant_t *gfp, int num_procs, p4est_topidx_t num_trees,
239  p4est_locidx_t which_tree, const p4est_quadrant_t *q, int rank);
240 
247  p4est_locidx_t which_tree,
248  const p4est_quadrant_t * q,
249  int guess);
250 
262  p4est_locidx_t which_tree,
263  int full_tree[],
264  int tree_contact[],
265  const p4est_quadrant_t ** firstq,
266  const p4est_quadrant_t ** nextq);
267 
277  p4est_locidx_t which_tree,
278  int full_tree[],
279  int tree_contact[],
280  p4est_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 
342 void p4est_transfer_fixed (const p4est_gloidx_t * dest_gfq,
343  const p4est_gloidx_t * src_gfq,
344  sc_MPI_Comm mpicomm, int tag,
345  void *dest_data,
346  const void *src_data,
347  size_t data_size);
348 
378  dest_gfq,
379  const p4est_gloidx_t *
380  src_gfq,
381  sc_MPI_Comm mpicomm,
382  int tag,
383  void *dest_data,
384  const void *src_data,
385  size_t data_size);
386 
393 
435 void p4est_transfer_custom (const p4est_gloidx_t * dest_gfq,
436  const p4est_gloidx_t * src_gfq,
437  sc_MPI_Comm mpicomm, int tag,
438  void *dest_data,
439  const int *dest_sizes,
440  const void *src_data,
441  const int *src_sizes);
442 
487  dest_gfq,
488  const p4est_gloidx_t *
489  src_gfq,
490  sc_MPI_Comm mpicomm,
491  int tag,
492  void *dest_data,
493  const int *dest_sizes,
494  const void *src_data,
495  const int *src_sizes);
496 
503 
549  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
550  sc_MPI_Comm mpicomm, int tag,
551  void *dest_data, const int *dest_counts,
552  const void *src_data, const int *src_counts, size_t item_size);
553 
562  (const p4est_gloidx_t * dest_gfq, const p4est_gloidx_t * src_gfq,
563  sc_MPI_Comm mpicomm, int tag,
564  void *dest_data, const int *dest_counts,
565  const void *src_data, const int *src_counts, size_t item_size);
566 
573 
584 
585 SC_EXTERN_C_END;
586 
587 #endif /* !P4EST_COMMUNICATION_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
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:118
void p4est_comm_parallel_env_duplicate(p4est_t *p4est)
Duplicate MPI communicator and replace the current one by the duplicate.
void p4est_comm_global_partition(p4est_t *p4est, p4est_quadrant_t *first_quad)
Distribute the global partition boundaries.
int p4est_comm_find_owner(p4est_t *p4est, p4est_locidx_t which_tree, const p4est_quadrant_t *q, int guess)
Searches the owner of a quadrant via p4est->global_first_position.
int p4est_comm_sync_flag(p4est_t *p4est, int flag, sc_MPI_Op operation)
Evaluates true/false of a flag among processors.
void p4est_transfer_fixed_end(p4est_transfer_context_t *tc)
Complete a fixed-size data transfer between partitions.
void p4est_comm_parallel_env_release(p4est_t *p4est)
Release MPI communicator if it is owned by p4est.
void p4est_comm_parallel_env_assign(p4est_t *p4est, sc_MPI_Comm mpicomm)
Assign an MPI communicator to p4est; retrieve parallel environment.
int p4est_comm_is_owner_gfp(const p4est_quadrant_t *gfp, int num_procs, p4est_topidx_t num_trees, p4est_locidx_t which_tree, const p4est_quadrant_t *q, int rank)
Test ownership of a quadrant via a global_first_position array.
int p4est_comm_parallel_env_reduce(p4est_t **p4est_supercomm)
Reduce MPI communicator to non-empty ranks (i.e., nonzero quadrant counts).
p4est_transfer_context_t * p4est_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.
int p4est_comm_parallel_env_reduce_ext(p4est_t **p4est_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 p4est_transfer_end(p4est_transfer_context_t *tc)
Complete any of the transfer_begin functions.
void p4est_comm_tree_info(p4est_t *p4est, p4est_locidx_t which_tree, int full_tree[], int tree_contact[], const p4est_quadrant_t **firstq, const p4est_quadrant_t **nextq)
Computes information about a tree being fully owned.
int p4est_comm_is_empty(p4est_t *p4est, int p)
Query whether a processor has no quadrants.
int p4est_comm_is_empty_gfq(const p4est_gloidx_t *gfq, int num_procs, int p)
Query whether a processor has no quadrants.
int p4est_comm_parallel_env_is_null(p4est_t *p4est)
Check if the MPI communicator is valid.
int p4est_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].
unsigned p4est_comm_checksum(p4est_t *p4est, unsigned local_crc, size_t local_bytes)
Compute a parallel partition-independent checksum out of local checksums.
void p4est_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 p4est_comm_parallel_env_get_info(p4est_t *p4est)
Retrieve parallel environment information.
void p4est_comm_count_quadrants(p4est_t *p4est)
Calculate the number and partition of quadrants.
void p4est_transfer_custom_end(p4est_transfer_context_t *tc)
Complete a variable-size data transfer between partitions.
int p4est_comm_neighborhood_owned(p4est_t *p4est, p4est_locidx_t which_tree, int full_tree[], int tree_contact[], p4est_quadrant_t *q)
Test if the 3x3 neighborhood of a quadrant is owned by this processor.
int p4est_comm_is_contained(p4est_t *p4est, p4est_locidx_t which_tree, const p4est_quadrant_t *q, int rank)
Test whether a quadrant is fully contained in a rank's owned region.
void p4est_comm_parallel_env_replace(p4est_t *p4est, sc_MPI_Comm mpicomm)
Replace the current MPI communicator by the one provided as input.
p4est_transfer_context_t * p4est_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.
int p4est_comm_is_owner(p4est_t *p4est, p4est_locidx_t which_tree, const p4est_quadrant_t *q, int rank)
Test ownership of a quadrant via p4est->global_first_position.
void p4est_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.
int p4est_comm_is_empty_gfp(const p4est_quadrant_t *gfp, int num_procs, int p)
Query whether a processor has no quadrants.
void p4est_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.
struct p4est_transfer_context p4est_transfer_context_t
Context data to allow for split begin/end data transfer.
void p4est_comm_count_pertree(p4est_t *p4est, p4est_gloidx_t *pertree)
Compute and distribute the cumulative number of quadrants per tree.
void p4est_transfer_items_end(p4est_transfer_context_t *tc)
Complete a variable-count item transfer between partitions.
p4est_transfer_context_t * p4est_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.
void p4est_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.
The 2D quadrant datatype.
Definition: p4est.h:76
Context data to allow for split begin/end data transfer.
Definition: p4est_communication.h:306
The p4est forest datatype.
Definition: p4est.h:150