t8
1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
TODO: document this file. More...
Go to the source code of this file.
Data Structures | |
struct | t8_trees_glo_lo_hash_t |
This struct is an entry of the trees global_id to local_id hash table for ghost trees. More... | |
Functions | |
void | t8_cmesh_trees_init (t8_cmesh_trees_t *ptrees, int num_procs, t8_locidx_t num_trees, t8_locidx_t num_ghosts) |
Initialize a trees structure and allocate its parts. More... | |
t8_part_tree_t | t8_cmesh_trees_get_part (t8_cmesh_trees_t trees, int proc) |
Return one part of a specified tree array. More... | |
void | t8_cmesh_trees_start_part (t8_cmesh_trees_t trees, int proc, t8_locidx_t lfirst_tree, t8_locidx_t num_trees, t8_locidx_t lfirst_ghost, t8_locidx_t num_ghosts, int alloc) |
Allocate the first_tree array of a given tree_part in a tree struct with a given number of trees and ghosts. More... | |
void | t8_cmesh_trees_finish_part (t8_cmesh_trees_t trees, int proc) |
After all classes of trees and ghosts have been set and after the number of tree attributes was set and their total size (per tree) stored temporarily in the att_offset variable we grow the part array by the needed amount of memory and set the offsets appropiately. More... | |
void | t8_cmesh_trees_copy_toproc (t8_cmesh_trees_t trees_dest, t8_cmesh_trees_t trees_src, t8_locidx_t lnum_trees, t8_locidx_t lnum_ghosts) |
Copy the tree_to_proc and ghost_to_proc arrays of one tree structure to another one. More... | |
void | t8_cmesh_trees_copy_part (t8_cmesh_trees_t trees_dest, int part_dest, t8_cmesh_trees_t trees_src, int part_src) |
Copy the trees array from one part to another. More... | |
void | t8_cmesh_trees_add_tree (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, int proc, t8_eclass_t eclass) |
Add a tree to a trees structure. More... | |
void | t8_cmesh_trees_add_ghost (t8_cmesh_trees_t trees, t8_locidx_t lghost_index, t8_gloidx_t gtree_id, int proc, t8_eclass_t eclass, t8_locidx_t num_local_trees) |
Add a ghost to a trees structure. More... | |
void | t8_cmesh_trees_set_all_boundary (t8_cmesh_t cmesh, t8_cmesh_trees_t trees) |
Set all neighbor fields of all local trees and ghosts to boundary. More... | |
void | t8_cmesh_trees_get_part_data (t8_cmesh_trees_t trees, int proc, t8_locidx_t *first_tree, t8_locidx_t *num_trees, t8_locidx_t *first_ghost, t8_locidx_t *num_ghosts) |
t8_ctree_t | t8_cmesh_trees_get_tree (t8_cmesh_trees_t trees, t8_locidx_t ltree) |
Return a pointer to a specific tree in a trees struct. More... | |
t8_ctree_t | t8_cmesh_trees_get_tree_ext (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, t8_locidx_t **face_neigh, int8_t **ttf) |
Return a pointer to a specific tree in a trees struct plus pointers to its face_neighbor and tree_to_face arrays. More... | |
t8_locidx_t | t8_cmesh_trees_get_face_info (t8_cmesh_trees_t trees, t8_locidx_t ltreeid, int face, int8_t *ttf) |
Return the face neigbor of a tree at a given face and return the tree_to_face info. More... | |
t8_locidx_t | t8_cmesh_trees_get_face_neighbor (const t8_ctree_t tree, const int face) |
Given a coarse tree and a face number, return the local id of the neighbor tree. More... | |
t8_locidx_t | t8_cmesh_trees_get_face_neighbor_ext (const t8_ctree_t tree, const int face, int8_t *ttf) |
Given a coarse tree and a face number, return the local id of the neighbor tree together with its tree-to-face info. More... | |
t8_gloidx_t | t8_cmesh_trees_get_ghost_face_neighbor_ext (const t8_cghost_t ghost, const int face, int8_t *ttf) |
Given a coarse ghost and a face number, return the local id of the neighbor tree together with its tree-to-face info. More... | |
t8_cghost_t | t8_cmesh_trees_get_ghost (t8_cmesh_trees_t trees, t8_locidx_t lghost) |
Return a pointer to a specific ghost in a trees struct. More... | |
t8_cghost_t | t8_cmesh_trees_get_ghost_ext (t8_cmesh_trees_t trees, t8_locidx_t lghost_id, t8_gloidx_t **face_neigh, int8_t **ttf) |
Return a pointer to a specific ghost in a trees struct plus pointers to its face_neighbor and tree_to_face arrays. More... | |
t8_locidx_t | t8_cmesh_trees_get_ghost_local_id (t8_cmesh_trees_t trees, t8_gloidx_t global_id) |
Given the global tree id of a ghost tree in a trees structure, return its local ghost id. More... | |
size_t | t8_cmesh_trees_size (t8_cmesh_trees_t trees) |
void | t8_cmesh_trees_init_attributes (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, size_t num_attributes, size_t attr_bytes) |
For one tree in a trees structure set the number of attributes and temporarily store the total size of all of this tree's attributes. More... | |
void * | t8_cmesh_trees_get_attribute (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, int package_id, int key, size_t *size, int is_ghost) |
Return an attribute that is stored at a tree. More... | |
size_t | t8_cmesh_trees_attribute_size (t8_ctree_t tree) |
Return the total size of all attributes stored at a specified tree. More... | |
size_t | t8_cmesh_trees_ghost_attribute_size (t8_cghost_t ghost) |
Return the total size of all attributes stored at a specified ghost. More... | |
void | t8_cmesh_trees_add_attribute (t8_cmesh_trees_t trees, int proc, t8_stash_attribute_struct_t *attr, t8_locidx_t tree_id, size_t index) |
size_t | t8_cmesh_trees_get_numproc (t8_cmesh_trees_t trees) |
Return the number of parts of a trees structure. More... | |
int8_t | t8_cmesh_tree_to_face_encode (const int dimension, const t8_locidx_t face, const int orientation) |
Compute the tree-to-face information given a face and orientation value of a face connection. More... | |
void | t8_cmesh_tree_to_face_decode (const int dimension, const int8_t tree_to_face, int *face, int *orientation) |
Given a tree-to-face value, get its encoded face number and orientation. More... | |
void | t8_cmesh_trees_print (t8_cmesh_t cmesh, t8_cmesh_trees_t trees) |
Print the trees,ghosts and their neighbors in ASCII format t stdout. More... | |
void | t8_cmesh_trees_bcast (t8_cmesh_t cmesh_in, int root, sc_MPI_Comm comm) |
Brodcast an existing valid trees structure from a root rank to all other ranks. More... | |
int | t8_cmesh_trees_is_face_consistend (t8_cmesh_t cmesh, t8_cmesh_trees_t trees) |
Check whether the face connection of a trees structure are consistent. More... | |
int | t8_cmesh_trees_is_equal (t8_cmesh_t cmesh, t8_cmesh_trees_t trees_a, t8_cmesh_trees_t trees_b) |
void | t8_cmesh_trees_destroy (t8_cmesh_trees_t *trees) |
Free all memory allocated with a trees structure. More... | |
TODO: document this file.
#define T8_GHOST_TTF | ( | g | ) |
#define T8_TREE_ATTR_INFO | ( | t, | |
i | |||
) |
#define T8_TREE_TTF | ( | t | ) |
void t8_cmesh_tree_to_face_decode | ( | const int | dimension, |
const int8_t | tree_to_face, | ||
int * | face, | ||
int * | orientation | ||
) |
Given a tree-to-face value, get its encoded face number and orientation.
[in] | dimension | The dimension of the corresponding eclasses. |
[in] | tree_to_face | A tree-to-face value |
[out] | face | On output filled with the stored face value. |
[out] | orientation | On output filled with the stored orientation value. |
int8_t t8_cmesh_tree_to_face_encode | ( | const int | dimension, |
const t8_locidx_t | face, | ||
const int | orientation | ||
) |
Compute the tree-to-face information given a face and orientation value of a face connection.
[in] | dimension | The dimension of the corresponding eclasses. |
[in] | face | A face number |
[in] | orientation | A face-to-face orientation. |
void t8_cmesh_trees_add_ghost | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | lghost_index, | ||
t8_gloidx_t | gtree_id, | ||
int | proc, | ||
t8_eclass_t | eclass, | ||
t8_locidx_t | num_local_trees | ||
) |
Add a ghost to a trees structure.
[in,out] | trees | The trees structure to be updated. |
[in] | ghost_index | The index in the part array of the ghost to be inserted. |
[in] | tree_id | The global index of the ghost. |
[in] | proc | The mpirank of the process from which the ghost was received. |
[in] | eclass | The ghost's element class. |
[in] | num_local_trees | The number of local trees in the cmesh. |
void t8_cmesh_trees_add_tree | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltree_id, | ||
int | proc, | ||
t8_eclass_t | eclass | ||
) |
Add a tree to a trees structure.
[in,out] | trees | The trees structure to be updated. |
[in] | tree_id | The local id of the tree to be inserted. |
[in] | proc | The mpirank of the process from which the tree was received. |
[in] | eclass | The tree's element class. |
size_t t8_cmesh_trees_attribute_size | ( | t8_ctree_t | tree | ) |
Return the total size of all attributes stored at a specified tree.
[in] | tree | A tree structure. |
void t8_cmesh_trees_bcast | ( | t8_cmesh_t | cmesh_in, |
int | root, | ||
sc_MPI_Comm | comm | ||
) |
Brodcast an existing valid trees structure from a root rank to all other ranks.
The trees structure must belong to cmeshes whose meta_information is already set. t8_cmesh_bcast.
[in] | cmesh_in | On root a committed, replicated cmesh. On the other ranks an initialized cmesh with the same number of trees as on root. |
[in] | root | The rank that broadcasts cmesh_in to all other ranks. |
[in] | comm | MPI communicator to use. |
void t8_cmesh_trees_copy_part | ( | t8_cmesh_trees_t | trees_dest, |
int | part_dest, | ||
t8_cmesh_trees_t | trees_src, | ||
int | part_src | ||
) |
Copy the trees array from one part to another.
[in,out] | trees_dest | The trees struct of the destination part. |
[in] | part_dest | The index of the destination part. Must be initialized by t8_cmesh_trees_start_part with alloc = 0. |
[in] | trees_src | The trees struct of the source part. |
[in] | part_src | The index of the destination part. Must be a valid part, thus t8_cmesh_trees_finish_part must have been called. |
void t8_cmesh_trees_copy_toproc | ( | t8_cmesh_trees_t | trees_dest, |
t8_cmesh_trees_t | trees_src, | ||
t8_locidx_t | lnum_trees, | ||
t8_locidx_t | lnum_ghosts | ||
) |
Copy the tree_to_proc and ghost_to_proc arrays of one tree structure to another one.
[in,out] | trees_dest | The destination trees structure. |
[in] | trees_src | The source trees structure. |
[in] | lnum_trees | The total number of trees stored in trees_src. |
[in] | lnum_ghosts | The total number of ghosts stored in trees_src. |
void t8_cmesh_trees_destroy | ( | t8_cmesh_trees_t * | trees | ) |
Free all memory allocated with a trees structure.
This means that all coarse trees and ghosts, their face neighbor entries and attributes and the additional structures of trees are freed.
[in,out] | trees | The tree structure to be destroyed. Set to NULL on output. |
void t8_cmesh_trees_finish_part | ( | t8_cmesh_trees_t | trees, |
int | proc | ||
) |
After all classes of trees and ghosts have been set and after the number of tree attributes was set and their total size (per tree) stored temporarily in the att_offset variable we grow the part array by the needed amount of memory and set the offsets appropiately.
The workflow should be: call t8_cmesh_trees_start_part, set tree and ghost classes maually via t8_cmesh_trees_add_tree and t8_cmesh_trees_add_ghost, call t8_cmesh_trees_init_attributes, then call this function. Afterwards successively call t8_cmesh_trees_add_attribute for each attribute and also set all face neighbors (TODO: write function).
[in,out] | trees | The trees structure to be updated. |
[in] | proc | The number of the part to be finished. |
void* t8_cmesh_trees_get_attribute | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltree_id, | ||
int | package_id, | ||
int | key, | ||
size_t * | size, | ||
int | is_ghost | ||
) |
Return an attribute that is stored at a tree.
[in] | trees | The trees structure. |
[in] | ltree_id | The local id of the tree whose attribute is querid. |
[in] | package_id | The package identifier of the attribute. |
[in] | key | The key of the attribute within all attributes of the same package identifier. |
[out] | size | If not NULL, the size (in bytes) of the attribute will be stored here. |
[in] | is_ghost | If true, then ltree_id is interpreted as the local_id of a ghost. |
t8_locidx_t t8_cmesh_trees_get_face_info | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltreeid, | ||
int | face, | ||
int8_t * | ttf | ||
) |
Return the face neigbor of a tree at a given face and return the tree_to_face info.
[in] | trees | The trees structure where the tree is to be looked up. |
[in] | ltreeid | The local id of the tree. |
[in] | face | A face of the tree. |
[out] | ttf | If not NULL the tree_to_face value of the face connection. |
t8_locidx_t t8_cmesh_trees_get_face_neighbor | ( | const t8_ctree_t | tree, |
const int | face | ||
) |
Given a coarse tree and a face number, return the local id of the neighbor tree.
[in] | tree. | The coarse tree. |
[in] | face. | The face number. |
t8_locidx_t t8_cmesh_trees_get_face_neighbor_ext | ( | const t8_ctree_t | tree, |
const int | face, | ||
int8_t * | ttf | ||
) |
Given a coarse tree and a face number, return the local id of the neighbor tree together with its tree-to-face info.
[in] | tree | The coarse tree. |
[in] | face | The face number. |
[out] | ttf | If not NULL it is filled with the tree-to-face value for this face. |
t8_cghost_t t8_cmesh_trees_get_ghost | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | lghost | ||
) |
Return a pointer to a specific ghost in a trees struct.
[in] | trees | The tress structure where the tree is to be looked up. |
[in] | lghost | The local id of the ghost. |
t8_cghost_t t8_cmesh_trees_get_ghost_ext | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | lghost_id, | ||
t8_gloidx_t ** | face_neigh, | ||
int8_t ** | ttf | ||
) |
Return a pointer to a specific ghost in a trees struct plus pointers to its face_neighbor and tree_to_face arrays.
[in] | trees | The trees structure where the ghost is to be looked up. |
[in] | lghost_id | The local id of the ghost. |
[out] | face_neigh | If not NULL a pointer to the ghosts face_neighbor array is stored here on return. |
[out] | ttf | If not NULL a pointer to the ghosts tree_to_face array is stored here on return. |
t8_gloidx_t t8_cmesh_trees_get_ghost_face_neighbor_ext | ( | const t8_cghost_t | ghost, |
const int | face, | ||
int8_t * | ttf | ||
) |
Given a coarse ghost and a face number, return the local id of the neighbor tree together with its tree-to-face info.
[in] | ghost | The coarse ghost. |
[in] | face | The face number. |
[out] | ttf | If not NULL it is filled with the tree-to-face value for this face. |
t8_locidx_t t8_cmesh_trees_get_ghost_local_id | ( | t8_cmesh_trees_t | trees, |
t8_gloidx_t | global_id | ||
) |
Given the global tree id of a ghost tree in a trees structure, return its local ghost id.
[in] | trees | The trees structure. |
[in] | global_id | A global tree id. |
size_t t8_cmesh_trees_get_numproc | ( | t8_cmesh_trees_t | trees | ) |
Return the number of parts of a trees structure.
[in] | trees | The trees structure. |
t8_part_tree_t t8_cmesh_trees_get_part | ( | t8_cmesh_trees_t | trees, |
int | proc | ||
) |
Return one part of a specified tree array.
[in] | trees | The tree array to be queried |
[in] | proc | An index specifying the part to be returned. |
t8_ctree_t t8_cmesh_trees_get_tree | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltree | ||
) |
Return a pointer to a specific tree in a trees struct.
[in] | trees | The tress structure where the tree is to be looked up. |
[in] | ltree | The local id of the tree. |
t8_ctree_t t8_cmesh_trees_get_tree_ext | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltree_id, | ||
t8_locidx_t ** | face_neigh, | ||
int8_t ** | ttf | ||
) |
Return a pointer to a specific tree in a trees struct plus pointers to its face_neighbor and tree_to_face arrays.
[in] | trees | The trees structure where the tree is to be looked up. |
[in] | ltree_id | The local id of the tree. |
[out] | face_neigh | If not NULL a pointer to the trees face_neighbor array is stored here on return. |
[out] | ttf | If not NULL a pointer to the trees tree_to_face array is stored here on return. |
size_t t8_cmesh_trees_ghost_attribute_size | ( | t8_cghost_t | ghost | ) |
Return the total size of all attributes stored at a specified ghost.
[in] | ghost | A ghost structure. |
void t8_cmesh_trees_init | ( | t8_cmesh_trees_t * | ptrees, |
int | num_procs, | ||
t8_locidx_t | num_trees, | ||
t8_locidx_t | num_ghosts | ||
) |
Initialize a trees structure and allocate its parts.
This function allocates the from_procs array without filling it, it also allocates the tree_to_proc and ghost_to_proc arrays. No memory for trees or ghosts is allocated.
[in,ou | ptrees The trees structure to be initialized. | |
[in] | num_procs | The number of entries of its from_proc array (can be different for each process). |
[in] | num_trees | The number of trees that will be stored in this structure. |
[in] | num_ghosts | The number of ghosts that will be stored in this structure. |
void t8_cmesh_trees_init_attributes | ( | t8_cmesh_trees_t | trees, |
t8_locidx_t | ltree_id, | ||
size_t | num_attributes, | ||
size_t | attr_bytes | ||
) |
For one tree in a trees structure set the number of attributes and temporarily store the total size of all of this tree's attributes.
This temporary value is used in t8_cmesh_trees_finish_part.
[in,out] | trees | The trees structure to be updated. |
[in] | ltree_id | The local id of one tree in trees. |
[in] | num_attributes | The number of attributes of this tree. |
[in] | attr_bytes | The total number of bytes of all attributes of this tree. |
int t8_cmesh_trees_is_face_consistend | ( | t8_cmesh_t | cmesh, |
t8_cmesh_trees_t | trees | ||
) |
Check whether the face connection of a trees structure are consistent.
That is if tree1 lists tree2 as neighbor at face i with ttf entries (or,face j), then tree2 must list tree1 as neighbor at face j with ttf entries (or, face i).
[in] | cmesh | A cmesh structure to be checked. |
[in] | trees | The cmesh's trees struct. |
void t8_cmesh_trees_print | ( | t8_cmesh_t | cmesh, |
t8_cmesh_trees_t | trees | ||
) |
Print the trees,ghosts and their neighbors in ASCII format t stdout.
This function is used for debugging purposes.
[in] | cmesh | A coarse mesh structure that must be committed. |
[in] | trees | The trees structure of cmesh. |
void t8_cmesh_trees_set_all_boundary | ( | t8_cmesh_t | cmesh, |
t8_cmesh_trees_t | trees | ||
) |
Set all neighbor fields of all local trees and ghosts to boundary.
[in,out] | cmesh,The | associated cmesh. |
[in,out] | trees,The | trees structure. A face f of tree t counts as boundary if the face-neighbor is also t at face f. |
void t8_cmesh_trees_start_part | ( | t8_cmesh_trees_t | trees, |
int | proc, | ||
t8_locidx_t | lfirst_tree, | ||
t8_locidx_t | num_trees, | ||
t8_locidx_t | lfirst_ghost, | ||
t8_locidx_t | num_ghosts, | ||
int | alloc | ||
) |
Allocate the first_tree array of a given tree_part in a tree struct with a given number of trees and ghosts.
This function allocates the memory for the trees and the ghosts but not for their face neighbor entries or attributes. These must be allocated later when the eclasses of the trees and ghosts are known t8_cmesh_trees_finish_part.
[in,out] | trees | The trees structure to be updated. |
[in] | proc | The index of the part to be updated. |
[in] | lfirst_tree | The local id of the first tree of that part. |
[in] | num_trees | The number of trees of that part. |
[in] | lfirst_ghost | The local id of the first ghost of that part. |
[in] | num_ghosts | The number of ghosts of that part. |
[in] | alloc | If true then the first_tree array is allocated for the number of trees and ghosts. When a cmesh is copied we do not want this, so in we pass alloc = 0 then. |