tem_ParentAtLevel Function

private function tem_ParentAtLevel(TreeID, level) result(parentID)

This function provides the parent ID of a given tree ID on a given level.

The parent ID on a given level is calculated using the equation \f[ id_{l-1}=\frac{id_{l}-1}{8} \f] in a loop.

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(in) :: TreeID

treeID of which the pID is requested

integer, intent(in) :: level

the level on which the pID is requested

Return Value integer(kind=long_k)

resulting parent ID


Calls

proc~~tem_parentatlevel~~CallsGraph proc~tem_parentatlevel tem_ParentAtLevel proc~tem_levelof tem_LevelOf proc~tem_parentatlevel->proc~tem_levelof

Called by

proc~~tem_parentatlevel~~CalledByGraph proc~tem_parentatlevel tem_ParentAtLevel interface~tem_parentof tem_ParentOf interface~tem_parentof->proc~tem_parentatlevel proc~update_childneighborid update_childNeighborID proc~update_childneighborid->interface~tem_parentof proc~create_allparentneighbors create_allParentNeighbors proc~create_allparentneighbors->interface~tem_parentof proc~identify_elements identify_elements proc~create_allparentneighbors->proc~identify_elements proc~tem_adddep_up tem_addDep_up proc~tem_adddep_up->interface~tem_parentof proc~tem_build_verticaldependencies tem_build_verticalDependencies proc~tem_build_verticaldependencies->interface~tem_parentof proc~tem_find_bcs_fromfiner tem_find_BCs_fromFiner proc~tem_find_bcs_fromfiner->proc~update_childneighborid proc~request_remotehalos request_remoteHalos proc~request_remotehalos->proc~create_allparentneighbors proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_build_verticaldependencies proc~identify_elements->proc~create_allparentneighbors proc~identify_elements->proc~identify_elements proc~tem_facedep_verticalup tem_faceDep_verticalUp proc~tem_facedep_verticalup->proc~tem_adddep_up proc~add_ghostfromfiner add_ghostFromFiner proc~add_ghostfromfiner->proc~tem_find_bcs_fromfiner proc~communicate_elements communicate_elements proc~communicate_elements->proc~request_remotehalos proc~build_levelelements build_levelElements proc~build_levelelements->proc~identify_elements proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->proc~tem_create_leveldesc proc~identify_stencilneigh identify_stencilNeigh proc~identify_stencilneigh->proc~identify_elements proc~identify_additionalneigh identify_additionalNeigh proc~identify_additionalneigh->proc~identify_elements proc~tem_facedep_vertical tem_faceDep_vertical proc~tem_facedep_vertical->proc~tem_facedep_verticalup

Contents

Source Code


Source Code

  function tem_ParentAtLevel(TreeID, level) result(parentID)
    ! ---------------------------------------------------------------------------
    !> treeID of which the pID is requested
    integer(kind=long_k),intent(in) :: TreeID
    !> the level on which the pID is requested
    integer,intent(in) :: level
    !> resulting parent ID
    integer(kind=long_k) :: parentID
    ! ---------------------------------------------------------------------------
    integer :: cLevel ! the current level of the tree ID
    integer :: iLevel ! level iterator
    ! ---------------------------------------------------------------------------

    parentID = TreeID
    cLevel = tem_LevelOf(TreeID)

    do iLevel = 1, cLevel-level
      ! parentID = (parentID - 1) / 8
      parentID = ishft( (parentID-1_long_k), -3 )
    end do

  end function tem_ParentAtLevel