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_forest_ghost.h File Reference

We define the ghost routine to create a layer of halo elements for a forest of trees in this file. More...

#include <t8.h>
#include <t8_forest/t8_forest_types.h>

Go to the source code of this file.

Functions

void t8_forest_ghost_init (t8_forest_ghost_t *pghost, t8_ghost_type_t ghost_type)
 
t8_locidx_t t8_forest_ghost_num_trees (t8_forest_t forest)
 
t8_locidx_t t8_forest_ghost_get_tree_element_offset (t8_forest_t forest, t8_locidx_t lghost_tree)
 Return the element offset of a ghost tree. More...
 
t8_locidx_t t8_forest_ghost_tree_num_elements (t8_forest_t forest, t8_locidx_t lghost_tree)
 
t8_element_array_tt8_forest_ghost_get_tree_elements (t8_forest_t forest, t8_locidx_t lghost_tree)
 Get a pointer to the ghost element array of a ghost tree. More...
 
t8_locidx_t t8_forest_ghost_get_ghost_treeid (t8_forest_t forest, t8_gloidx_t gtreeid)
 Given a global tree compute the ghost local tree id of it. More...
 
t8_eclass_t t8_forest_ghost_get_tree_class (t8_forest_t forest, t8_locidx_t lghost_tree)
 
t8_gloidx_t t8_forest_ghost_get_global_treeid (t8_forest_t forest, t8_locidx_t lghost_tree)
 Given a local ghost tree compute the global tree id of it. More...
 
t8_element_tt8_forest_ghost_get_element (t8_forest_t forest, t8_locidx_t lghost_tree, t8_locidx_t lelement)
 
int * t8_forest_ghost_get_remotes (t8_forest_t forest, int *num_remotes)
 Return the array of remote ranks. More...
 
t8_locidx_t t8_forest_ghost_remote_first_tree (t8_forest_t forest, int remote)
 Return the first local ghost tree of a remote rank. More...
 
t8_locidx_t t8_forest_ghost_remote_first_elem (t8_forest_t forest, int remote)
 Return the local index of the first ghost element that belongs to a given remote rank. More...
 
void t8_forest_ghost_ref (t8_forest_ghost_t ghost)
 Increase the reference count of a ghost structure. More...
 
void t8_forest_ghost_unref (t8_forest_ghost_t *pghost)
 Descrease the reference count of a ghost structure. More...
 
void t8_forest_ghost_destroy (t8_forest_ghost_t *pghost)
 Verify that a ghost structure has only one reference left and destroy it. More...
 
void t8_forest_ghost_create (t8_forest_t forest)
 Create one layer of ghost elements for a forest. More...
 
void t8_forest_ghost_create_balanced_only (t8_forest_t forest)
 Create one layer of ghost elements for a forest. More...
 
void t8_forest_ghost_create_topdown (t8_forest_t forest)
 

Detailed Description

We define the ghost routine to create a layer of halo elements for a forest of trees in this file.

Function Documentation

◆ t8_forest_ghost_create()

void t8_forest_ghost_create ( t8_forest_t  forest)

Create one layer of ghost elements for a forest.

See also
t8_forest_set_ghost
Parameters
[in,out]forestThe forest. forest must be committed before calling this function.

◆ t8_forest_ghost_create_balanced_only()

void t8_forest_ghost_create_balanced_only ( t8_forest_t  forest)

Create one layer of ghost elements for a forest.

This version only works with balanced forests and is the original algorithm from p4est: Scalable Algorithms For Parallel Adaptive Mesh Refinement On Forests of Octrees

Parameters
[in,out]forestThe balanced forest/ forest must be committed before calling this function.
Note
The user should prefer t8_forest_ghost_create even for balanced forests.

◆ t8_forest_ghost_destroy()

void t8_forest_ghost_destroy ( t8_forest_ghost_t pghost)

Verify that a ghost structure has only one reference left and destroy it.

This function is preferred over t8_ghost_unref when it is known that the last reference is to be deleted.

Parameters
[in,out]pghostThis ghost structure must have a reference count of one. It can be in any state (committed or not). Then it effectively calls t8_forest_ghost_unref.

◆ t8_forest_ghost_get_ghost_treeid()

t8_locidx_t t8_forest_ghost_get_ghost_treeid ( t8_forest_t  forest,
t8_gloidx_t  gtreeid 
)

Given a global tree compute the ghost local tree id of it.

Parameters
[in]forestThe forest. Ghost layer must exist.
[in]gtreeidA global tree in forest.
Returns
If gtreeid is also a ghost tree, the index in the ghost->ghost_trees array of the tree. Otherwise a negative number. forest must be committed before calling this function.
See also
https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing.

◆ t8_forest_ghost_get_global_treeid()

t8_gloidx_t t8_forest_ghost_get_global_treeid ( t8_forest_t  forest,
t8_locidx_t  lghost_tree 
)

Given a local ghost tree compute the global tree id of it.

Parameters
[in]forestThe forest. Ghost layer must exist.
[in]lghost_treeThe ghost tree id of a ghost tree.
Returns
The global id of the local ghost tree lghost_tree. forest must be committed before calling this function.
See also
https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing.

◆ t8_forest_ghost_get_remotes()

int* t8_forest_ghost_get_remotes ( t8_forest_t  forest,
int *  num_remotes 
)

Return the array of remote ranks.

Parameters
[in]forestA forest with constructed ghost layer.
[in,out]num_remotesOn output the number of remote ranks is stored here.
Returns
The array of remote ranks in ascending order.

◆ t8_forest_ghost_get_tree_element_offset()

t8_locidx_t t8_forest_ghost_get_tree_element_offset ( t8_forest_t  forest,
t8_locidx_t  lghost_tree 
)

Return the element offset of a ghost tree.

Parameters
[in]forestThe forest with constructed ghost layer.
[in]lghost_treeA local ghost id of a ghost tree.
Returns
The element offset of this ghost tree.
Note
forest must be committed before calling this function.

◆ t8_forest_ghost_get_tree_elements()

t8_element_array_t* t8_forest_ghost_get_tree_elements ( t8_forest_t  forest,
t8_locidx_t  lghost_tree 
)

Get a pointer to the ghost element array of a ghost tree.

Parameters
[in]forestThe forest. Ghost layer must exist.
[in]lghost_treeThe ghost tree id of a ghost tree.
Returns
A pointer to the array of ghost elements of the tree. forest must be committed before calling this function.

◆ t8_forest_ghost_ref()

void t8_forest_ghost_ref ( t8_forest_ghost_t  ghost)

Increase the reference count of a ghost structure.

Parameters
[in,out]ghostOn input, this ghost structure must exist with positive reference count.

◆ t8_forest_ghost_remote_first_elem()

t8_locidx_t t8_forest_ghost_remote_first_elem ( t8_forest_t  forest,
int  remote 
)

Return the local index of the first ghost element that belongs to a given remote rank.

Parameters
[in]forestA forest with constructed ghost layer.
[in]remoteA remote rank of the ghost layer in forest.
Returns
The index i in the ghost elements of the first element of rank remote

◆ t8_forest_ghost_remote_first_tree()

t8_locidx_t t8_forest_ghost_remote_first_tree ( t8_forest_t  forest,
int  remote 
)

Return the first local ghost tree of a remote rank.

Parameters
[in]forestA forest with constructed ghost layer.
[in]remoteA remote rank of the ghost layer in forest.
Returns
The ghost tree id of the first ghost tree that stores ghost elements of remote.

◆ t8_forest_ghost_unref()

void t8_forest_ghost_unref ( t8_forest_ghost_t pghost)

Descrease the reference count of a ghost structure.

If the counter reaches zero, the ghost structure is destroyed. See also t8_forest_ghost_destroy, which is to be preferred when it is known that the last reference to a cmesh is deleted.

Parameters
[in,out]pghostOn input, the ghost structure pointed to must exist with positive reference count. If the reference count reaches zero, the ghost structure is destroyed and this pointer is set to NULL. Otherwise, the pointer is not changed.