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
Data Structures | Typedefs | Functions
p8est_communication.h File Reference

Parallel messaging and support code. More...

#include <p8est.h>
Include dependency graph for p8est_communication.h:

Go to the source code of this file.

Data Structures

struct  p8est_transfer_context
 Context data to allow for split begin/end data transfer. More...
 

Typedefs

typedef struct p8est_transfer_context p8est_transfer_context_t
 Context data to allow for split begin/end data transfer.
 

Functions

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]. More...
 
void p8est_comm_parallel_env_assign (p8est_t *p8est, sc_MPI_Comm mpicomm)
 Assign an MPI communicator to p8est; retrieve parallel environment. More...
 
void p8est_comm_parallel_env_duplicate (p8est_t *p8est)
 Duplicate MPI communicator and replace the current one by the duplicate. More...
 
void p8est_comm_parallel_env_release (p8est_t *p8est)
 Release MPI communicator if it is owned by p8est.
 
void p8est_comm_parallel_env_replace (p8est_t *p8est, sc_MPI_Comm mpicomm)
 Replace the current MPI communicator by the one provided as input. More...
 
void p8est_comm_parallel_env_get_info (p8est_t *p8est)
 Retrieve parallel environment information.
 
int p8est_comm_parallel_env_is_null (p8est_t *p8est)
 Check if the MPI communicator is valid. More...
 
int p8est_comm_parallel_env_reduce (p8est_t **p8est_supercomm)
 Reduce MPI communicator to non-empty ranks (i.e., nonzero quadrant counts). More...
 
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 communicator regardless whether they are empty or not. More...
 
void p8est_comm_count_quadrants (p8est_t *p8est)
 Calculate the number and partition of quadrants. More...
 
void p8est_comm_global_partition (p8est_t *p8est, p8est_quadrant_t *first_quad)
 Distribute the global partition boundaries. More...
 
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. More...
 
void p8est_comm_count_pertree (p8est_t *p8est, p4est_gloidx_t *pertree)
 Compute and distribute the cumulative number of quadrants per tree. More...
 
int p8est_comm_is_empty (p8est_t *p8est, int p)
 Query whether a processor has no quadrants. More...
 
int p8est_comm_is_empty_gfq (const p4est_gloidx_t *gfq, int num_procs, int p)
 Query whether a processor has no quadrants. More...
 
int p8est_comm_is_empty_gfp (const p8est_quadrant_t *gfp, int num_procs, int p)
 Query whether a processor has no quadrants. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int p8est_comm_sync_flag (p8est_t *p8est, int flag, sc_MPI_Op operation)
 Evaluates true/false of a flag among processors. More...
 
unsigned p8est_comm_checksum (p8est_t *p8est, unsigned local_crc, size_t local_bytes)
 Compute a parallel partition-independent checksum out of local checksums. More...
 
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. More...
 
p8est_transfer_context_tp8est_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. More...
 
void p8est_transfer_fixed_end (p8est_transfer_context_t *tc)
 Complete a fixed-size data transfer between partitions. More...
 
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. More...
 
p8est_transfer_context_tp8est_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. More...
 
void p8est_transfer_custom_end (p8est_transfer_context_t *tc)
 Complete a variable-size data transfer between partitions. More...
 
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. More...
 
p8est_transfer_context_tp8est_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. More...
 
void p8est_transfer_items_end (p8est_transfer_context_t *tc)
 Complete a variable-count item transfer between partitions. More...
 
void p8est_transfer_end (p8est_transfer_context_t *tc)
 Complete any of the transfer_begin functions. More...
 

Detailed Description

Parallel messaging and support code.

Function Documentation

◆ p8est_bsearch_partition()

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].

Parameters
[in]targetThe value that is searched in gfq. target has to satisfy gfq[0] <= target < gfq[nmemb].
[in]gfqThe sorted array (ascending) in that the function will search.
[in]nmembNumber of entries in array MINUS ONE.
Returns
Index p such that gfq[p] <= target < gfq[p + 1].
Note
This function differs from p8est_find_partition since p8est_find_partition searches for two targets using binary search in an optimized way but p8est_bsearch_partition only performs a single binary search.

◆ p8est_comm_checksum()

unsigned p8est_comm_checksum ( p8est_t p8est,
unsigned  local_crc,
size_t  local_bytes 
)

Compute a parallel partition-independent checksum out of local checksums.

This checksum depends on the global refinement topology. It does not depend on how the mesh is partitioned. The result is available on all processors.

Parameters
[in]p8estThe MPI information of this p8est will be used.
[in]local_crcLocally computed adler32 checksum.
[in]local_bytesNumber of bytes used for local checksum.
Returns
Parallel checksum on all processors.

◆ p8est_comm_count_pertree()

void p8est_comm_count_pertree ( p8est_t p8est,
p4est_gloidx_t pertree 
)

Compute and distribute the cumulative number of quadrants per tree.

Parameters
[in]p8estThis p8est needs to have correct values for global_first_quadrant and global_first_position.
[in,out]pertreeOn input, memory for num_trees + 1 numbers. On output, the cumulative quadrant counts.

◆ p8est_comm_count_quadrants()

void p8est_comm_count_quadrants ( p8est_t p8est)

Calculate the number and partition of quadrants.

Parameters
[in,out]p8estAdds all p8est->local_num_quadrant counters and puts cumulative sums in p8est->global_first_quadrant.

◆ p8est_comm_find_owner()

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.

Assumes a tree with no overlaps.

Parameters
[in]guessInitial guess for the search.
Returns
Returns the processor id of the owner.

◆ p8est_comm_global_first_quadrant()

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.

Parameters
[in]global_num_quadrantsThe global number of quadrants.
[in]mpisizeThe number of MPI ranks.
[in,out]gfqAt least allocated mpisize + 1 p4est_gloidx_t. This array is filled with the global first quadrant array assuming a uniform partition.

◆ p8est_comm_global_partition()

void p8est_comm_global_partition ( p8est_t p8est,
p8est_quadrant_t first_quad 
)

Distribute the global partition boundaries.

Parameters
[in,out]p8estFills p8est->global_first_position. p8est->first_local_tree must be set correctly. If this processor is not empty and first_quad is NULL, the first quadrant of the first local tree must be set correctly.
[in]first_quadIf not NULL will be used as first quadrant.

◆ p8est_comm_is_contained()

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.

This function may return false when p8est_comm_is_owner returns true.

Parameters
[in]rankRank whose ownership is tested. Assumes a forest with no overlaps.
Returns
true if rank is the owner of the whole area of the quadrant.

◆ p8est_comm_is_empty()

int p8est_comm_is_empty ( p8est_t p8est,
int  p 
)

Query whether a processor has no quadrants.

Parameters
[in]p8estThis forests' global_first_position array must be valid.
[in]pValid processor id.
Returns
True if and only if processor is empty.

◆ p8est_comm_is_empty_gfp()

int p8est_comm_is_empty_gfp ( const p8est_quadrant_t gfp,
int  num_procs,
int  p 
)

Query whether a processor has no quadrants.

Parameters
[in]gfpAn array encoding the partition shape. Non-decreasing; length num_procs + 1.
[in]num_procsNumber of processes in the partition.
[in]pValid 0 <= p < num_procs.
Returns
True if and only if processor p is empty.

◆ p8est_comm_is_empty_gfq()

int p8est_comm_is_empty_gfq ( const p4est_gloidx_t gfq,
int  num_procs,
int  p 
)

Query whether a processor has no quadrants.

Parameters
[in]gfqAn array encoding the partition offsets in the global quadrant array; length num_procs + 1.
[in]num_procsNumber of processes in the partition.
[in]pValid 0 <= p < num_procs.
Returns
True if and only if processor p is empty.

◆ p8est_comm_is_owner()

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.

The quadrant is considered owned if its first descendant is owned. Thus, a positive result occurs even if its last descendant overlaps a higher process.

Parameters
[in]p8estValid forest.
[in]which_treeValid tree number wrt. the forest.
[in]qValid quadrant wrt. the forest.
[in]rankRank whose ownership is tested.
Returns
True if rank is the owner of the first descendant.

◆ p8est_comm_is_owner_gfp()

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.

This array encodes part of the partition of a valid forest object. The quadrant is considered owned if its first descendant is owned. Thus, a positive result occurs even if its last descendant overlaps a higher process.

Parameters
[in]gfpPosition array of length num_procs + 1.
[in]num_procsNumber of processes in this context.
[in]num_treesNumber of trees in this context.
[in]which_treeValid tree number wrt. the forest.
[in]qValid quadrant wrt. the forest.
[in]rankRank whose ownership is tested.
Returns
True if rank is the owner of the first descendant.

◆ p8est_comm_neighborhood_owned()

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.

Parameters
[in]p8estThe p8est to work on.
[in]which_treeThe tree index to work on.
[in]full_treeFlags as computed by p8est_comm_tree_info.
[in]tree_contactFlags as computed by p8est_comm_tree_info.
[in]qThe quadrant to be checked.
Returns
Returns true iff this quadrant's 3x3 neighborhood is owned.

◆ p8est_comm_parallel_env_assign()

void p8est_comm_parallel_env_assign ( p8est_t p8est,
sc_MPI_Comm  mpicomm 
)

Assign an MPI communicator to p8est; retrieve parallel environment.

Parameters
[in]mpicommA valid MPI communicator.
Note
The provided MPI communicator is not owned by p8est.

◆ p8est_comm_parallel_env_duplicate()

void p8est_comm_parallel_env_duplicate ( p8est_t p8est)

Duplicate MPI communicator and replace the current one by the duplicate.

Note
The duplicated MPI communicator is owned by p8est.

◆ p8est_comm_parallel_env_is_null()

int p8est_comm_parallel_env_is_null ( p8est_t p8est)

Check if the MPI communicator is valid.

Returns
True if communicator is not NULL communicator, false otherwise.

◆ p8est_comm_parallel_env_reduce()

int p8est_comm_parallel_env_reduce ( p8est_t **  p8est_supercomm)

Reduce MPI communicator to non-empty ranks (i.e., nonzero quadrant counts).

Parameters
[in,out]p8est_supercommObject which communicator is reduced. Points to NULL if this p8est does not exists.
Returns
True if p8est exists on this MPI rank after reduction.

◆ p8est_comm_parallel_env_reduce_ext()

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 communicator regardless whether they are empty or not.

Parameters
[in,out]p8est_supercommObject which communicator is reduced. Points to NULL if this p8est does not exists.
[in]group_addGroup of ranks that will remain in communicator.
[in]add_to_beginningIf true, ranks will be added to the beginning of the reduced communicator, otherwise to the end.
[out]ranks_subcommIf not null, array of size 'subcommsize' with subcommrank->supercommrank map.
Returns
True if p8est exists on this MPI rank after reduction.

◆ p8est_comm_parallel_env_replace()

void p8est_comm_parallel_env_replace ( p8est_t p8est,
sc_MPI_Comm  mpicomm 
)

Replace the current MPI communicator by the one provided as input.

Parameters
[in]mpicommA valid MPI communicator.
Note
The provided MPI communicator is not owned by p8est.

◆ p8est_comm_sync_flag()

int p8est_comm_sync_flag ( p8est_t p8est,
int  flag,
sc_MPI_Op  operation 
)

Evaluates true/false of a flag among processors.

Parameters
[in]p8estThe MPI communicator of this p8est will be used.
[in]flagThe variable to communicate.
[in]operationEither sc_MPI_BAND or sc_MPI_BOR (not used bitwise).
Returns
Returns the logical AND resp. OR of all processors' flags.

◆ p8est_comm_tree_info()

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.

This is determined separately for the beginning and end of the tree.

Parameters
[in]p8estThe p8est to work on.
[in]which_treeThe tree in question must be partially owned.
[out]full_treeFull ownership of beginning and end of tree.
[out]tree_contactTrue if there are neighbors across the face.
[out]firstqSmallest possible first quadrant on this core.
[out]nextqSmallest possible first quadrant on next core. Any of tree_contact, firstq and nextq may be NULL.

◆ p8est_transfer_custom()

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.

(See p8est_transfer_fixed that is optimized for fixed-size data.) The destination process may not know the data size for the elements it receives. In this case the sizes need to be obtained separately in advance, for example by calling p8est_transfer_fixed with src_sizes as payload data, or alternatively its split begin/end versions.

Parameters
[in]dest_gfqThe target partition encoded as a p8est->global_first_quadrant array. Has mpisize
  • 1 members, must be non-decreasing and satisfy gfq[0] == 0, gfq[mpisize] == global_num_quadrants.
[in]src_gfqThe original partition, analogous to dest_gfq.
[in]mpicommThe communicator to use. Its mpisize must match dest_gfq and src_gfq.
[in]tagThis tag is used in all messages. The user must guarantee that mpicomm and tag do not conflict with other messages in transit.
[out]dest_dataUser-allocated memory of sum_{i in dest->local_num_quadrants} dest_sizes [i] many bytes is received into. See below about how to choose its size.
[in]dest_sizesUser-allocated memory of one integer for each quadrant, storing the data size to receive for it. We understand that the sizes are often not known a priori, in which case they can be obtained by a prior call to p8est_transfer_fixed. Optionally the split begin/end versions can be used for added flexibility and overlapping of messages. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t.
[in]src_dataUser-allocated memory of sum_{i in src->local_num_quadrants} src_sizes [i] many bytes is sent from.
[in]src_sizesUser-allocated memory of one integer for each quadrant, storing the data size to send for it. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t.

◆ p8est_transfer_custom_begin()

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.

See p8est_transfer_custom for a full description. Must be matched with p8est_transfer_custom_end for completion. All parameters must stay alive until the completion has been called.

Parameters
[in]dest_gfqThe target partition encoded as a p8est->global_first_quadrant array. Has mpisize
  • 1 members, must be non-decreasing and satisfy gfq[0] == 0, gfq[mpisize] == global_num_quadrants.
[in]src_gfqThe original partition, analogous to dest_gfq.
[in]mpicommThe communicator to use. Its mpisize must match dest_gfq and src_gfq.
[in]tagThis tag is used in all messages. The user must guarantee that mpicomm and tag do not conflict with other messages in transit.
[out]dest_dataUser-allocated memory of sum_{i in dest->local_num_quadrants} dest_sizes [i] many bytes is received into. It must not be accessed before completion with p8est_transfer_custom_end. See below about how to choose its size.
[in]dest_sizesUser-allocated memory of one integer for each quadrant, storing the data size to receive for it. We understand that the sizes are often not known a priori, in which case they can be obtained by a prior call to p8est_transfer_fixed. Optionally the split begin/end versions can be used for added flexibility and overlapping of messages. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t.
[in]src_dataUser-allocated memory of sum_{i in src->local_num_quadrants} src_sizes [i] many bytes is sent from. It must not be accessed before completion with p8est_transfer_custom_end.
[in]src_sizesUser-allocated memory of one integer for each quadrant, storing the data size to send for it. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t.
Returns
The context object must be passed to the matching call to p8est_transfer_custom_end.

◆ p8est_transfer_custom_end()

void p8est_transfer_custom_end ( p8est_transfer_context_t tc)

Complete a variable-size data transfer between partitions.

Waits for remaining messages to complete and frees the transfer context.

Parameters
[in]tcContext data from p8est_transfer_custom_begin. Is deallocated before this function returns.

◆ p8est_transfer_end()

void p8est_transfer_end ( p8est_transfer_context_t tc)

Complete any of the transfer_begin functions.

The specialized transfer_end functions are recommended over this one for slightly stricter error checking: p8est_transfer_fixed_end, p8est_transfer_custom_end, and p8est_transfer_items_end.

Parameters
[in,out]tcA valid context from one of the begin functions. This function waits for remaining communications to complete and frees the transfer context.

◆ p8est_transfer_fixed()

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.

In p8est_partition, each quadrant's user data is transferred. If the application maintains per-quadrant data outside of the p8est object, this function can be used to transfer it, matching the call to partition. This variant of the function assumes that the quadrant data size is fixed. It sends point-to-point messages only and is blocking collective. There is a split collective version; see the functions p8est_transfer_fixed_begin and p8est_transfer_fixed_end.

Parameters
[in]dest_gfqThe target partition encoded as a p8est->global_first_quadrant array. Has mpisize
  • 1 members, must be non-decreasing and satisfy gfq[0] == 0, gfq[mpisize] == global_num_quadrants.
[in]src_gfqThe original partition, analogous to dest_gfq.
[in]mpicommThe communicator to use. Its mpisize must match dest_gfq and src_gfq.
[in]tagThis tag is used in all messages. The user must guarantee that mpicomm and tag do not conflict with other messages in transit.
[out]dest_dataUser-allocated memory of size data_size * dest->local_num_quadrants is received into.
[in]src_dataUser-allocated memory of size data_size * src->local_num_quadrants bytes is sent from.
[in]data_sizeFixed data size per quadrant.

◆ p8est_transfer_fixed_begin()

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.

See p8est_transfer_fixed for a full description. Must be matched with p8est_transfer_fixed_end for completion. All parameters must stay alive until the completion has been called.

Parameters
[in]dest_gfqThe target partition encoded as a p8est->global_first_quadrant array. Has mpisize
  • 1 members, must be non-decreasing and satisfy gfq[0] == 0, gfq[mpisize] == global_num_quadrants.
[in]src_gfqThe original partition, analogous to dest_gfq.
[in]mpicommThe communicator to use. Its mpisize must match dest_gfq and src_gfq.
[in]tagThis tag is used in all messages. The user must guarantee that mpicomm and tag do not conflict with other messages in transit.
[out]dest_dataUser-allocated memory of size data_size * dest->local_num_quadrants bytes is received into. It must not be accessed before completion with p8est_transfer_fixed_end.
[in]src_dataUser-allocated memory of size data_size * src->local_num_quadrants bytes is sent from. It must not be accessed before completion with p8est_transfer_fixed_end.
[in]data_sizeFixed data size per quadrant.
Returns
The context object must be passed to the matching call to p8est_transfer_fixed_end.

◆ p8est_transfer_fixed_end()

void p8est_transfer_fixed_end ( p8est_transfer_context_t tc)

Complete a fixed-size data transfer between partitions.

Waits for remaining messages to complete and frees the transfer context.

Parameters
[in]tcContext data from p8est_transfer_fixed_begin. Is deallocated before this function returns.

◆ p8est_transfer_items()

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.

Each quadrant may have a different number of items (including 0). (See p8est_transfer_fixed that is optimized for fixed-count data, and p8est_transfer_custom for data that is not itemized at all.) The destination process may not know the item count for the elements it receives. In this case the counts need to be obtained separately in advance, for example by calling p8est_transfer_fixed with src_counts as payload data, or alternatively its split begin/end versions.

Parameters
[in]dest_gfqThe target partition encoded as a p8est->global_first_quadrant array. Has mpisize
  • 1 members, must be non-decreasing and satisfy gfq[0] == 0, gfq[mpisize] == global_num_quadrants.
[in]src_gfqThe original partition, analogous to dest_gfq.
[in]mpicommThe communicator to use. Its mpisize must match dest_gfq and src_gfq.
[in]tagThis tag is used in all messages. The user must guarantee that mpicomm and tag do not conflict with other messages in transit.
[out]dest_dataUser-allocated memory of sum_{i in dest->local_num_quadrants} item_size
  • dest_counts[i] many bytes is received into. See below about how to choose its size. If dest has data to transfer, must be non-NULL.
[in]dest_countsUser-allocated memory of one integer for each quadrant, storing the item count to receive for it. We understand that the counts are often not known a priori, in which case they can be obtained by a prior call to p8est_transfer_fixed. Optionally the split begin/end versions can be used for added flexibility and overlapping of messages. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t. If dest has quadrants, must be non-NULL.
[in]src_dataUser-allocated memory of sum_{i in src->local_num_quadrants} item_size
  • src_counts[i] many bytes is sent from. If src has data to transfer, must be non-NULL.
[in]src_countsUser-allocated memory of one integer for each quadrant, storing the item count to send for it. We use the type int to minimize the message size, and to conform to MPI that has no type for size_t. If src has quadrants, must be non-NULL.
[in]item_sizeData size for each item in bytes.

◆ p8est_transfer_items_begin()

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.

See p8est_transfer_items for a full description. This functions calls asynchronous MPI send/receive and returns. Must be matched with p8est_transfer_items_end for completion, which calls blocking MPI wait until all messages have been processed. All parameters must stay alive until the completion has been called.

◆ p8est_transfer_items_end()

void p8est_transfer_items_end ( p8est_transfer_context_t tc)

Complete a variable-count item transfer between partitions.

Waits for remaining messages to complete and frees the transfer context.

Parameters
[in]tcContext data from p8est_transfer_items_begin. Is deallocated before this function returns.