t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
Functions
t8_cmesh_partition.c File Reference

TODO: document this file. More...

#include <t8_data/t8_shmem.h>
#include <t8_cmesh.h>
#include <t8_element.h>
#include "t8_cmesh_types.h"
#include "t8_cmesh_trees.h"
#include "t8_cmesh_partition.h"
#include "t8_cmesh_offset.h"

Functions

void t8_cmesh_gather_trees_per_eclass (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 From num_local_trees_per_eclass compute num_trees_per_eclass. More...
 
void t8_cmesh_gather_treecount (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 Create the offset array for a partitioned cmesh. More...
 
void t8_cmesh_gather_treecount_nocommit (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 Perform the same task as t8_cmesh_gather_treecount, but do not perform the debugging check whether cmesh is committed. More...
 
void t8_cmesh_partition_receive_message (t8_cmesh_t cmesh, sc_MPI_Comm comm, int proc_recv, sc_MPI_Status *status, int *local_procid, int recv_first, t8_locidx_t *num_ghosts)
 
void t8_cmesh_partition (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 Given a cmesh which is to be partitioned, execute the partition task. More...
 
void t8_cmesh_offset_print (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 
t8_shmem_array_t t8_cmesh_offset_concentrate (int proc, sc_MPI_Comm comm, t8_gloidx_t num_trees)
 Create a valid partition table that concentrates all trees at a given process. More...
 
t8_shmem_array_t t8_cmesh_offset_random (sc_MPI_Comm comm, t8_gloidx_t num_trees, int shared, unsigned seed)
 Create a random partition table. More...
 
t8_shmem_array_t t8_cmesh_offset_percent (t8_cmesh_t cmesh, sc_MPI_Comm comm, int percent)
 Create a repartition array, where each process sends a percentage of its trees to the next process. More...
 
t8_shmem_array_t t8_cmesh_offset_half (t8_cmesh_t cmesh, sc_MPI_Comm comm)
 Create a repartition array, where each process sends half of its trees to the next process. More...
 

Detailed Description

TODO: document this file.

Function Documentation

◆ t8_cmesh_gather_treecount()

void t8_cmesh_gather_treecount ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm 
)

Create the offset array for a partitioned cmesh.

This function is collective.

Parameters
[in,out]cmeshThe cmesh whose array should be created. Must be partitioned and committed.
[in]commMpi communicator used to create the offset array.
Note
if the offset array (cmesh->tree_offsets) already exists, it is not changed.

◆ t8_cmesh_gather_treecount_nocommit()

void t8_cmesh_gather_treecount_nocommit ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm 
)

Perform the same task as t8_cmesh_gather_treecount, but do not perform the debugging check whether cmesh is committed.

Warning
Use with caution and only if you know what you are doing. Prefer t8_cmesh_gather_treecount. This function is collective.
Parameters
[in,out]cmeshThe cmesh whose array should be created. Must be partitioned and first and last local tree as well as the total number of tree must be set.
[in]commMpi communicator used to create the offset array.
Note
if the offset array (cmesh->tree_offsets) already exists, it is not changed.

◆ t8_cmesh_gather_trees_per_eclass()

void t8_cmesh_gather_trees_per_eclass ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm 
)

From num_local_trees_per_eclass compute num_trees_per_eclass.

This function is collective.

Parameters
[in,out]cmeshThe cmesh whose num_trees_per_eclass values should be created. Must be partitioned and committed.
[in]commMpi communicator used to create the offset array.
Warning
This function does not perform a check whether cmesh is committed. Use with caution.

◆ t8_cmesh_offset_concentrate()

t8_shmem_array_t t8_cmesh_offset_concentrate ( int  proc,
sc_MPI_Comm  comm,
t8_gloidx_t  num_trees 
)

Create a valid partition table that concentrates all trees at a given process.

Parameters
[in]procThe processor that should get all trees.
[in]commThe communicator to use.
[in]num_treesThe number of global trees in the partition.
Returns
A valid partition table for a cmesh with num_trees trees and communicator comm, where each tree is on process proc.
Note
This function is MPI collective.

◆ t8_cmesh_offset_half()

t8_shmem_array_t t8_cmesh_offset_half ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm 
)

Create a repartition array, where each process sends half of its trees to the next process.

The last process does not send any trees.

Parameters
[in]cmeshA cmesh that is committed and partitioned.
[in]commA valid MPI communicator for cmesh.
Returns
A shared memory offset array storing the new offsets. Its associated communicator is comm.
Note
This function is MPI collective.

◆ t8_cmesh_offset_percent()

t8_shmem_array_t t8_cmesh_offset_percent ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm,
int  percent 
)

Create a repartition array, where each process sends a percentage of its trees to the next process.

The last process does not send any trees.

Parameters
[in]cmeshA cmesh that is committed and partitioned.
[in]commA valid MPI communicator for cmesh.
[in]percentThe percentage of trees that this process should send to the next one. Must satisfy 0 <= percent <= 100 and be the same on each process.
Returns
A shared memory offset array storing the new offsets. Its associated communicator is comm.
Note
This function is MPI collective.

◆ t8_cmesh_offset_random()

t8_shmem_array_t t8_cmesh_offset_random ( sc_MPI_Comm  comm,
t8_gloidx_t  num_trees,
int  shared,
unsigned  seed 
)

Create a random partition table.

The use of this function is only reasonable for debugging.

Parameters
[in]commThe communicator to use.
[in]num_treesThe number of global trees in the partition.
[in]sharedIf true than there will be shared trees in the generated partition table.
[in]seedA seed to be used for the random number generator. If zero, a random seed is choosen. seed has to be the same on each process.
Returns
A valid partition table for a cmesh with num_trees trees and communicator comm, where each processor gets a random number of trees. The number of trees per processor is roughly uniformly distributed.
Note
This function is MPI collective.

◆ t8_cmesh_partition()

void t8_cmesh_partition ( t8_cmesh_t  cmesh,
sc_MPI_Comm  comm 
)

Given a cmesh which is to be partitioned, execute the partition task.

This includes partitioning by uniform level and partitioning from a second cmesh

Parameters
[in,out]cmeshThe cmesh to be partitioned
[in]commThe MPI communicator This function is usually called within t8_cmesh_commit