Build the vertical dependencies of ghost elements
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(inout) | :: | levelDesc(minlevel:maxLevel) |
the level descriptor |
||
integer, | intent(in) | :: | minlevel |
Level range |
||
integer, | intent(in) | :: | maxLevel |
Level range |
subroutine tem_build_verticalDependencies( levelDesc, minlevel, maxLevel ) ! --------------------------------------------------------------------------- !> Level range integer, intent(in) :: minlevel, maxLevel !> the level descriptor type(tem_levelDesc_type), intent(inout) :: levelDesc(minlevel:maxLevel) ! --------------------------------------------------------------------------- integer(kind=long_k) :: ghostID, parentID, childTreeID(8) integer :: iLevel, iElem, iChild integer :: offset, posInTotal, childNum ! --------------------------------------------------------------------------- write(logUnit(3),*) 'Build vertical dep ...' write(dbgUnit(1),*) '' write(dbgUnit(1),*) ' into tem_build_verticalDependencies ... ' ! Start with GhostFromCoarser do iLevel = minLevel+1, maxLevel allocate( levelDesc( iLevel )%depFromCoarser( & & levelDesc( iLevel )%elem%nElems( eT_ghostFromCoarser ))) offset = levelDesc( iLevel )%offset(1,eT_ghostFromCoarser) do iElem = 1, levelDesc( iLevel )%elem%nElems( eT_ghostFromCoarser ) ! ghost tree ID ghostID = levelDesc( iLevel )%total( offset+iElem ) parentID = tem_parentOf( ghostID ) ! the order as a child for this target childNum = tem_ChildNumber( ghostID ) ! Store the child number and coord ! calculate relative position of target to its parent: ! Bary of parent is considered as 0,0,0 ! dx on coarser level is considered as 1 ! childNum childPosition(childNum, 1:3) ! 1 -1, -1, -1 ! 2 1, -1, -1 ! 3 -1, 1, -1 ! 4 1, 1, -1 ! 5 -1, -1, 1 ! 6 1, -1, 1 ! 7 -1, 1, 1 ! 8 1, 1, 1 levelDesc( iLevel )%depFromCoarser( iElem )%childNum = childNum levelDesc( iLevel )%depFromCoarser( iElem )%coord(:) = & & 0.25_rk * dble(childPosition(childNum, 1:3)) ! position of ghost parent ID in total list in level-1 posInTotal = tem_treeIDinTotal( parentID, levelDesc( iLevel-1 ) ) ! Add the requested TreeID to the halos and add dependencies call appendGhostDependency( & & sourcePos = posInTotal, & & sourceLevel = iLevel-1, & & tgtDep = levelDesc( iLevel )%depFromCoarser( iElem )) end do ! iElem end do ! iLevel ! Continue with GhostFromFiner do iLevel = minLevel, maxLevel allocate( levelDesc( iLevel )%depFromFiner( & & levelDesc( iLevel )%elem%nElems( eT_ghostFromFiner ) )) offset = levelDesc( iLevel )%offset(1,eT_ghostFromFiner) do iElem = 1, levelDesc( iLevel )%elem%nElems( eT_ghostFromFiner ) ! coarser ghost ID ghostID = levelDesc( iLevel )%total( offset+iElem ) ! children of coarser ghost childTreeID(:) = tem_directChildren( ghostID ) ! append position of each children ID to depFromFiner list do iChild = 1, 8 posInTotal = tem_treeIDinTotal( childTreeID( iChild ), & & levelDesc( iLevel+1 )) if( posInTotal > 0 ) then ! if the child treeID exists, add dependency call appendGhostDependency( & & sourcePos = posInTotal, & & sourceLevel = iLevel+1, & & tgtDep = levelDesc( iLevel )%depFromFiner( iElem )) end if end do ! iChild = 1, 8 end do ! iElem = 1, elem%nElems( eT_ghostFromFiner ) end do ! iLevel = minLevel, maxLevel write(dbgUnit(1),*) ' leave tem_build_verticalDependencies ... ' write(dbgUnit(1),*) '' end subroutine tem_build_verticalDependencies