t8
1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
We define the data structures and routines for temporary storage before commit. More...
Go to the source code of this file.
Data Structures | |
struct | t8_stash_class |
The eclass information that is stored before a cmesh is committed. More... | |
struct | t8_stash_joinface |
The face-connection information that is stored before a cmesh is committed. More... | |
struct | t8_stash_attribute |
The attribute information that is stored before a cmesh is committed. More... | |
struct | t8_stash |
The stash data structure is used to store information about the cmesh before it is commited. More... | |
Typedefs | |
typedef struct t8_stash * | t8_stash_t |
typedef struct t8_stash_class | t8_stash_class_struct_t |
The eclass information that is stored before a cmesh is committed. | |
typedef struct t8_stash_joinface | t8_stash_joinface_struct_t |
The face-connection information that is stored before a cmesh is committed. | |
typedef struct t8_stash_attribute | t8_stash_attribute_struct_t |
The attribute information that is stored before a cmesh is committed. More... | |
typedef struct t8_stash | t8_stash_struct_t |
The stash data structure is used to store information about the cmesh before it is commited. More... | |
Functions | |
void | t8_stash_init (t8_stash_t *pstash) |
Initialize a stash data structure. More... | |
void | t8_stash_destroy (t8_stash_t *pstash) |
Free all memory associated in a stash structure. More... | |
void | t8_stash_add_class (t8_stash_t stash, t8_gloidx_t id, t8_eclass_t eclass) |
Set the eclass of a tree. More... | |
void | t8_stash_add_facejoin (t8_stash_t stash, t8_gloidx_t gid1, t8_gloidx_t gid2, int face1, int face2, int orientation) |
Add a face connection to a stash. More... | |
void | t8_stash_class_sort (t8_stash_t stash) |
Sort the entries in the class array by the order given in the enum definition of t8_eclass. More... | |
ssize_t | t8_stash_class_bsearch (t8_stash_t stash, t8_gloidx_t tree_id) |
Search for an entry with a given tree index in the class-stash. More... | |
void | t8_stash_joinface_sort (t8_stash_t stash) |
Sort then entries in the facejoin array in order of the first treeid. More... | |
void | t8_stash_add_attribute (t8_stash_t stash, t8_gloidx_t id, int package_id, int key, size_t size, void *attr, int copy) |
Add an attribute to a tree. More... | |
size_t | t8_stash_get_attribute_size (t8_stash_t stash, size_t index) |
Return the size (in bytes) of an attribute in the stash. More... | |
void * | t8_stash_get_attribute (t8_stash_t stash, size_t index) |
Return the pointer to an attribute in the stash. More... | |
t8_gloidx_t | t8_stash_get_attribute_tree_id (t8_stash_t stash, size_t index) |
Return the id of the tree a given attribute belongs to. More... | |
int | t8_stash_get_attribute_key (t8_stash_t stash, size_t index) |
Return the key of a given attribute. More... | |
int | t8_stash_get_attribute_id (t8_stash_t stash, size_t index) |
Return the package_id of a given attribute. More... | |
int | t8_stash_attribute_is_owned (t8_stash_t stash, size_t index) |
Return true if an attribute in the stash is owned by the stash, that is, it was copied in the call to t8_stash_add_attribute. More... | |
void | t8_stash_attribute_sort (t8_stash_t stash) |
Sort the attributes array of a stash in the order (treeid, packageid, key) *. More... | |
t8_stash_t | t8_stash_bcast (t8_stash_t stash, int root, sc_MPI_Comm comm, size_t elem_counts[3]) |
Broadcast a stash on the root process to all processes in a communicator. More... | |
int | t8_stash_is_equal (t8_stash_t stash_a, t8_stash_t stash_b) |
Check two stashes for equal content and return true if so. More... | |
We define the data structures and routines for temporary storage before commit.
typedef struct t8_stash_attribute t8_stash_attribute_struct_t |
The attribute information that is stored before a cmesh is committed.
The pair (package_id, key) serves as a lookup key to identify the data.
typedef struct t8_stash t8_stash_struct_t |
The stash data structure is used to store information about the cmesh before it is commited.
In particular we store the eclasses of the trees, the face-connections and the tree attributes. Using the stash structure allows us to have a very flexible interface. When constructing a new mesh, the user can specify all these mesh entities in arbitrary order. As soon as the cmesh is commited the information is copied from the stash to the cmesh in an order mannered.
void t8_stash_add_attribute | ( | t8_stash_t | stash, |
t8_gloidx_t | id, | ||
int | package_id, | ||
int | key, | ||
size_t | size, | ||
void * | attr, | ||
int | copy | ||
) |
Add an attribute to a tree.
[in] | stash | The stash structure to be modified. |
[in] | id | The global index of the tree to which the attribute is added. |
[in] | package_id | The unique id of the current package. |
[in] | key | An integer value used to identify this attribute. |
[in] | size | The size (in bytes) of the attribute. |
[in] | attr | Points to size bytes of memory that should be stored as the attribute. |
[in] | copy | If true the attribute data is copied from attr to an internal storage. If false only the pointer attr is stored and the data is only copied if the cmesh is committed. (More memory efficient). |
void t8_stash_add_class | ( | t8_stash_t | stash, |
t8_gloidx_t | id, | ||
t8_eclass_t | eclass | ||
) |
Set the eclass of a tree.
[in,out] | stash | The stash to be updated. |
[in] | id | The global id of the tree whose eclass should be set. |
[in] | eclass | The eclass of tree with id id. |
void t8_stash_add_facejoin | ( | t8_stash_t | stash, |
t8_gloidx_t | gid1, | ||
t8_gloidx_t | gid2, | ||
int | face1, | ||
int | face2, | ||
int | orientation | ||
) |
Add a face connection to a stash.
[in,out] | stash | The stash to be updated. |
[in] | id1 | The global id of the first tree. |
[in] | id2 | The global id of the second tree, |
[in] | face1 | The face number of the face of the first tree. |
[in] | face2 | The face number of the face of the second tree. |
[in] | orientation | The orientation of the faces to each other. |
int t8_stash_attribute_is_owned | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return true if an attribute in the stash is owned by the stash, that is, it was copied in the call to t8_stash_add_attribute.
Returns false if the attribute is not owned by the stash.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
void t8_stash_attribute_sort | ( | t8_stash_t | stash | ) |
Sort the attributes array of a stash in the order (treeid, packageid, key) *.
[in,out] | stash | The stash to be considered. |
t8_stash_t t8_stash_bcast | ( | t8_stash_t | stash, |
int | root, | ||
sc_MPI_Comm | comm, | ||
size_t | elem_counts[3] | ||
) |
Broadcast a stash on the root process to all processes in a communicator.
The number of entries in the classes, joinfaces and attributes arrays must be known on the receiving processes before calling this function.
[in,out] | stash | On root the stash that is to be broadcasted. On the other process an initialized stash. Its entries will get overwritten by the entries in the root stash. |
[in] | root | The mpirank of the root process. |
[in] | comm | The mpi communicator which is used fpr broadcast. |
[in] | elem_counts | An array with three entries giving the number of elements in the classes, joinfaces and attributes arrays. |
ssize_t t8_stash_class_bsearch | ( | t8_stash_t | stash, |
t8_gloidx_t | tree_id | ||
) |
Search for an entry with a given tree index in the class-stash.
The stash must be sorted beforehand.
[in] | stash | The stash to be searched for. |
[in] | tree_id | The global tree id. |
void t8_stash_class_sort | ( | t8_stash_t | stash | ) |
Sort the entries in the class array by the order given in the enum definition of t8_eclass.
[in,out] | stash | The stash whose class array is sorted. |
void t8_stash_destroy | ( | t8_stash_t * | pstash | ) |
Free all memory associated in a stash structure.
[in,out] | pstash | A pointer to the stash to be destroyed. The pointer is set to NULL after the function call. |
void* t8_stash_get_attribute | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return the pointer to an attribute in the stash.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
int t8_stash_get_attribute_id | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return the package_id of a given attribute.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
int t8_stash_get_attribute_key | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return the key of a given attribute.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
size_t t8_stash_get_attribute_size | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return the size (in bytes) of an attribute in the stash.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
t8_gloidx_t t8_stash_get_attribute_tree_id | ( | t8_stash_t | stash, |
size_t | index | ||
) |
Return the id of the tree a given attribute belongs to.
[in] | stash | The stash to be considered. |
[in] | index | The index of the attribute in the attribute array of stash. |
void t8_stash_init | ( | t8_stash_t * | pstash | ) |
Initialize a stash data structure.
[in,out] | pstash | A pointer to the stash to be initialized. |
int t8_stash_is_equal | ( | t8_stash_t | stash_a, |
t8_stash_t | stash_b | ||
) |
Check two stashes for equal content and return true if so.
[in] | stash_a | The first stash to be considered. |
[in] | stash_b | The first stash to be considered. |
void t8_stash_joinface_sort | ( | t8_stash_t | stash | ) |
Sort then entries in the facejoin array in order of the first treeid.
[in,out] | stash | The stash whose facejoin array is sorted. |