update_childNeighborID Subroutine

private subroutine update_childNeighborID(neighID, childCoord, childPos, iStencilElem, elem, iStencil)

Update the link into a given direction, based on the childs neighbor relations. Define here the trumping rule to decide, which of the neighbors or boundarie is taken for the ghostFromFiner element

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(inout) :: neighID

neighID for coarser

integer, intent(in) :: childCoord(4)

child coordinates

integer, intent(in) :: childPos(8)

position of childIds in levelDesc elem tID list

integer, intent(in) :: iStencilElem

current stencil direction

type(tem_element_type), intent(in) :: elem
integer, intent(in) :: iStencil

Calls

proc~~update_childneighborid~~CallsGraph proc~update_childneighborid update_childNeighborID interface~tem_parentof tem_ParentOf proc~update_childneighborid->interface~tem_parentof proc~tem_idofcoord tem_IdOfCoord proc~update_childneighborid->proc~tem_idofcoord proc~tem_directparent tem_directParent interface~tem_parentof->proc~tem_directparent proc~tem_parentatlevel tem_ParentAtLevel interface~tem_parentof->proc~tem_parentatlevel proc~tem_levelof tem_LevelOf proc~tem_parentatlevel->proc~tem_levelof

Called by

proc~~update_childneighborid~~CalledByGraph proc~update_childneighborid update_childNeighborID proc~tem_find_bcs_fromfiner tem_find_BCs_fromFiner proc~tem_find_bcs_fromfiner->proc~update_childneighborid proc~add_ghostfromfiner add_ghostFromFiner proc~add_ghostfromfiner->proc~tem_find_bcs_fromfiner proc~add_ghostfromfiner->proc~add_ghostfromfiner proc~identify_local_element identify_local_element proc~identify_local_element->proc~add_ghostfromfiner proc~identify_halo identify_halo proc~identify_halo->proc~identify_local_element proc~single_process_element single_process_element proc~single_process_element->proc~identify_local_element

Source Code

  subroutine update_childNeighborID( neighID, childCoord, childPos,            &
    &                                iStencilElem, elem, iStencil)
    ! ---------------------------------------------------------------------------
    !> neighID for coarser
    integer(kind=long_k),intent(inout) :: neighID
    !> child coordinates
    integer, intent(in) :: childCoord(4)
    !> position of childIds in levelDesc elem tID list
    integer, intent(in) :: childPos(8)
    !> current stencil direction
    integer, intent(in) :: iStencilElem
    !>
    integer, intent(in) :: iStencil
    !>
    type(tem_element_type), intent(in) :: elem
    ! ---------------------------------------------------------------------------
    integer :: childID, posInElem, posInNeighID
    integer(kind=long_k) :: tNeighID
    ! ---------------------------------------------------------------------------

    childID = int(tem_idOfCoord( childCoord ))
    ! childPos holds the positions of the child treeIDs in levelDesc%elem
    ! only if the current child element really exists, get information from its
    ! stencil
    posInElem = childPos(childID)
    if ( posInElem > 0 ) then

      ! if child at current position exists,
      ! take the max tID neighbor parent or the
      ! min boundaryID -> trumping rule (bIDs are stored as negative integers)
      posInNeighID = elem%stencil%val( posInElem )%val(iStencil)%tIDpos( iStencilElem )
      tNeighID = elem%neighID%val( posInElem )%val( posInNeighID )
      if ( tNeighID > 0_long_k ) then
        ! neighbor exist, calculate its parent
        neighID = max( neighID, tem_parentOF(tNeighID) )
      else ! tNeighID <= 0
        ! neighbor is a BC ID
        neighID = max( neighID, tNeighID )
      end if

    end if

  end subroutine update_childNeighborID