The tNode Structure

The tNode Structure serves as a lightweight dummy struct for use during h-refinement. Each tNode instance corresponds to a specific tGrid, and when no refinement operations are currently going on, the position of the two in their respective tStacks mirrors each other.

The operations amr_gridstack_recreate and amr_nodestack_recreate allow rebuilding the respective stacks from each other to make sure their order is the same. This allows for example sorting the nodestack by newly generated global indices, and then applying the same sorted order to the gridstack.

While both amr_gridstack_recreate and amr_nodestack_recreate clean the current stack in question, only amr_nodestack_recreate also destroy the former contents of the nodestack and then recreates new tNodes from the tGrids in the gridstack. amr_gridstack_recreate instead populates the new gridstack with the tGrids contained in the tNodes, which may or may not also have been in the old gridstack.

Members

Several members are arrays of size [6] or [6][4]. In these cases the [6]-index addresses directions, and the [4]-index addresses the up to 4 neighbours in a given direction.
int nnode

MPI-local node id.

int nnode_global

MPI-global node id.

int* i8s

This array of ints contains the h-refinement history of this grid. It contains the child indices of its ancestors, running from 0 to 7 for each level, up to the current level. These numbers are used during coarsening to determine groups of sibling grids. This array is dynamically allocated since the number of h-levels is not known at compile time.

int ne_ranks[6][4]

MPI ranks of all neighbours.

int ne_global[6][4]

ids of all neighbours.

int ne_dir[6]

This indicates in which direction this node appears, as seen from a neighbour node. This is relevant at patch borders, where relative orientation changes. Although this is an int, it should be used just like a tBoundSurface.

int ne_sub[6]

This indicates which neighbour this node is, as seen from a neighbour node. Only meaningful when this node’s hlevel is greater than the neighbour’s hlevel, otherwise set to 0.

int ne_map[6]

Apparently deprecated.

int ne_hlevel[6]

h-refinement level of neighbouring nodes.

int hlevel

h-refinement level of this node.

int hlflag

Target h-refinement level as determined by refinement indicator function.

int hltemp

Maximum of hlevel and hlflag. Used during refinement flag legalization.

int norefine

Flag indicating that this node should not be refined. Unused and currently not functioning.

int ngrid

MPI-local id of the tGrid this node corresponds to.

int ngrid_global

MPI-global id of the tGrid this node corresponds to.

tGrid* grid

Pointer to the tGrid this node corresponds to.