DLR-AMR / t8code

Parallel algorithms and data structures for tree-based AMR with arbitrary element shapes.

Home Page:https://dlr-amr.github.io/t8code/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fully enable cmesh ghost attributes when committing a partitioned cmesh from stash

lukasdreyer opened this issue · comments

Currently, when building a partitioned cmesh from stash, the ghost attributes are not added correctly.

Before adding tree/ghost attributes, all attributes are sorted regarding their global id.
In the ghost data structure, ghost neighbors are added as soon as a faceconnection from one of the local trees is found, so they do not need to be in the same order as the attributes.

This makes it more complicated to figure out the offsets needed to jump from the beginning of the first attribute info to the beginning of the data of the current attribute.

attr_info->attribute_offset needs to be set in t8_cmesh_trees_add_ghost_attribute
where attribute_offset is the offset in bytes from the first attribute info of this ghost to the actual data of the current attribute in the linear char array of the part. (see macros below)

#define T8_TREE_ATTR_INFO(t, i) \
  ((t8_attribute_info_struct_t *) ((char *) (t) + (t)->att_offset + (i) * sizeof (t8_attribute_info_struct_t)))
/* Given a tree and an attribute info return the attribute */
#define T8_TREE_ATTR(t, ai) (T8_TREE_FIRST_ATT (t) + (ai)->attribute_offset)

These offset variables are continuously updated for the next attribute when adding the tree attributes, but this is not possible for the ghost attributes, since the next attribute info in the row does not need to match the next attribute that is added.

In order to compute the offset from the beginning of the first ghost attribute info to the beginning of the data, we could memorize the offset to the end of the attribute infos (maybe in the same hashmaps as the facejoins) and only accumulate the data sizes in t8_cmesh_trees_add_ghost_attribute

Prevents #1105 from being merged

#1173 Will close this