Identify all possible children local ids for each of the 27 direct neighbors results are saved in the ElemList
How to use this information: There are two main ways of doing so.
1.) Use eligibleChildren array as a subset array of directChildren Let's say, you have a neighbor on the right border (=East border), which is on a coarser level. But you need the treeIDs of the neighbor on the same level. You then call tem_directChildren( coarseNEighborTreeID ) to get all the children. Then, you can access the treeIDs on the east border (that is the treeIDs of the children on the West!! border of the coarser neighbor) by using the eligibleChildren as a subset to access the tem_directChildren childrenIDs( eligible_child( iChild ))
2.) Use elgibleChildren as an offset from the lower, left, bottom child tree ID of the parent.
This is routine is Morton curve specific HK: and solver specific?
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out), | allocatable | :: | eligible_child(:) |
Candidate children, which might be considered as neighbors |
|
integer, | intent(in) | :: | direction |
In which direction to search for neighbors |
pure subroutine tem_eligibleChildren(eligible_child, Direction) ! -------------------------------------------------------------------- ! !> Candidate children, which might be considered as neighbors integer, intent(out), allocatable :: eligible_child(:) !> In which direction to search for neighbors integer, intent(in) :: direction ! -------------------------------------------------------------------- ! ! -------------------------------------------------------------------- ! select case ( Direction ) ! direct neighbor directions: 4 children case( q__W) allocate(eligible_child(4)) eligible_child(1) = 1 eligible_child(2) = 3 eligible_child(3) = 5 eligible_child(4) = 7 case( q__E) allocate(eligible_child(4)) eligible_child(1) = 2 eligible_child(2) = 4 eligible_child(3) = 6 eligible_child(4) = 8 case( q__S) allocate(eligible_child(4)) eligible_child(1) = 1 eligible_child(2) = 2 eligible_child(3) = 5 eligible_child(4) = 6 case( q__N) allocate(eligible_child(4)) eligible_child(1) = 3 eligible_child(2) = 4 eligible_child(3) = 7 eligible_child(4) = 8 case( q__B) allocate(eligible_child(4)) eligible_child(1) = 1 eligible_child(2) = 2 eligible_child(3) = 3 eligible_child(4) = 4 case( q__T) allocate(eligible_child(4)) eligible_child(1) = 5 eligible_child(2) = 6 eligible_child(3) = 7 eligible_child(4) = 8 ! edge neighbor directions: 2 children case( q_SW) allocate(eligible_child(2)) eligible_child(1) = 1 eligible_child(2) = 5 case( q_NW) allocate(eligible_child(2)) eligible_child(1) = 3 eligible_child(2) = 7 case( q_SE) allocate(eligible_child(2)) eligible_child(1) = 2 eligible_child(2) = 6 case( q_NE) allocate(eligible_child(2)) eligible_child(1) = 4 eligible_child(2) = 8 case( q_BW) allocate(eligible_child(2)) eligible_child(1) = 1 eligible_child(2) = 3 case( q_TW) allocate(eligible_child(2)) eligible_child(1) = 5 eligible_child(2) = 7 case( q_BE) allocate(eligible_child(2)) eligible_child(1) = 2 eligible_child(2) = 4 case( q_TE) allocate(eligible_child(2)) eligible_child(1) = 6 eligible_child(2) = 8 case( q_BS) allocate(eligible_child(2)) eligible_child(1) = 1 eligible_child(2) = 2 case( q_TS) allocate(eligible_child(2)) eligible_child(1) = 5 eligible_child(2) = 6 case( q_BN) allocate(eligible_child(2)) eligible_child(1) = 3 eligible_child(2) = 4 case( q_TN) allocate(eligible_child(2)) eligible_child(1) = 7 eligible_child(2) = 8 ! corner neighbor directions: only one child case( qBSW) allocate(eligible_child(1)) eligible_child(1) = 1 case( qTNE) allocate(eligible_child(1)) eligible_child(1) = 8 case( qTNW) allocate(eligible_child(1)) eligible_child(1) = 7 case( qBSE) allocate(eligible_child(1)) eligible_child(1) = 2 case( qBNW) allocate(eligible_child(1)) eligible_child(1) = 3 case( qTSE) allocate(eligible_child(1)) eligible_child(1) = 6 case( qTSW) allocate(eligible_child(1)) eligible_child(1) = 5 case( qBNE) allocate(eligible_child(1)) eligible_child(1) = 4 end select ! select ( Direction ) end subroutine tem_eligibleChildren